Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
This is quite trivial and helps with performance -- various accelerator methods can have a better grip on what Drupal generates. page_set_header will need patching too but this is good as it is.
Comment | File | Size | Author |
---|---|---|---|
#13 | issue-297141.patch | 1.44 KB | lilou |
#12 | issue-297141.patch | 1.44 KB | lilou |
#10 | issue-297141.patch | 834 bytes | lilou |
#5 | content-length-header-297141-D7.patch | 1.39 KB | Dave Reid |
headers.patch | 618 bytes | chx | |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedIt looks like drupal_page_cache_header() already does that for the Etag part. The Content-Length might help, thou.
Comment #2
yonailo CreditAttribution: yonailo commentedCould you please elaborate how the Content-Legth field can help with performance ? if you can give some URLs it would be nice !. Thanks.
Comment #3
yonailo CreditAttribution: yonailo commentedSorry I mistakenly changed the title of the thread.
Comment #4
yonailo CreditAttribution: yonailo commentedI have found problems applying this patch on my site.
Specifically, I have found incomplete load of our home page when it is served from the cache on Internet Explorer 6, we use a lot of jquery and ajax calls on the web page, and the problem dissapears if I remove the Content-Length header and truncate cache_page.
Comment #5
Dave ReidRevised patch that adds the content-length to drupal_page_cache_header, instead of adding the headers really late in page_set_cache.
Comment #6
Dave ReidRevision to title because this patch no longer adds the etag header, since the drupal_page_cache_header function already does that. The patch in #5 also moves some header() calls around so that they can be done together.
Comment #7
yonailo CreditAttribution: yonailo commentedI am watching the patch and it seems not right to me. After adding the header Content-Lenght, there is a condition that uncompress cache->data if the browser does not support compression, that would make the value previously set invalid, wouldn't it?
Comment #8
Dave ReidNo, it sends that header only after $cache->data has been prepared.
Comment #9
yonailo CreditAttribution: yonailo commentedOk, I didn't apply the patch and I was looking at my source code, which is D5:
Obvisouly to apply this patch on this code, the header('Content-Length') should be set AFTER the line:
because this line modifies the length.
That was what I was saying. Sorry for the confusion.
Comment #10
lilou CreditAttribution: lilou commentedPatch attached according to #9. Add also a comment (from http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html ) :
Comment #11
Dave ReidOk seriously, the patch in #5, sends that header after all the $cache->data manipulation has been done. You need to try the patch. According to the description, "The patch in #5 also moves some header() calls around so that they can be done together." (for clarity).
I'm all for the additional comment in #10, but for readability sake, let's please base off the patch in #5.
Comment #12
lilou CreditAttribution: lilou commentedSo ...
Comment #13
lilou CreditAttribution: lilou commentedComment #14
yonailo CreditAttribution: yonailo commentedDave Reid is absolutely right, his patch applies correctly.
Is it not possible to delete my previous post (#10) ?
I see that I can edit it, but I am a bit ashamed so I would like to remove it...
(you can consider me as a kind of drupal.org newbie :)
Comment #15
c960657 CreditAttribution: c960657 commentedNote that setting Content-Length explicitly causes problems with PHPs zlib.output_compression feature, so I suggest not adding the header if this feature is enabled:
http://www.php.net/manual/en/ref.zlib.php#43181
Could you give some examples of situations where this would improve performance?
Comment #17
Dave ReidFailed due to #74645: modify file_scan_directory to include a regex for the nomask.. Setting back to code needs review.
Comment #19
lilou CreditAttribution: lilou commentedAdd tag.
Comment #20
nicholasThompsonWhat's the status of this? Is it safe to add the Content-Length header even for gzipped pages?
Comment #21
chx CreditAttribution: chx commented