Index: src/wp-includes/class-wp-http-streams.php
===================================================================
--- src/wp-includes/class-wp-http-streams.php	(revision 35749)
+++ src/wp-includes/class-wp-http-streams.php	(working copy)
@@ -203,6 +203,13 @@
 		if ( ! is_null($r['body']) )
 			$strHeaders .= $r['body'];
 
+		// Ensure the stream is ready to write to
+		$no_streams = array();
+		$write_streams = array( $handle );
+		if ( ! stream_select( $no_streams, $write_streams, $no_streams, 0, 50 ) ) {
+			return new WP_Error( 'http_request_failed', __( 'Could not open outbound stream' ) );
+		}
+
 		fwrite($handle, $strHeaders);
 
 		if ( ! $r['blocking'] ) {
