Nginx always returns 206 with HTTP header 'Range: bytes=0-'

Igor Sysoev igor at sysoev.ru
Sat Aug 7 14:41:07 MSD 2010


On Sat, Aug 07, 2010 at 05:52:29AM -0400, huandu wrote:

> When requesting a static file with HTTP header "Range: bytes=0-", nginx
> always return 206 Partial Content. Is it a bug?
> 
> This issue can be reproduced like this:
> 
> curl -v -o /dev/null -H "Range: bytes=0-"
> 'http://wiki.nginx.org/local/propaganda/postgresql.gif'
> 
> * About to connect() to wiki.nginx.org port 80
> *   Trying 69.168.53.49... connected
> * Connected to wiki.nginx.org (69.168.53.49) port 80
> > GET /local/propaganda/postgresql.gif HTTP/1.1
> > User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5
> OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> > Host: wiki.nginx.org
> > Accept: */*
> > Range: bytes=0-
> >
> < HTTP/1.1 206 Partial Content
> < Server: nginx/0.8.47
> < Date: Sat, 07 Aug 2010 09:35:58 GMT
> < Content-Type: image/gif
> < Content-Length: 196
> < Last-Modified: Tue, 06 Nov 2007 20:42:04 GMT
> < Connection: keep-alive
> < Expires: Mon, 06 Sep 2010 09:35:58 GMT
> < Cache-Control: max-age=2592000
> < Content-Range: bytes 0-195/196
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time 
> Current
>                                  Dload  Upload   Total   Spent    Left 
> Speed
> 100   196  100   196    0     0   1329      0 --:--:-- --:--:-- --:--:--
>     0Connection #0 to host wiki.nginx.org left intact

Apache does the same:

curl -v -o /dev/null -H "Range: bytes=0-" http://apache.org/robots.txt
* About to connect() to apache.org port 80 (#0)
*   Trying 140.211.11.131... connected
* Connected to apache.org (140.211.11.131) port 80 (#0)
> GET /robots.txt HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: apache.org
> Accept: */*
> Range: bytes=0-
> 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0< HTTP/1.1 206 Partial Content
< Date: Sat, 07 Aug 2010 10:39:52 GMT
< Server: Apache/2.3.7-dev (Unix) mod_ssl/2.3.7-dev OpenSSL/1.0.0a
< Last-Modified: Tue, 16 May 2006 11:57:46 GMT
< ETag: "910d4f-2f-413e682e08280"
< Accept-Ranges: bytes
< Content-Length: 47
< Cache-Control: max-age=86400
< Expires: Sun, 08 Aug 2010 10:39:52 GMT
< Vary: Accept-Encoding
< Content-Range: bytes 0-46/47
< Content-Type: text/plain
< 
{ [data not shown]
  0    47    0    47    0     0     77      0 --:--:-- --:--:-- --:--:--   152* Connection #0 to host apache.org left intact

* Closing connection #0


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list