From 4bff225e94e0c8fe931d6ceed7128d3e797cfabc Mon Sep 17 00:00:00 2001 From: Peter Westwood 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: https://develop.svn.wordpress.org/trunk@8588 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 )