Merge "Add language Doteli (dty)"
[lhc/web/wiklou.git] / includes / libs / MultiHttpClient.php
index 8d9e810..f5d5229 100644 (file)
@@ -58,11 +58,12 @@ class MultiHttpClient {
 
        /**
         * @param array $options
-        *   - connTimeout     : default connection timeout
-        *   - reqTimeout      : default request timeout
+        *   - connTimeout     : default connection timeout (seconds)
+        *   - reqTimeout      : default request timeout (seconds)
         *   - proxy           : HTTP proxy to use
         *   - usePipelining   : whether to use HTTP pipelining if possible (for all hosts)
         *   - maxConnsPerHost : maximum number of concurrent connections (per host)
+        * @throws Exception
         */
        public function __construct( array $options ) {
                if ( isset( $options['caBundlePath'] ) ) {
@@ -83,19 +84,19 @@ class MultiHttpClient {
         * Execute an HTTP(S) request
         *
         * This method returns a response map of:
-        *   - code    : HTTP response code or 0 if there was a serious cURL error
-        *   - reason  : HTTP response reason (empty if there was a serious cURL error)
-        *   - headers : <header name/value associative array>
-        *   - body    : HTTP response body or resource (if "stream" was set)
+        *   - code    : HTTP response code or 0 if there was a serious cURL error
+        *   - reason  : HTTP response reason (empty if there was a serious cURL error)
+        *   - headers : <header name/value associative array>
+        *   - body    : HTTP response body or resource (if "stream" was set)
         *   - error     : Any cURL error string
-        * The map also stores integer-indexed copies of these values. This lets callers do:
-        *      <code>
+        * The map also stores integer-indexed copies of these values. This lets callers do:
+        * @code
         *              list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $http->run( $req );
-        *  </code>
+        * @endcode
         * @param array $req HTTP request array
         * @param array $opts
-        *   - connTimeout    : connection timeout per request
-        *   - reqTimeout     : post-connection timeout per request
+        *   - connTimeout    : connection timeout per request (seconds)
+        *   - reqTimeout     : post-connection timeout per request (seconds)
         * @return array Response array for request
         */
        final public function run( array $req, array $opts = array() ) {
@@ -107,26 +108,27 @@ class MultiHttpClient {
         * Execute a set of HTTP(S) requests concurrently
         *
         * The maps are returned by this method with the 'response' field set to a map of:
-        *   - code    : HTTP response code or 0 if there was a serious cURL error
-        *   - reason  : HTTP response reason (empty if there was a serious cURL error)
-        *   - headers : <header name/value associative array>
-        *   - body    : HTTP response body or resource (if "stream" was set)
+        *   - code    : HTTP response code or 0 if there was a serious cURL error
+        *   - reason  : HTTP response reason (empty if there was a serious cURL error)
+        *   - headers : <header name/value associative array>
+        *   - body    : HTTP response body or resource (if "stream" was set)
         *   - error   : Any cURL error string
-        * The map also stores integer-indexed copies of these values. This lets callers do:
-        *      <code>
-        *              list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $req['response'];
-        *  </code>
+        * The map also stores integer-indexed copies of these values. This lets callers do:
+        * @code
+        *        list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $req['response'];
+        * @endcode
         * All headers in the 'headers' field are normalized to use lower case names.
         * This is true for the request headers and the response headers. Integer-indexed
         * method/URL entries will also be changed to use the corresponding string keys.
         *
         * @param array $reqs Map of HTTP request arrays
         * @param array $opts
-        *   - connTimeout     : connection timeout per request
-        *   - reqTimeout      : post-connection timeout per request
+        *   - connTimeout     : connection timeout per request (seconds)
+        *   - reqTimeout      : post-connection timeout per request (seconds)
         *   - usePipelining   : whether to use HTTP pipelining if possible
         *   - maxConnsPerHost : maximum number of concurrent connections (per host)
         * @return array $reqs With response array populated for each
+        * @throws Exception
         */
        public function runMulti( array $reqs, array $opts = array() ) {
                $chm = $this->getCurlMulti();
@@ -248,6 +250,7 @@ class MultiHttpClient {
         *   - connTimeout    : default connection timeout
         *   - reqTimeout     : default request timeout
         * @return resource
+        * @throws Exception
         */
        protected function getCurlHandle( array &$req, array $opts = array() ) {
                $ch = curl_init();