Hi I think I might have found a bug with PartialCo...
# ktor
m
Hi I think I might have found a bug with PartialContent when using respondFile on Ktor (using version 1.2.1 on Linux) : If I use
Copy code
embeddedServer(Netty, 8087) {
           install(PartialContent)

           routing {
               get("/testfile.jpg") {
                   val srcFile = File(baseDir, "http/top_header_bg.jpg")

                   call.respondFile(srcFile) {
                       contentType
                   }
               }
           }
       }.start(wait = true)
Then when making an http request we have no content-length header:
Copy code
mike@mike-Lenovo-G50-80:~/src/UstadMobile$ wget --server-response <http://localhost:8087/testfile.jpg>
--2019-06-06 22:19:15--  <http://localhost:8087/static/top_header_bg.jpg>
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8087... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Accept-Ranges: bytes
  Content-Type: image/jpeg
  Connection: keep-alive
  transfer-encoding: chunked
Length: unspecified [image/jpeg]
Saving to: ‘top_header_bg.jpg.2’
If I remove install(PartialContent), then the content-length header is present:
Copy code
mike@mike-Lenovo-G50-80:~/src/UstadMobile$ wget --server-response <http://localhost:8087/testfile.jpg>
--2019-06-06 22:24:05--  <http://localhost:8087/testfile.jpg>
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8087... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Content-Length: 18947
  Content-Type: image/jpeg
  Connection: keep-alive
Length: 18947 (19K) [image/jpeg]
Saving to: ‘testfile.jpg.6’
The issue doesn't seem to effect content served using call.respondText. Have I missed something, or is this a bug?