Community
Participate
Working Groups
Just with the default jetty distribution running on my desktop, and the test.war file that's distributed with it, we have this situation. Get a small file ( I haven't determined the size yet ), the length shows up fine. mattrose@coltrane:~/Desktop$ wget -S http://localhost:8080/d.txt --2011-02-03 15:52:34-- http://localhost:8080/d.txt Resolving localhost... ::1, 127.0.0.1 Connecting to localhost|::1|:8080... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Date: Thu, 03 Feb 2011 20:52:34 GMT Content-Type: text/plain Last-Modified: Wed, 20 Oct 2010 18:50:22 GMT Accept-Ranges: bytes Content-Length: 610 Connection: keep-alive Server: Jetty(7.2.0.v20101020) Length: 610 [text/plain] Get a larger file, the length is not included in the headers on a GET request. mattrose@coltrane:~/Desktop$ wget -S http://localhost:8080/da.txt --2011-02-03 15:52:41-- http://localhost:8080/da.txt Resolving localhost... ::1, 127.0.0.1 Connecting to localhost|::1|:8080... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Date: Thu, 03 Feb 2011 20:52:41 GMT Content-Type: text/plain Last-Modified: Wed, 20 Oct 2010 18:50:22 GMT Accept-Ranges: bytes Server: Jetty(7.2.0.v20101020) Length: unspecified [text/plain] Oddly enough, when you do a HEAD request on the same file, the length is returned with the headers. mattrose@coltrane:~/Desktop$ HEAD http://localhost:8080/da.txt 200 OK Connection: close Date: Thu, 03 Feb 2011 20:53:08 GMT Accept-Ranges: bytes Server: Jetty(7.2.0.v20101020) Content-Length: 61000 Content-Type: text/plain Last-Modified: Wed, 20 Oct 2010 18:50:22 GMT Client-Date: Thu, 03 Feb 2011 20:53:08 GMT Client-Peer: 127.0.0.1:8080 Client-Response-Num: 1 Just a theory at this point, it may not include the content-length in the header response, because when it starts to serve the file, it does not know the size of the file. It's hard for me to tell what's going on because there's no real debug information, even with debug logging turned on.
Expected behaviour is that jetty will always set content-length on static resources.
I just tried trunk and it works fine: gregw@Brick: ~ [501] wget -S http://localhost:8080/da.txt --2011-02-23 16:33:25-- http://localhost:8080/da.txt Resolving localhost... ::1, 127.0.0.1 Connecting to localhost|::1|:8080... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Date: Wed, 23 Feb 2011 05:33:25 GMT Accept-Ranges: bytes Content-Type: text/plain Content-Length: 61000 Last-Modified: Sun, 05 Dec 2010 21:22:58 GMT Connection: keep-alive Server: Jetty(7.3.1-SNAPSHOT) Length: 61000 (60K) [text/plain] Saving to: `da.txt' 100%[======================================>] 61,000 --.-K/s in 0s 2011-02-23 16:33:25 (447 MB/s) - `da.txt' saved [61000/61000] We have reworked the static content cache since 7.2.0, so I think we may have fixed it then. Please reopen if it fails for you in a 7.3.x release
Works in jetty 7.3.1
thanks again for your help, btw.