Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#11468 closed defect (bug) (fixed)

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

Reported by: mdawaffe's profile mdawaffe Owned by: dd32's profile dd32
Milestone: 2.9 Priority: normal
Severity: major Version: 2.9
Component: HTTP API Keywords: has-patch needs-testing
Focuses: 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 (1)

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

Download all attachments as: .zip

Change History (5)

@mdawaffe
15 years ago

#1 @dd32
15 years ago

Looks pretty sane to me..

#2 @automattor
15 years ago

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

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

#3 @ryan
15 years ago

[12424] for trunk.

#4 @hakre
15 years ago

Related: #11565

Note: See TracTickets for help on using tickets.