- fixing ridiculous default transfer timeout of 3 seconds (set to 0 now)
[m6w6/ext-http] / http_request_api.c
index 5bb5b6580ad203939f80d56d1a34fcdeb75987e9..63eb9831c59c8ac058339d73a87f8b536b08fc64 100644 (file)
@@ -208,7 +208,7 @@ PHP_HTTP_API STATUS _http_request_body_fill(http_request_body *body, HashTable *
                                err = curl_formadd(&http_post_data[0], &http_post_data[1],
                                        CURLFORM_COPYNAME,                      key,
                                        CURLFORM_COPYCONTENTS,          Z_STRVAL_PP(data),
-                                       CURLFORM_CONTENTSLENGTH,        Z_STRLEN_PP(data),
+                                       CURLFORM_CONTENTSLENGTH,        (long) Z_STRLEN_PP(data),
                                        CURLFORM_END
                                );
                                if (CURLE_OK != err) {
@@ -464,7 +464,7 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char
                        phpstr_fix(qstr);
                        HTTP_CURL_OPT(COOKIE, http_request_data_copy(COPY_STRING, qstr->data));
                }
-               phpstr_free(qstr);
+               phpstr_free(&qstr);
        } else {
                HTTP_CURL_OPT(COOKIE, NULL);
        }
@@ -492,7 +492,7 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char
        }
 
        /* resume */
-       if (zoption = http_curl_getopt(options, "resume", IS_LONG)) {
+       if ((zoption = http_curl_getopt(options, "resume", IS_LONG)) && (Z_LVAL_P(zoption) != 0)) {
                range_req = 1;
                HTTP_CURL_OPT(RESUME_FROM, Z_LVAL_P(zoption));
        } else {
@@ -514,11 +514,11 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char
                HTTP_CURL_OPT(TIMEVALUE, 0);
        }
 
-       /* timeout, defaults to 3 */
+       /* timeout, defaults to 0 */
        if (zoption = http_curl_getopt(options, "timeout", IS_LONG)) {
                HTTP_CURL_OPT(TIMEOUT, Z_LVAL_P(zoption));
        } else {
-               HTTP_CURL_OPT(TIMEOUT, 3);
+               HTTP_CURL_OPT(TIMEOUT, 0);
        }
 
        /* connecttimeout, defaults to 3 */