Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Support If-range requests #80

Closed
GoogleCodeExporter opened this issue Apr 6, 2015 · 11 comments
Closed

Support If-range requests #80

GoogleCodeExporter opened this issue Apr 6, 2015 · 11 comments

Comments

@GoogleCodeExporter
Copy link

1. Load a page with rewritten resources in Firefox (make sure rewritten URLs 
actually appear).
2. Open firebug.
3. Reload (if this doesn't produce the symptoms below, go to the address bar 
and press "Enter").

Firefox initiates a request for the page, which returns 304 Not Modified (I 
believe this result is returned by skipping mod_pagespeed entirely, which is 
completely fine for our purposes).

Firefox then initiates a HEAD request for the contained rewritten resources.  
These requests are declined by mod_pagespeed and hang (I have seen 404s here, 
but not easily reproducible ones).  Firebug shows "-1" as the status.

mod_pagespeed should handle HEAD requests, and relatedly should answer 
If-modified-since, If-unmodified-since, and If-range (the latter, in 
particular, could cause us to return incorrect data).  See:
  http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

Original issue reported on code.google.com by jmaes...@google.com on 13 Nov 2010 at 1:31

@GoogleCodeExporter
Copy link
Author

Issue 112 has been merged into this issue.

Original comment by jmaes...@google.com on 24 Nov 2010 at 8:07

@GoogleCodeExporter
Copy link
Author

From:

http://www.the-art-of-web.com/system/mod-pagespeed/#section_3

Instead of returning a 304 Not Modified response, the whole file is transferred 
again.  So when a user agent makes an If-Modified-Since request, instead of 
receiving a 304 Not Modified header, they instead receive the entire file 
again. That could increase rather than reduce bandwidth usage in some 
situations.

This happens for images when a user hits 'reload' in IE.

Original comment by jmaes...@google.com on 24 Nov 2010 at 8:08

  • Changed title: Deal with HEAD, If-modified-since, If-unmodified-since, and If-range requests

@GoogleCodeExporter
Copy link
Author

Also note:

http://www.feedthebot.com/ifmodified.html

Original comment by jmaes...@google.com on 24 Nov 2010 at 8:08

@GoogleCodeExporter
Copy link
Author

Original comment by abl...@google.com on 30 Nov 2010 at 8:28

@GoogleCodeExporter
Copy link
Author

Note that resource requests that use if-unmodified-since should always return 
content (the current behavior).  This is because these resources are stored by 
content hash and their content never changes: they are always unmodified!

Original comment by jmaes...@google.com on 2 Dec 2010 at 4:35

  • Changed title: Deal with HEAD and If-range requests

@GoogleCodeExporter
Copy link
Author

HEAD requests seem to be working now.

Original comment by sligocki@google.com on 30 Dec 2010 at 11:59

  • Changed title: Deal If-range requests
  • Added labels: Priority-Medium
  • Removed labels: Priority-High

@GoogleCodeExporter
Copy link
Author

How?  I worry we're performing a full rewrite whenever a HEAD request is 
processed...

Original comment by jmaes...@google.com on 31 Dec 2010 at 3:23

@GoogleCodeExporter
Copy link
Author

Probably, but how often do we get HEAD requests? It seems like it might not 
need optimizing.


I tested this by using netcat to make HEAD requests, for example:

$ nc modpagespeed.com 80
HEAD / HTTP/1.1
Host: modpagespeed.com

HTTP/1.1 200 OK
Date: Fri, 31 Dec 2010 06:17:04 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Thu, 04 Nov 2010 17:32:06 GMT
Accept-Ranges: bytes
X-Mod-Pagespeed: 0.9.11.5-293
Cache-control: max-age=0, no-cache, no-store
Vary: Accept-Encoding
Content-Length: 8784
Connection: close
Content-Type: text/html; charset=UTF-8


$ nc modpagespeed.com 80
HEAD /images/Puzzle.jpg HTTP/1.1
Host: modpagespeed.com

HTTP/1.1 200 OK
Date: Fri, 31 Dec 2010 06:18:33 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Wed, 03 Nov 2010 03:25:09 GMT
Accept-Ranges: bytes
Content-Length: 241260
Cache-control: public, max-age=600
Connection: close
Content-Type: image/jpeg




$ nc modpagespeed.com 80
HEAD /images/1023x766xPuzzle.jpg.pagespeed.ic.GSLMcHP-fl.jpg HTTP/1.1
Host: modpagespeed.com

HTTP/1.1 200 OK
Date: Fri, 31 Dec 2010 06:20:09 GMT
Server: Apache/2.2.3 (CentOS)
Cache-Control: max-age=31536000
Vary: Accept-Encoding
Last-Modified: Fri, 31 Dec 2010 06:20:09 GMT
Content-Length: 235391
Expires: Sat, 31 Dec 2011 06:20:09 GMT
Connection: close
Content-Type: image/jpeg


Or even:


$ nc modpagespeed.com 80
HEAD /images/100x75xPuzzle.jpg.pagespeed.ic.GSLMcHP-fl.jpg HTTP/1.1
Host: modpagespeed.com

HTTP/1.1 200 OK
Date: Fri, 31 Dec 2010 06:21:24 GMT
Server: Apache/2.2.3 (CentOS)
Cache-Control: max-age=31536000
Vary: Accept-Encoding
Last-Modified: Fri, 31 Dec 2010 06:21:24 GMT
Content-Length: 5206
Expires: Sat, 31 Dec 2011 06:21:24 GMT
Connection: close
Content-Type: image/jpeg

Original comment by sligocki@google.com on 31 Dec 2010 at 6:21

@GoogleCodeExporter
Copy link
Author

Original comment by jmara...@google.com on 14 Jan 2011 at 6:17

  • Changed title: Support If-range requests

@GoogleCodeExporter
Copy link
Author

Original comment by jmara...@google.com on 7 Apr 2011 at 4:26

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

There were two issues here: a functional one that is fixed, and a performance 
idea that we will not pursue further at this time.  Closing.

Original comment by jmara...@google.com on 24 May 2012 at 7:09

  • Changed state: WontFix

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant