From ab7470b6e878556d539e7bd407c5310a98761eb0 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 30 Jul 2009 22:11:44 +0000 Subject: [PATCH] Allow passing postdata in Http::post() options... Note -- CURL allows you to pass an array which it will encode as multipart, but this doesn't seem to work for me. Until resolved, do URL form encoding yourself with wfArrayToCGI() and pass in a string. Todo: implement also for non-CURL mode if possible? --- includes/HttpFunctions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index e4b73f9a82..338f1e0676 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -287,6 +287,7 @@ class HttpRequest { $this->upload_session_key = ( isset( $opt['upload_session_key'] ) ) ? $opt['upload_session_key'] : false; $this->headers_only = ( isset( $opt['headers_only'] ) ) ? $opt['headers_only'] : false; $this->do_close_session_update = isset( $opt['do_close_session_update'] ); + $this->postData = isset( $opt['postdata'] ) ? $opt['postdata'] : ''; } /** @@ -331,7 +332,7 @@ class HttpRequest { curl_setopt( $c, CURLOPT_HEADER, true ); } elseif ( $this->method == 'POST' ) { curl_setopt( $c, CURLOPT_POST, true ); - curl_setopt( $c, CURLOPT_POSTFIELDS, '' ); + curl_setopt( $c, CURLOPT_POSTFIELDS, $this->postData ); } else { curl_setopt( $c, CURLOPT_CUSTOMREQUEST, $this->method ); } -- 2.20.1