libwww-perl / WWW-Mechanize

Handy web browsing in a Perl object
https://metacpan.org/pod/WWW::Mechanize
Other
68 stars 53 forks source link

ensure /quit_server calls for full HTTP/1.1 keepalive compatibility #221

Closed spazm closed 2 years ago

spazm commented 7 years ago

creaktive@gmail.com reported on Mar 16, 2013

(also issued at https://github.com/libwww-perl/WWW-Mechanize/pull/14)

The t/local/encoding.t & t/local/referer.t tests are potentially deadlockable:

PERL5OPT=-MLWP::Protocol::Net::Curl=http_version,2 prove -lv t/local/encoding.t t/local/referer.t

Here, the testing server waits for the client to close connection, and vice-versa. The client could be forced to use a non-keepalive connection, which solves the deadlock:

PERL5OPT=-MLWP::Protocol::Net::Curl=http_version,1 prove -lv t/local/encoding.t t/local/referer.t

Both tests could also include an explicit undef $agent. The attached code uses the already-available /quit_server URI to do the things in a safest way.

Details

Imported from Google Code issue 244 via archive