pollita         Wed Dec  3 00:30:17 2003 EDT

  Modified files:              
    /php-src/ext/standard       http_fopen_wrapper.c 
    /php-src    NEWS 
  Log:
  Add http proxy support via context option.
  
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.76 
php-src/ext/standard/http_fopen_wrapper.c:1.77
--- php-src/ext/standard/http_fopen_wrapper.c:1.76      Thu Aug 28 12:28:33 2003
+++ php-src/ext/standard/http_fopen_wrapper.c   Wed Dec  3 00:30:15 2003
@@ -18,7 +18,7 @@
    |          Wez Furlong <[EMAIL PROTECTED]>                          |
    +----------------------------------------------------------------------+
  */
-/* $Id: http_fopen_wrapper.c,v 1.76 2003/08/28 16:28:33 sas Exp $ */ 
+/* $Id: http_fopen_wrapper.c,v 1.77 2003/12/03 05:30:15 pollita Exp $ */ 
 
 #include "php.h"
 #include "php_globals.h"
@@ -134,7 +134,16 @@
        else if (resource->port == 0)
                resource->port = 80;
 
-       transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : 
"tcp", resource->host, resource->port);
+       if (context && !use_ssl &&
+               php_stream_context_get_option(context, "http", "proxy", &tmpzval) == 
SUCCESS &&
+               Z_TYPE_PP(tmpzval) == IS_STRING &&
+               Z_STRLEN_PP(tmpzval) > 0) {
+               /* Don't use proxy server for SSL resources */
+               transport_len = Z_STRLEN_PP(tmpzval);
+               transport_string = estrndup(Z_STRVAL_PP(tmpzval), 
Z_STRLEN_PP(tmpzval));
+       } else {
+               transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? 
"ssl" : "tcp", resource->host, resource->port);
+       }
 
        stream = php_stream_xport_create(transport_string, transport_len, options,
                        STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
Index: php-src/NEWS
diff -u php-src/NEWS:1.1516 php-src/NEWS:1.1517
--- php-src/NEWS:1.1516 Tue Dec  2 08:55:27 2003
+++ php-src/NEWS        Wed Dec  3 00:30:16 2003
@@ -8,6 +8,7 @@
 - Added possibility to prevent PHP from registering variables when
   input filter support is used. (Derick)
 - Added EXSLT support in ext/xsl. (Christian)
+- Added proxy support to http wrapper. (Sara)
 - Added new functions:
   . dba_key_split() to split inifile keys in an array. (Marcus)
   . time_nanosleep() signal safe sleep (Magnus, Ilia)

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

Reply via email to