Mojo::UserAgent->get() will wait for inactivity_timeout to expire before completing a 304 response #369

dgholz opened this Issue Aug 9, 2012 · 2 comments

2 participants



Here's a little Mojo script which takes longer than I expect to compete:

use POSIX qw< strftime >;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
my $httpdate_now = strftime "%a, %d %b %Y %H:%M:%S GMT", gmtime;
say $ua->get(
  "" => {
    "If-Modified-Since" => $httpdate_now,

It successfully prints '304' (as expected), but takes over 20 seconds to complete. If I set $ua->inactivity_timeout(1), then the script completes much faster, in a little over a second.

I expect the request to complete in at most the time to make the same get request without the 'If-Modified-Since' header. How can I prevent Mojo::UserAgent from waiting for the inactivity_timeout to expire before completing a 304 response, when the value of the 'If-Modified-Since' header will prevent the response from containing any data in its body?


@kraih kraih closed this in 05a3735 Aug 10, 2012

Thanks, fixed.


Great fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment