Make WordPress Core

Ticket #4779: 4779.fsockopen.post.content-headers.diff

File 4779.fsockopen.post.content-headers.diff, 693 bytes (added by DD32, 16 years ago)

Fixes POST requests to add the Content-length and Content-type headers with FSockOpen

  • wp-includes/http.php

     
    445445                $strHeaders = '';
    446446                $strHeaders .= strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
    447447                $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n";
     448                if ( ! is_null($body) ) {
     449                        $strHeaders .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n";
     450                        $strHeaders .= 'Content-Length: ' . strlen($body) . "\r\n";
     451                }
    448452
    449453                if ( is_array($headers) ) {
    450454                        foreach ( (array) $headers as $header => $headerValue )