mapbox / node-mbtiles

mbtiles utility, renderer, and storage backend for tilelive

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

E-Tag in too weak

jingsam opened this issue · comments

in https://github.com/mapbox/node-mbtiles/blob/master/lib/mbtiles.js#L165

headers['ETag'] = mbtiles._stat.size + '-' + Number(mbtiles._stat.mtime);

This E-Tag may be too weak.

@jingsam any reason why it's too weak? Suggestions to make it stronger?

The ETag is not only too weak, but also incorrect. Weak is that if we have two different mbtiles with same size and mtime, This ETags can not distinguish them. Incorrect is that the ETag should be different if the contents of tiles are different, but this algorithm returns same ETag for all tiles in one mbtiles.

How to fix it? I think just deleted it. Express, nginx, apache all have mechanism to calculate the ETag.