cvs: php4 /ext/standard http_fopen_wrapper.c

From: Date: Fri, 13 Jun 2003 19:27:26 +0000
Subject: cvs: php4 /ext/standard http_fopen_wrapper.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-21678@lists.php.net to get a copy of this message
pollita Fri Jun 13 15:27:26 2003 EDT Modified files: /php4/ext/standard http_fopen_wrapper.c Log: Loosen restrictions on method used with http_fopen_wrapper, still default to GET though. Index: php4/ext/standard/http_fopen_wrapper.c diff -u php4/ext/standard/http_fopen_wrapper.c:1.74 php4/ext/standard/http_fopen_wrapper.c:1.75 --- php4/ext/standard/http_fopen_wrapper.c:1.74 Tue Jun 10 16:03:37 2003 +++ php4/ext/standard/http_fopen_wrapper.c Fri Jun 13 15:27:26 2003 @@ -18,7 +18,7 @@ | Wez Furlong <wez@thebrainroom.com> | +----------------------------------------------------------------------+ */ -/* $Id: http_fopen_wrapper.c,v 1.74 2003/06/10 20:03:37 imajes Exp $ */ +/* $Id: http_fopen_wrapper.c,v 1.75 2003/06/13 19:27:26 pollita Exp $ */ #include "php.h" #include "php_globals.h" @@ -164,15 +164,19 @@ php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0); - scratch_len = strlen(path) + 32; - scratch = emalloc(scratch_len); - if (context && - php_stream_context_get_option(context, "http", "method", &tmpzval) == SUCCESS && - Z_STRLEN_PP(tmpzval) > 0 && - strncasecmp(Z_STRVAL_PP(tmpzval), "POST", Z_STRLEN_PP(tmpzval)) == 0) { - strcpy(scratch, "POST "); - } else { + php_stream_context_get_option(context, "http", "method", &tmpzval) == SUCCESS) { + if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0) { + scratch_len = strlen(path) + 29 + Z_STRLEN_PP(tmpzval); + scratch = emalloc(scratch_len); + strlcpy(scratch, Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval) + 1); + strcat(scratch, " "); + } + } + + if (!scratch) { + scratch_len = strlen(path) + 32; + scratch = emalloc(scratch_len); strcpy(scratch, "GET "); }

« previous php.cvs (#21678) next »