move (re)setting of request methods to http_request_defaults()
authorMichael Wallner <mike@php.net>
Thu, 19 Jan 2006 10:34:04 +0000 (10:34 +0000)
committerMichael Wallner <mike@php.net>
Thu, 19 Jan 2006 10:34:04 +0000 (10:34 +0000)
http_request_api.c

index 1da4e332b9ff4063b160c4bff23aa9d16d8d39a8..9818721a1efd0921a65baf260b4285bef6d33a76 100644 (file)
@@ -392,6 +392,10 @@ PHP_HTTP_API void _http_request_defaults(http_request *request)
                HTTP_CURL_OPT(INFILESIZE, 0);
                HTTP_CURL_OPT(HTTP_VERSION, CURL_HTTP_VERSION_NONE);
                HTTP_CURL_OPT(CUSTOMREQUEST, NULL);
+               HTTP_CURL_OPT(NOBODY, 0);
+               HTTP_CURL_OPT(POST, 0);
+               HTTP_CURL_OPT(UPLOAD, 0);
+               HTTP_CURL_OPT(HTTPGET, 1);
        }
 }
 /* }}} */
@@ -643,42 +647,22 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti
        switch (request->meth)
        {
                case HTTP_GET:
-                       HTTP_CURL_OPT(CUSTOMREQUEST, NULL);
-                       HTTP_CURL_OPT(NOBODY, 0);
-                       HTTP_CURL_OPT(POST, 0);
-                       HTTP_CURL_OPT(UPLOAD, 0);
                        HTTP_CURL_OPT(HTTPGET, 1);
                break;
 
                case HTTP_HEAD:
-                       HTTP_CURL_OPT(CUSTOMREQUEST, NULL);
-                       HTTP_CURL_OPT(POST, 0);
-                       HTTP_CURL_OPT(UPLOAD, 0);
-                       HTTP_CURL_OPT(HTTPGET, 0);
                        HTTP_CURL_OPT(NOBODY, 1);
                break;
 
                case HTTP_POST:
-                       HTTP_CURL_OPT(CUSTOMREQUEST, NULL);
-                       HTTP_CURL_OPT(UPLOAD, 0);
-                       HTTP_CURL_OPT(HTTPGET, 0);
-                       HTTP_CURL_OPT(NOBODY, 0);
                        HTTP_CURL_OPT(POST, 1);
                break;
 
                case HTTP_PUT:
-                       HTTP_CURL_OPT(CUSTOMREQUEST, NULL);
-                       HTTP_CURL_OPT(HTTPGET, 0);
-                       HTTP_CURL_OPT(NOBODY, 0);
-                       HTTP_CURL_OPT(POST, 0);
                        HTTP_CURL_OPT(UPLOAD, 1);
                break;
 
                default:
-                       HTTP_CURL_OPT(HTTPGET, 0);
-                       HTTP_CURL_OPT(NOBODY, 0);
-                       HTTP_CURL_OPT(POST, 0);
-                       HTTP_CURL_OPT(UPLOAD, 0);
                        if (http_request_method_exists(0, request->meth, NULL)) {
                                HTTP_CURL_OPT(CUSTOMREQUEST, http_request_method_name(request->meth));
                        } else {