dmitry          Fri Apr  2 10:43:41 2004 EDT

  Modified files:              
    /php-src/ext/soap   php_http.c 
  Log:
  Support for domain cookies
  
  
http://cvs.php.net/diff.php/php-src/ext/soap/php_http.c?r1=1.48&r2=1.49&ty=u
Index: php-src/ext/soap/php_http.c
diff -u php-src/ext/soap/php_http.c:1.48 php-src/ext/soap/php_http.c:1.49
--- php-src/ext/soap/php_http.c:1.48    Fri Apr  2 06:12:43 2004
+++ php-src/ext/soap/php_http.c Fri Apr  2 10:43:41 2004
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_http.c,v 1.48 2004/04/02 11:12:43 dmitry Exp $ */
+/* $Id: php_http.c,v 1.49 2004/04/02 15:43:41 dmitry Exp $ */
 
 #include "php_soap.h"
 #include "ext/standard/base64.h"
@@ -171,6 +171,21 @@
        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 @@
                                                  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, '=');

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to