curl: CURLOPT_TLSAUTH_TYPE never accepted enum CURL_TLSAUTH :facepalm:
[m6w6/ext-http] / src / php_http_client_curl.c
index daadf698e5b15f8058f7cd4a590e253fe652e8ba..156c569ec1393b586a4fc76d8c61e2dfc3570122 100644 (file)
@@ -313,14 +313,14 @@ static int php_http_curle_raw_callback(CURL *ch, curl_infotype type, char *data,
        return 0;
 }
 
-static int php_http_curle_header_callback(char *data, size_t n, size_t l, void *arg)
+static size_t php_http_curle_header_callback(char *data, size_t n, size_t l, void *arg)
 {
        php_http_client_curl_handler_t *h = arg;
 
        return php_http_buffer_append(&h->response.headers, data, n * l);
 }
 
-static int php_http_curle_body_callback(char *data, size_t n, size_t l, void *arg)
+static size_t php_http_curle_body_callback(char *data, size_t n, size_t l, void *arg)
 {
        php_http_client_curl_handler_t *h = arg;
 
@@ -1202,8 +1202,10 @@ static ZEND_RESULT_CODE php_http_curle_option_set_ssl_tlsauthtype(php_http_optio
 
        if (val && Z_LVAL_P(val)) {
                switch (Z_LVAL_P(val)) {
+               case CURL_TLSAUTH_NONE:
+                       break;
                case CURL_TLSAUTH_SRP:
-                       if (CURLE_OK == curl_easy_setopt(ch, opt->option, PHP_HTTP_LIBCURL_TLSAUTH_SRP)) {
+                       if (CURLE_OK == curl_easy_setopt(ch, opt->option, "SRP")) {
                                return SUCCESS;
                        }
                        /* no break */
@@ -1211,7 +1213,7 @@ static ZEND_RESULT_CODE php_http_curle_option_set_ssl_tlsauthtype(php_http_optio
                        return FAILURE;
                }
        }
-       if (CURLE_OK != curl_easy_setopt(ch, opt->option, PHP_HTTP_LIBCURL_TLSAUTH_DEF)) {
+       if (CURLE_OK != curl_easy_setopt(ch, opt->option, "NONE")) {
                return FAILURE;
        }
        return SUCCESS;
@@ -1486,7 +1488,10 @@ static void php_http_curle_options_init(php_http_options_t *registry)
        }
 #endif
 #if PHP_HTTP_CURL_VERSION(7,49,0)
+# if defined(linux) || defined(__APPLE__)
+       /* CURLOPT_TCP_FASTOPEN is not supported (yet) on Windows */
        php_http_option_register(registry, ZEND_STRL("tcp_fastopen"), CURLOPT_TCP_FASTOPEN, _IS_BOOL);
+# endif
 #endif
 
        /* ssl */
@@ -2203,7 +2208,9 @@ static ZEND_RESULT_CODE php_http_client_curl_handler_prepare(php_http_client_cur
        curl_easy_setopt(curl->handle, CURLOPT_URL, storage->url);
 
        /* apply options */
-       php_http_options_apply(&php_http_curle_options, enqueue->options, curl);
+       if (SUCCESS != php_http_options_apply(&php_http_curle_options, enqueue->options, curl)) {
+               return FAILURE;
+       }
 
        /* request headers */
        php_http_message_update_headers(msg);