Ticket #11468 (closed defect (bug): fixed)

Opened 2 years ago

Last modified 2 years ago

Most HTTP transport methods in WP_Http process floats as integers for their respective timeout options.

Reported by: mdawaffe Owned by: dd32
Priority: normal Milestone: 2.9
Component: HTTP Version: 2.9
Severity: major Keywords: has-patch needs-testing
Cc:

Description

WP_Http_Curl
 http://us2.php.net/curl_setopt

Problem: CURLOPT_TIMEOUT, CURLOPT_CONNECTTIMEOUT.

Fix: Use CURLOPT_TIMEOUT_MS, CURLOPT_CONNECTTIMEOUT_MS instead when possible.

All stream based methods (WP_Http_Fsockopen, WP_Http_Fopen, WP_Http_Streams)
 http://us2.php.net/manual/en/function.stream-set-timeout.php

Problem: stream_set_timeout( $handle, $timeout );

Fix: use stream_set_timeout( $handle, $timeout, $utimeout );

fsockopen() does accept a (float) timeout argument, but WP_Http_Fsockopen also calls stream_set_timeout().

WP_Http_ExtHTTP
 http://us2.php.net/manual/en/http.request.options.php

Problem: timeout, connecttimeout.

Fix: None.

Attached patches all affected WP_Http transports to send timeouts as ceil()'d integers to their underlying PHP functions. ceil() is used to prevent sending a timeout of 0.

Setting as Severity:major since this prevents spawn_cron() (which sets a timeout of 0.01) from spawning anything if the WP_Http_ExtHTTP transport is used.

Setting as Milestone:2.9. Bump as needed.

Attachments

11468.diff Download (3.5 KB) - added by mdawaffe 2 years ago.

Change History

comment:1   dd322 years ago

Looks pretty sane to me..

  • Status changed from new to closed
  • Resolution set to fixed

(In [12425]) Properly handle float timeouts for all transports. Props mdawaffe. fixes #11468 for 2.9

comment:3   ryan2 years ago

[12424] for trunk.

Related: #11565

Note: See TracTickets for help on using tickets.