unfold url tests
[m6w6/ext-http] / php_http_client_curl.c
index 3b96cf4dfab60410234046f926b8dcb3efac3711..418a4c666504ddabd2fca3b21a3638795118a3e9 100644 (file)
@@ -6,7 +6,7 @@
     | modification, are permitted provided that the conditions mentioned |
     | in the accompanying LICENSE file are met.                          |
     +--------------------------------------------------------------------+
-    | Copyright (c) 2004-2013, Michael Wallner <mike@php.net>            |
+    | Copyright (c) 2004-2014, Michael Wallner <mike@php.net>            |
     +--------------------------------------------------------------------+
 */
 
@@ -258,6 +258,8 @@ static int php_http_curle_raw_callback(CURL *ch, curl_infotype type, char *data,
                                h->progress.info = "blacklist check";
                        } else if (php_memnstr(data, ZEND_STRL("SSL"), data + length)) {
                                h->progress.info = "ssl negotiation";
+                       } else if (php_memnstr(data, ZEND_STRL("upload"), data + length)) {
+                               h->progress.info = "uploaded";
                        } else if (php_memnstr(data, ZEND_STRL("left intact"), data + length)) {
                                h->progress.info = "not disconnected";
                        } else if (php_memnstr(data, ZEND_STRL("closed"), data + length)) {
@@ -269,6 +271,7 @@ static int php_http_curle_raw_callback(CURL *ch, curl_infotype type, char *data,
                        } else {
 #if PHP_DEBUG
                                h->progress.info = data;
+                               data[length - 1] = '\0';
 #endif
                        }
                        if (h->client->callback.progress.func) {
@@ -1492,8 +1495,8 @@ static STATUS php_http_client_curl_handler_prepare(php_http_client_curl_handler_
                        }
                }
                php_http_buffer_dtor(&header);
-               curl_easy_setopt(curl->handle, CURLOPT_HTTPHEADER, curl->options.headers);
        }
+       curl_easy_setopt(curl->handle, CURLOPT_HTTPHEADER, curl->options.headers);
 
        /* attach request body */
        if ((body_size = php_http_message_body_size(msg->body))) {
@@ -1807,7 +1810,7 @@ static STATUS php_http_client_curl_exec(php_http_client_t *h)
                                /* see http://msdn.microsoft.com/library/en-us/winsock/winsock/windows_sockets_error_codes_2.asp */
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "WinSock error: %d", WSAGetLastError());
 #else
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, strerror(errno));
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
 #endif
                                return FAILURE;
                        }