10

Does anyone know how the GitHub ETag when accessing raw content is generated?

As far as I can tell this is not MD5, SHA1 or any common SHA variant;

Example http headers:

HTTP/1.1 200 OK
Server: nginx/1.0.13
Date: Tue, 05 Jun 2012 19:46:08 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Status: 200 OK
ETag: "aa1da178ae0a43e23ce49a6b8f474738"

The ETag length is 32 characters, suggesting MD5, but this does not match the MD5 checksum of the downloaded file (downloaded using curl).

I am aware that ETags should be treated as opaque identifiers. Still, curious.

Ishan
  • 325
  • 2
  • 9

1 Answers1

0

My guess would be they are using the stock nginx etag module.

https://github.com/mikewest/nginx-static-etags/blob/master/ngx_http_static_etags_module.c

Tyler Eaves
  • 12,879
  • 1
  • 32
  • 39
  • 1
    Thanks, but no dice. That module generates ETags by concatenating some info from the Nginx request, the file size (hex), and the file mtime (hex). C format string "%s_%X_%X". Incidentally, even with the Nginx version specified in that project's README, something's broken.. This is how the ETag looks like: Etag: /redhat-release HTTP/1.1_newline_User-Agent_22_4FCFB809 That's URI path + protocol version + _\n_ + part of a request header + hex file size + hex file mtime. – Ishan Jun 06 '12 at 20:31