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
This commit is contained in:
westi 2008-08-08 16:28:07 +00:00
parent 0f8d8597c3
commit 5a692699b4
1 changed files with 4 additions and 0 deletions

View File

@ -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 )