summaryrefslogtreecommitdiff
path: root/ext/soap/php_http.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2004-04-02 15:43:41 +0000
committerDmitry Stogov <dmitry@php.net>2004-04-02 15:43:41 +0000
commitb010daa9c4e9693bb24437a79b4a06040636d9f6 (patch)
treec9b30f0e7d388ea825d0431547c009a33a935a47 /ext/soap/php_http.c
parent794358f3852c0819ae906e1f190d4d001bf71df4 (diff)
downloadphp-git-b010daa9c4e9693bb24437a79b4a06040636d9f6.tar.gz
Support for domain cookies
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r--ext/soap/php_http.c17
1 files changed, 16 insertions, 1 deletions
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, '=');