jshttp / etag

Create simple HTTP ETags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

optionally include all the headers

jonathanong opened this issue · comments

http://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation

according to the wiki, strong etags mean that the entity headers are unchanged as well. we should optionally allow users include these headers and apply them into the hash

I was just looking into this to see what a good way would be; I'm trying to decide the following things:

  1. Should it just be dump & simple by just taking into consideration all Content-* headers?
  2. Should the Content-Length being there vs. absent make a difference?
  3. Should Content-Range be taken into consideration?
  4. Should Content-Encoding be taken into consideration?
  5. Is it even worth it?

i'm not sure... to me, these extra headers are only relevant if we don't take a sha of the entire body. if we do a sha of the body, we shouldn't need to include these headers in the etag calculation.

SGTM; as of the current master (and thus 2.0) we will always take a MD5 and include length outside the hash for length extensions. That should pretty much guarantee what we need. The only real header that seems useful to consider is Content-Type.