Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -59,14 +59,19 @@ |
60 | 60 | } |
61 | 61 | curl_close( $c ); |
62 | 62 | } else { |
63 | | - # Otherwise use file_get_contents, or its compatibility function from GlobalFunctions.php |
| 63 | + # Otherwise use file_get_contents... |
64 | 64 | # This may take 3 minutes to time out, and doesn't have local fetch capabilities |
65 | 65 | |
66 | | - $opts = array('http' => array( 'method' => $method ) ); |
| 66 | + global $wgVersion; |
| 67 | + $headers = array( "User-Agent: MediaWiki/$wgVersion" ); |
67 | 68 | if( strcasecmp( $method, 'post' ) == 0 ) { |
68 | 69 | // Required for HTTP 1.0 POSTs |
69 | | - $opts['http']['header'] = "Content-Length: 0"; |
| 70 | + $headers[] = "Content-Length: 0"; |
70 | 71 | } |
| 72 | + $opts = array( |
| 73 | + 'http' => array( |
| 74 | + 'method' => $method, |
| 75 | + 'header' => implode( "\r\n", $headers ) ) ); |
71 | 76 | $ctx = stream_context_create($opts); |
72 | 77 | |
73 | 78 | $url_fopen = ini_set( 'allow_url_fopen', 1 ); |