Discussion in 'Feedback/Feature Requests' started by jailbird, Jul 12, 2006.

  1. jailbird

    jailbird Member

    I was just curious if there's a reason LSWS doesn't generate ETag headers for dynamic content (eg, PHP output via LSAPI).

    ETag is basically the only use I have left for cgi_buffer, and I'd like to just get rid of cgi_buffer completely :).
  2. mistwang

    mistwang LiteSpeed Staff

    If you want ETag header, you can generated it from PHP side.
  3. jailbird

    jailbird Member

    Ya, that's basically what I was using cgi_buffer. Was just curious since you have gzip support for dynamic content and ETag support for static content, if there was a reason you don't do ETag for dynamic :). It seems like it would be cleaner to keep that in the server instead of having to do it in all of the backends (PHP, Ruby, perl, FastCGI, etc).

    Thanks for the reply.
  4. mistwang

    mistwang LiteSpeed Staff

    Maybe we will add it when we implementing the disk cache.
    Calculating something like MD5 checksum for each every dynamic request is pretty expensive though. Any other idea for ETag calcuation? cgi_buffer uses MD5
    Last edited: Jul 12, 2006
  5. mistwang

    mistwang LiteSpeed Staff

    And there is annother issue with generating ETag dynamically, web server have to wait till the last byte of response body before it can start sending response back to client.
  6. Nope

    Nope Member

    What's the use of an ETag for dynamic content generated outside its application?

    For example I use etags within my forum project. There I create the etag on the fly based on the board_id+topic_id+page+highrestimer(of the last change in the database). This is done prior to anything else. If that plus the user_id matches against the one given with the request I can leave the app asap. If not I use the current etag to check the request against the forum's build in cache, so re-building the whole content can be avoided. Only if that fails, the base page is build, then the user specific things added.

    The server on the other hand knows nothing like that. It can only check the data the application is sending. To create something like a checksum from that beats the benefits of an etag to dust. Besides, if the data is user specific or if it's created based on the query string or a post, it's not cacheable, making the whole thing more than useless. If the content is created time specific, then a normal expires will do just fine. If it's just a redirected static file, then there should be no problem either.

    So basically I can't see much benefit of an etag for dynamic content without the app itself managing it.
  7. mistwang

    mistwang LiteSpeed Staff

    I agree, ETag generation should be application specific, otherwise, it is not that useful and wasting precious CPU cycles. :)

Share This Page