Hi 

I am having an issue where I am using Java Webstart to launch an application
, using Artifactory(v2.0.6) to host the resources.

This application will run over a "thin" link, so not downloading resources
unnecessarily is important.

When Java Webstart requests a jar , it caches it with a timestamp of the
"Last-Modified" HTTP header.
Subsequent requests are sent with an "If-Modified-Since" HTTP header.

I would expect Artifactory to return a 304 - not modified response, however
for certain Jars it doesn't - it returns a 200 and the jar is downloaded.

I have reproduced this using curl as follows:

Good Request 304 returned  ( If-Modified-Since timestamp is 1 sec later than
Last-Modified timestamp )

curl -viO# -H "Pragma: " -z "Mon, 10 Aug 2009 07:41:26 GMT"
http://localhost:7102/artifactory/repo/ant/ant/1.7.1/ant-1.7.1.jar
> GET /artifactory/repo/ant/ant/1.7.1/ant-1.7.1.jar HTTP/1.1
User-Agent: curl/7.12.1 (x86_64-redhat-linux-gnu) libcurl/7.12.1
OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6
Host: localhost:7102
Accept: */*
If-Modified-Since: Mon, 10 Aug 2009 07:41:26 GMT
< HTTP/1.1 304 Not Modified
< Server: Artifactory/2.0.6

Bad Request 200 returned  ( If-Modified-Since timestamp is same as
Last-Modified timestamp )

curl -viO# -H "Pragma: " -z "Mon, 10 Aug 2009 07:41:25 GMT"
http://localhost:7102/artifactory/repo/ant/ant/1.7.1/ant-1.7.1.jar
> GET /artifactory/repo/ant/ant/1.7.1/ant-1.7.1.jar HTTP/1.1
User-Agent: curl/7.12.1 (x86_64-redhat-linux-gnu) libcurl/7.12.1
OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6
Host: localhost:7102
Accept: */*
If-Modified-Since: Mon, 10 Aug 2009 07:41:25 GMT

< HTTP/1.1 200 OK
< Server: Artifactory/2.0.6
< Content-Type: application/zip
< Content-Length: 1323415
< Last-Modified: Mon, 10 Aug 2009 07:41:25 GMT
######################################### 100.0%


I did an export of the repository and looked at the metadata for the file
and the artifactory-file.xml contains the lastModified timestamp:
  <lastModified>1249890085327</lastModified>

If you convert the timestamp ( minus the last 3 digits - the millisecond
portion ) 

$ date -d @1249890085
Mon Aug 10 07:41:25 GMT 2009

this matches what is seen in the header.

However for the jar files that work - the timestamps always end in "000" (
ie. the milliseconds have been rounded off ).

Any new jar files I upload always seem to have the timestamp rounded to 000
milliseconds.

I have done a export of the repository and re-imported it to Artifactory
v2.1.3 - but the issue still exists.

Does anyone know:

1) How to clean this up ( other than exporting , editing the
artifactory-file.xml files and reimporting )
2) Is this behaviour correct?  As you can't pass millisecs in an HTTP header
, shouldn't Artifactory be rounding the timestamps down to the nearest
second when comparing? - I think this is being done in 
org.artifactory.api.request.ArtifactoryRequestBase:isNewerThanResource()

Many thanks in advance
David
-- 
View this message in context: 
http://old.nabble.com/Artifactory-not-always-respecting-%22If-Modified-Since%22-HTTP-header-tp27343712p27343712.html
Sent from the Artifactory-Users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Artifactory-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/artifactory-users

Reply via email to