Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40708 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93151 invoked from network); 26 Sep 2008 14:22:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2008 14:22:11 -0000 Authentication-Results: pb1.pair.com header.from=list@firehawksystems.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=list@firehawksystems.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain firehawksystems.com from 204.11.219.140 cause and error) X-PHP-List-Original-Sender: list@firehawksystems.com X-Host-Fingerprint: 204.11.219.140 ls6.firehawksystems.com Received: from [204.11.219.140] ([204.11.219.140:65067] helo=ls6.firehawksystems.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/D5-63390-110FCD84 for ; Fri, 26 Sep 2008 10:22:11 -0400 Received: from albook-wireless.brianfrance.com (adsl-69-212-242-15.dsl.ipltin.ameritech.net [69.212.242.15]) (authenticated bits=0) by ls6.firehawksystems.com (8.14.1/8.14.1) with ESMTP id m8QEM40P015906 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 26 Sep 2008 07:22:06 -0700 (PDT) Cc: Dmitry Stogov Message-ID: To: internals@lists.php.net In-Reply-To: <1890A80D-FE2B-413C-9B41-C56FB17B865D@firehawksystems.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Fri, 26 Sep 2008 10:22:03 -0400 References: <1890A80D-FE2B-413C-9B41-C56FB17B865D@firehawksystems.com> X-Mailer: Apple Mail (2.929.2) X-Virus-Scanned: ClamAV version 0.93, clamav-milter version 0.93 on ls6.firehawksystems.com X-Virus-Status: Clean Subject: Re: [PHP-DEV] ext/soap and http header From: list@firehawksystems.com ("Brian J. France") After some more testing I needed to tweak the patch and the example, here is version 2. $opts = array('http' => array('header' => 'X-foo: bar')); $ctx = stream_context_create($opts); Brian --- ext/soap/php_http.c.orig 2008-09-26 05:39:50.000000000 -0700 +++ ext/soap/php_http.c 2008-09-26 06:42:34.000000000 -0700 -391,7 +391,8 @@ PG(allow_url_fopen) = old_allow_url_fopen; if (stream) { - zval **cookies, **login, **password; + php_stream_context *context = NULL; + zval **cookies, **login, **password, **tmpzval = NULL; int ret = zend_list_insert(phpurl, le_url); add_property_resource(this_ptr, "httpurl", ret); -638,6 +639,19 @@ proxy_authentication(this_ptr, &soap_headers TSRMLS_CC); } + /* get context to check for http headers */ + if (SUCCESS == zend_hash_find(Z_OBJPROP_P(this_ptr), + "_stream_context", sizeof("_stream_context"), (void**)&tmp)) { + context = php_stream_context_from_zval(*tmp, 0); + } + + /* Send http headers from context */ + if (context && + php_stream_context_get_option(context, "http", "header", &tmpzval) == SUCCESS && + Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { + smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval)); + } + /* Send cookies along with request */ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS) { zval **data;