summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-06-13 19:27:26 +0000
committerSara Golemon <pollita@php.net>2003-06-13 19:27:26 +0000
commit82ddb23338cf10659458bb16b5af579fe9ba537e (patch)
tree79869483b6346424cfc76b67435f4d65d21ef14a
parentd75d52a5718f5328ba9b1eed850b2a024d55a269 (diff)
downloadphp-git-82ddb23338cf10659458bb16b5af579fe9ba537e.tar.gz
Loosen restrictions on method used with http_fopen_wrapper, still default to GET though.
-rw-r--r--ext/standard/http_fopen_wrapper.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 394cc1271e..039f6db93c 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -164,15 +164,19 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
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 ");
}