luarocks / luarocks-site

LuaRocks website and module host
http://luarocks.org
175 stars 36 forks source link

https://luarocks.org/manifest always returns http code 200 (instead of 304) #68

Open stepelu opened 8 years ago

stepelu commented 8 years ago

For the cmd below, I would expect to get a < HTTP/1.1 304 NOT MODIFIED (previous run was just 5 seconds before that) instead of code 200:

curl http://luarocks.org/manifest -z repository/manifest.lua -o repository/manifest.lua --verbose --silent --location
* Adding handle: conn: 0x7fb440803000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fb440803000) send_pipe: 1, recv_pipe: 0
* About to connect() to luarocks.org port 80 (#0)
*   Trying 45.33.61.132...
* Connected to luarocks.org (45.33.61.132) port 80 (#0)
> GET /manifest-5.1 HTTP/1.1
> User-Agent: curl/7.30.0
> Host: luarocks.org
> Accept: */*
> If-Modified-Since: Fri, 11 Sep 2015 19:04:12 GMT
>
< HTTP/1.1 200 OK
* Server nginx/1.6.3 is not blacklisted
< Server: nginx/1.6.3
< Date: Fri, 11 Sep 2015 19:04:15 GMT
< Content-Type: text/x-lua
< Content-Length: 259843
< Connection: keep-alive
< x-memory-cache-hit: 1
<
{ [data not shown]
* Connection #0 to host luarocks.org left intact

I am trying to figure out whenever the manifest gets updated so I can trigger a build step. I can just download the manifest and compare hashes, but I am aiming at minimising data transfer. Could this be fixed? Alternatively, is there another mechanism in place to achieve the stated goal?

jirutka commented 8 years ago

You’re description may be confusing for people that don't know HTTP well. There isn’t any problem with the status code, the API just doesn’t support HTTP header If-Modified-Since. So what you really want is to add support for cache-conditional requests.

Anyway, +1 for this request.

stepelu commented 8 years ago

Yes, this is a feature request, not a bug report.

My use case is to check frequently for updates to the repo without abusing the server's bandwidth.

Luarocks could be improved similarly with a caching optimisation based on this.