You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sinatra AssetPack fails to get a valid Last-Modified time from an asset packaged in a JAR causing upstream processing by Rack::Deflater to fail.
Environment
jruby-9.0.3.0
Linux & Mac (when running from a jar archive)
Using Sinatra, Sinatra AssetPack, and Rack::Deflater
Expected Behavior
When Rack goes to read the static asset from the jar file via the classpath: scheme it should provide a File object that returns useful Time object for File.mtime, so that when the Last-Modified header is read and parsed upstream processing w/ Rack::Deflater it can appropriately parse the Time string.
this isn't really possible - for a resources on classpath: we simply get a stream no notion of a "file" ...
however, if you're about to use the jar: protocol (not-applicable to this case) it should be working.
I agree there's no way for us to get a proper mtime for opaque classpath resources. I guess @r6p doesn't feel that the epoch is a good enough fallback for this case? It represents "time zero" on the unix clock, and if we have to provide something it seems like this is the best option.
What else would we use? 00:00:00 on 0001-01-01? I can't think of anything that would not cause problems.
What should File.mtime return for a file in a jar? The modified time for the file or at a minimum the modified time for the jar?
believe the reporter desires to have it reasonable since there are compiled assets being mtime compared.
so a different fallback won't do much - believe the epoch fallback is fine since that is a common thing to do.
Symptom
Sinatra AssetPack fails to get a valid Last-Modified time from an asset packaged in a JAR causing upstream processing by Rack::Deflater to fail.
Environment
jruby-9.0.3.0
Linux & Mac (when running from a jar archive)
Using Sinatra, Sinatra AssetPack, and Rack::Deflater
Expected Behavior
When Rack goes to read the static asset from the jar file via the classpath: scheme it should provide a File object that returns useful Time object for File.mtime, so that when the Last-Modified header is read and parsed upstream processing w/ Rack::Deflater it can appropriately parse the Time string.
Actual Behavior
It throws an ArgumentError @: https://github.com/headius/jruby/blob/master/lib/ruby/2.0/time.rb#L505
Another useful line just above the previous link in the stack : https://github.com/rack/rack/blob/master/lib/rack/deflater.rb#L58
What should File.mtime return for a file in a jar? The modified time for the file or at a minimum the modified time for the jar? Here's an example.
The text was updated successfully, but these errors were encountered: