From b010daa9c4e9693bb24437a79b4a06040636d9f6 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 2 Apr 2004 15:43:41 +0000 Subject: [PATCH] Support for domain cookies --- ext/soap/php_http.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 08068e3814..6072c3245a 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -171,6 +171,21 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, in return stream; } +static int in_domain(const char *host, const char *domain) +{ + if (domain[0] == '.') { + int l1 = strlen(host); + int l2 = strlen(domain); + if (l1 > l2) { + return strcmp(host+l1-l2,domain) == 0; + } else { + return 0; + } + } else { + return strcmp(host,domain) == 0; + } +} + int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *soapaction, int soap_version TSRMLS_DC) { xmlChar *buf, *request; @@ -440,7 +455,7 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *so if (zend_hash_index_find(Z_ARRVAL_PP(data), 1, (void**)&tmp) == SUCCESS && strncmp(phpurl->path,Z_STRVAL_PP(tmp),Z_STRLEN_PP(tmp)) == 0 && zend_hash_index_find(Z_ARRVAL_PP(data), 2, (void**)&tmp) == SUCCESS && - strcmp(phpurl->host,Z_STRVAL_PP(tmp)) == 0 && + in_domain(phpurl->host,Z_STRVAL_PP(tmp)) && (use_ssl || zend_hash_index_find(Z_ARRVAL_PP(data), 3, (void**)&tmp) == FAILURE)) { smart_str_appendl(&soap_headers, key, strlen(key)); smart_str_appendc(&soap_headers, '='); -- 2.40.0