summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2005-02-02 10:34:39 +0000
committerDmitry Stogov <dmitry@php.net>2005-02-02 10:34:39 +0000
commit3c3141007441ff8ffbce96ebc8f899400b4e69ab (patch)
tree0696a51bf7f62fa876314afe3b084d1c5667b947
parentd38eed95ea357356aba8d540a4f7c064b34f82e5 (diff)
downloadphp-git-3c3141007441ff8ffbce96ebc8f899400b4e69ab.tar.gz
Fixed bug #31747 (SOAP Digest Authentication doesn't work with "HTTP/1.1 100 Continue" response)
-rw-r--r--ext/soap/php_http.c71
-rw-r--r--ext/soap/php_soap.h3
-rw-r--r--ext/soap/soap.c8
3 files changed, 43 insertions, 39 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 57983a0529..2eca34c349 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -654,53 +654,46 @@ try_again:
}
- if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
- efree(http_headers);
- if (request != buf) {efree(request);}
- php_stream_close(stream);
- zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
- zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy"));
- add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
- return FALSE;
- }
+ do {
+ if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
+ efree(http_headers);
+ if (request != buf) {efree(request);}
+ php_stream_close(stream);
+ zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
+ zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy"));
+ add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
+ return FALSE;
+ }
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
- Z_LVAL_PP(trace) > 0) {
- add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size, 1);
- }
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
+ Z_LVAL_PP(trace) > 0) {
+ add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size, 1);
+ }
- /* Check to see what HTTP status was sent */
- http_1_1 = 0;
- http_status = 0;
- http_version = get_http_header_value(http_headers,"HTTP/");
- if (http_version) {
- char *tmp;
+ /* Check to see what HTTP status was sent */
+ http_1_1 = 0;
+ http_status = 0;
+ http_version = get_http_header_value(http_headers,"HTTP/");
+ if (http_version) {
+ char *tmp;
- if (strncmp(http_version,"1.1", 3)) {
- http_1_1 = 1;
- }
+ if (strncmp(http_version,"1.1", 3)) {
+ http_1_1 = 1;
+ }
- tmp = strstr(http_version," ");
- if (tmp != NULL) {
- tmp++;
- http_status = atoi(tmp);
- }
- efree(http_version);
+ tmp = strstr(http_version," ");
+ if (tmp != NULL) {
+ tmp++;
+ http_status = atoi(tmp);
+ }
+ efree(http_version);
- /* Try and get headers again */
- if (http_status == 100) {
- efree(http_headers);
- if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
+ /* Try and get headers again */
+ if (http_status == 100) {
efree(http_headers);
- if (request != buf) {efree(request);}
- php_stream_close(stream);
- zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
- zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy"));
- add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
- return FALSE;
}
}
- }
+ } while (http_status == 100);
/* Grab and send back every cookie */
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
index 59f1a3d8fc..2d43901002 100644
--- a/ext/soap/php_soap.h
+++ b/ext/soap/php_soap.h
@@ -146,6 +146,9 @@ struct _soapService {
#define SOAP_COMPRESSION_GZIP 0x00
#define SOAP_COMPRESSION_DEFLATE 0x10
+#define SOAP_AUTHENTICATION_BASIC 0
+#define SOAP_AUTHENTICATION_DIGEST 1
+
ZEND_BEGIN_MODULE_GLOBALS(soap)
HashTable defEncNs; /* mapping of default namespaces to prefixes */
HashTable defEnc;
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index b76773d449..db4d4efcb8 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -537,6 +537,9 @@ PHP_MINIT_FUNCTION(soap)
REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_GZIP", SOAP_COMPRESSION_GZIP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_DEFLATE", SOAP_COMPRESSION_DEFLATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_AUTHENTICATION_BASIC", SOAP_AUTHENTICATION_BASIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_AUTHENTICATION_DIGEST", SOAP_AUTHENTICATION_DIGEST, CONST_CS | CONST_PERSISTENT);
+
REGISTER_LONG_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT);
@@ -2014,6 +2017,11 @@ PHP_METHOD(SoapClient, SoapClient)
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "_password", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
}
+ if (zend_hash_find(ht, "authentication", sizeof("authentication"), (void**)&tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_LONG &&
+ Z_LVAL_PP(tmp) == SOAP_AUTHENTICATION_DIGEST) {
+ add_property_null(this_ptr, "_digest");
+ }
}
if (zend_hash_find(ht, "proxy_host", sizeof("proxy_host"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {