]> granicus.if.org Git - php/commitdiff
Added new SoapClient option "keep_alive". FR #60329
authorPierrick Charron <pierrick@php.net>
Fri, 18 Nov 2011 13:24:35 +0000 (13:24 +0000)
committerPierrick Charron <pierrick@php.net>
Fri, 18 Nov 2011 13:24:35 +0000 (13:24 +0000)
ext/soap/php_http.c
ext/soap/soap.c

index 1ca0a1610b563b54c5a6c23e539c229a8599c4ea..e79c5379924ddb142059330c486ce1a84605ea57 100644 (file)
@@ -433,12 +433,14 @@ try_again:
                        smart_str_appendc(&soap_headers, ':');
                        smart_str_append_unsigned(&soap_headers, phpurl->port);
                }
-               if (http_1_1) {
+               if (!http_1_1 ||
+                       (zend_hash_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive"), (void **)&tmp) == SUCCESS &&
+                        Z_LVAL_PP(tmp) == 0)) {
                        smart_str_append_const(&soap_headers, "\r\n"
-                               "Connection: Keep-Alive\r\n");
+                               "Connection: close\r\n");
                } else {
                        smart_str_append_const(&soap_headers, "\r\n"
-                               "Connection: close\r\n");
+                               "Connection: Keep-Alive\r\n");
                }
                if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent"), (void **)&tmp) == SUCCESS &&
                    Z_TYPE_PP(tmp) == IS_STRING) {
index aa6cf65e09a9c5314330a20f04ab709dc8ce1ab9..f9adb3fb2fdb800ca051644da887e2e7538456c1 100644 (file)
@@ -2469,6 +2469,11 @@ PHP_METHOD(SoapClient, SoapClient)
                    Z_TYPE_PP(tmp) == IS_STRING) {
                        add_property_stringl(this_ptr, "_user_agent", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
                }
+               
+               if (zend_hash_find(ht, "keep_alive", sizeof("keep_alive"), (void**)&tmp) == SUCCESS &&
+                               (Z_TYPE_PP(tmp) == IS_BOOL || Z_TYPE_PP(tmp) == IS_LONG) && Z_LVAL_PP(tmp) == 0) {
+                       add_property_long(this_ptr, "_keep_alive", 0);
+               }
        } else if (Z_TYPE_P(wsdl) == IS_NULL) {
                php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri' options are required in nonWSDL mode");
        }