Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support (store) ETag if remote (http) resource provides it #69

Open
yarikoptic opened this issue Feb 11, 2020 · 0 comments
Open

Support (store) ETag if remote (http) resource provides it #69

yarikoptic opened this issue Feb 11, 2020 · 0 comments

Comments

@yarikoptic
Copy link
Member

https://en.wikipedia.org/wiki/HTTP_ETag

Loris provides ETags:

$> curl -v --output blah -G -H "Authorization: Bearer $token" https://openpreventad.loris.ca/api/v0.0.3-dev/candidates/1076159/NAPFU36/images/preventad_1076159_NAPFU36_fieldmap-phasediff_003.mnc
...
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx/1.10.3
< Date: Tue, 11 Feb 2020 20:34:25 GMT
< Content-Type: application/x.minc2
< Content-Length: 431914
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: *
< Content-Security-Policy: default-src 'self' 'unsafe-inline'; frame-src 'self' 'unsafe-inline' 'unsafe-eval' www.google.com  www.gstatic.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' www.google.com  www.gstatic.com; font-src 'self' data:; img-src 'self' data:;
* Added cookie PHPSESSID="21mgvllpk8vo3rd45882tekduj" for domain openpreventad.loris.ca, path /, expire 0
< Set-Cookie: PHPSESSID=21mgvllpk8vo3rd45882tekduj; path=/; HttpOnly
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: private
< Pragma: no-cache
< ETag: cf0b3b23cca79021e93bc0f753aea471
< Content-Disposition: attachment; filename=preventad_1076159_NAPFU36_fieldmap-phasediff_003.mnc
< 
{ [15604 bytes data]
100  421k  100  421k    0     0  1262k      0 --:--:-- --:--:-- --:--:-- 1262k
* Connection #0 to host openpreventad.loris.ca left intact

and then redownload could be prevented:

$> curl -v --output blah -G -H 'If-None-Match: cf0b3b23cca79021e93bc0f753aea471' -H "Authorization: Bearer $token" https://openpreventad.loris.ca/api/v0.0.3-dev/candidates/1076159/NAPFU36/images/preventad_1076159_NAPFU36_fieldmap-phasediff_003.mnc
...

and again example with HEAD request using curl

$> curl  -X HEAD --head -H "Authorization: Bearer $token" https://openpreventad.loris.ca/api/v0.0.3-dev/candidates/1076159/NAPFU36/images/preventad_1076159_NAPFU36_fieldmap-phasediff_003.mnc 
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Tue, 11 Feb 2020 20:40:48 GMT
Content-Type: application/x.minc2
Content-Length: 431914
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: *
Content-Security-Policy: default-src 'self' 'unsafe-inline'; frame-src 'self' 'unsafe-inline' 'unsafe-eval' www.google.com  www.gstatic.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' www.google.com  www.gstatic.com; font-src 'self' data:; img-src 'self' data:;
Set-Cookie: PHPSESSID=mmq99pr0f5s6a5q1gpmougha3a; path=/; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: private
Pragma: no-cache
ETag: cf0b3b23cca79021e93bc0f753aea471
Content-Disposition: attachment; filename=preventad_1076159_NAPFU36_fieldmap-phasediff_003.mnc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant