jshttp / etag

Create simple HTTP ETags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

questions

jonathanong opened this issue · comments

  • why does weak default to true if the entity is a String? strings are pretty much buffers
  • stat-based etags should always be weak since we never check the actual bytes
  • i don't think there's a point in ever calculating with crc32. i think i benchmarked it earlier and found that crypto.createHash was faster than all of node's crc32 implementations (except maybe sse4_crc32 but that requires a native addon).

lol, you could have made 3 different issues :)

why does weak default to true if the entity is a String? strings are pretty much buffers

fine, i'll change the default back to strong :)

stat-based etags should always be weak since we never check the actual bytes

yea, so you mean throw if someone asks for a strong one, right?

i don't think there's a point in ever calculating with crc32. i think i benchmarked it earlier and found that crypto.createHash was faster than all of node's crc32 implementations (except maybe sse4_crc32 but that requires a native addon).

i'll write a benchmark so we can know for sure before changing it :)

yea, so you mean throw if someone asks for a strong one, right?

meh. i don't really like throwing, esp since i don't think this would ever "break" an app. maybe just debug() and document it?

well, if only node.js/javascript has a built-in warning mechanism, it could just emit a warning...

Stat etags should still always be weak :)

I'm still thinking about it :) The way the weak/strong works in this module right now is still wrong anyway.