[RTFACT-14229] Pip requests often ignore "If-None-Match" and "If-Modified-Since" headers Created: 10/May/17  Updated: 06/Nov/18  Resolved: 14/Oct/18

Status: Resolved
Project: Artifactory Binary Repository
Component/s: PyPI
Affects Version/s: None
Fix Version/s: 6.6.0

Type: Bug Priority: High
Reporter: Travis Foster Assignee: Rotem Kfir
Resolution: Fixed Votes: 1
Labels: 20170515

Issue Links:
Dependency
Duplicate
is duplicated by RTFACT-15848 Npm metadata doesn't return Etag on 3... Resolved
Sprint: Leap 34

 Description   

When the If-None-Match or If-Modified-Since headers are used with an /artifactory/api/pypi/<repo>/<path> endpoint, in most situations the headers will be ignored:

Repository If-None-Match If-Modified-Since
pypi-local 304 200
pypi-remote 200 200
pypi-virtual 200 200

When instead using the /artifactory/<repo>/<path> endpoint for the same file, all responses are 304's, as they should be.

Example:

[~]: curl -uadmin:password -v http://localhost:8088/artifactory/pypi-remote/packages/86/e1/9cde84acb81b2071ebbf490002cb541ad33c52b18c792dfc38321abe7d4a/stripe-1.55.1.tar.gz > /dev/null -H 'If-None-Match: de06e25c9538911caba7164aef1b48cd6a8895cb'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8088 (#0)
* Server auth using Basic with user 'admin'
> GET /artifactory/pypi-remote/packages/86/e1/9cde84acb81b2071ebbf490002cb541ad33c52b18c792dfc38321abe7d4a/stripe-1.55.1.tar.gz HTTP/1.1
> Host: localhost:8088
> Authorization: Basic YWRtaW46cGFzc3dvcmQ=
> User-Agent: curl/7.54.0
> Accept: */*
> If-None-Match: de06e25c9538911caba7164aef1b48cd6a8895cb
> 
< HTTP/1.1 304 Not Modified
< Server: Artifactory/5.2.1
< X-Artifactory-Id: de448c696d32e70c:7918e7e8:15bf433890b:-8000
< Last-Modified: Wed, 10 May 2017 20:42:42 GMT
< ETag: de06e25c9538911caba7164aef1b48cd6a8895cb
< X-Checksum-Sha1: de06e25c9538911caba7164aef1b48cd6a8895cb
< Accept-Ranges: bytes
< X-Checksum-Md5: 0fd6311ea0a2ed40d41cf733de53787e
< X-Artifactory-Filename: stripe-1.55.1.tar.gz
< Content-Disposition: attachment; filename="stripe-1.55.1.tar.gz"; filename*=UTF-8''stripe-1.55.1.tar.gz
< Date: Wed, 10 May 2017 22:14:34 GMT
< 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Connection #0 to host localhost left intact
[~]: curl -uadmin:password -v http://localhost:8088/artifactory/api/pypi/pypi-remote/packages/86/e1/9cde84acb81b2071ebbf490002cb541ad33c52b18c792dfc38321abe7d4a/stripe-1.55.1.tar.gz > /dev/null -H 'If-None-Match: de06e25c9538911caba7164aef1b48cd6a8895cb'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8088 (#0)
* Server auth using Basic with user 'admin'
> GET /artifactory/api/pypi/pypi-remote/packages/86/e1/9cde84acb81b2071ebbf490002cb541ad33c52b18c792dfc38321abe7d4a/stripe-1.55.1.tar.gz HTTP/1.1
> Host: localhost:8088
> Authorization: Basic YWRtaW46cGFzc3dvcmQ=
> User-Agent: curl/7.54.0
> Accept: */*
> If-None-Match: de06e25c9538911caba7164aef1b48cd6a8895cb
> 
< HTTP/1.1 200 OK
< Server: Artifactory/5.2.1
< X-Artifactory-Id: de448c696d32e70c:7918e7e8:15bf433890b:-8000
< Last-Modified: Wed, 10 May 2017 20:42:42 GMT
< ETag: de06e25c9538911caba7164aef1b48cd6a8895cb
< X-Checksum-Sha1: de06e25c9538911caba7164aef1b48cd6a8895cb
< Accept-Ranges: bytes
< X-Checksum-Md5: 0fd6311ea0a2ed40d41cf733de53787e
< X-Artifactory-Filename: stripe-1.55.1.tar.gz
< Content-Disposition: attachment; filename="stripe-1.55.1.tar.gz"; filename*=UTF-8''stripe-1.55.1.tar.gz
< Content-Type: application/x-gzip
< Content-Length: 189588
< Date: Wed, 10 May 2017 22:15:44 GMT
< 
{ [16384 bytes data]
100  185k  100  185k    0     0  27.2M      0 --:--:-- --:--:-- --:--:-- 30.1M
* Connection #0 to host localhost left intact


 Comments   
Comment by David Alphus [ 14/Jun/18 ]

This is still an issue in 5.11.

Generated at Sun Oct 20 06:45:06 UTC 2019 using JIRA 7.6.16#76018-sha1:9ed376192612a49536ac834c64177a0fed6290f5.