From 5a692699b44d9e061f1b8623b6f9349f50326cdb Mon Sep 17 00:00:00 2001 From: westi Date: Fri, 8 Aug 2008 16:28:07 +0000 Subject: [PATCH] Ensure fsockopen HTTP requests have Content-length and Content-type headers. See #4779 props DD32. git-svn-id: http://svn.automattic.com/wordpress/trunk@8588 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/http.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/http.php b/wp-includes/http.php index 328b07474b..0dc5ca686c 100644 --- a/wp-includes/http.php +++ b/wp-includes/http.php @@ -445,6 +445,10 @@ class WP_Http_Fsockopen { $strHeaders = ''; $strHeaders .= strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n"; $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n"; + if ( ! is_null($body) ) { + $strHeaders .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n"; + $strHeaders .= 'Content-Length: ' . strlen($body) . "\r\n"; + } if ( is_array($headers) ) { foreach ( (array) $headers as $header => $headerValue )