venaas Fri Jan 12 12:49:25 2001 EDT
Modified files:
/php4/ext/standard http_fopen_wrapper.c
Log:
Follows redirects again, and $http_response_header now contains all headers
with an empty string as delimiter
@- Made fopen() of HTTP URL follow redirects, $http_response_header will
@ contain all headers with empty string as delimiter (Stig Venaas)
Index: php4/ext/standard/http_fopen_wrapper.c
diff -u php4/ext/standard/http_fopen_wrapper.c:1.3
php4/ext/standard/http_fopen_wrapper.c:1.4
--- php4/ext/standard/http_fopen_wrapper.c:1.3 Fri Oct 27 18:31:56 2000
+++ php4/ext/standard/http_fopen_wrapper.c Fri Jan 12 12:49:25 2001
@@ -17,7 +17,7 @@
| Hartmut Holzgraefe <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: http_fopen_wrapper.c,v 1.3 2000/10/28 01:31:56 zeev Exp $ */
+/* $Id: http_fopen_wrapper.c,v 1.4 2001/01/12 20:49:25 venaas Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -263,26 +263,40 @@
}
}
}
- {
- ELS_FETCH();
- zend_hash_update(EG(active_symbol_table), "http_response_header",
sizeof("http_response_header"), (void **) &response_header, sizeof(zval *), NULL);
- }
if (!reqok) {
SOCK_FCLOSE(*socketd);
*socketd = 0;
free_url(resource);
-#if 0
if (location[0] != '\0') {
- return php_fopen_url_wrapper(location, mode, options, issock,
socketd, opened_path);
+ zval **response_header_new, *entry, **entryp;
+
+ fp = php_fopen_url_wrap_http(location, mode, options, issock,
+socketd, opened_path);
+ ELS_FETCH();
+ if (zend_hash_find(EG(active_symbol_table),
+"http_response_header", sizeof("http_response_header"), (void **)
+&response_header_new) == SUCCESS) {
+ entryp = &entry;
+ MAKE_STD_ZVAL(entry);
+ ZVAL_EMPTY_STRING(entry);
+
+zend_hash_next_index_insert(Z_ARRVAL_P(response_header), entryp, sizeof(zval *),
+NULL);
+
+zend_hash_internal_pointer_reset(Z_ARRVAL_PP(response_header_new));
+ while
+(zend_hash_get_current_data(Z_ARRVAL_PP(response_header_new), (void **)&entryp) ==
+SUCCESS) {
+ zval_add_ref(entryp);
+
+zend_hash_next_index_insert(Z_ARRVAL_P(response_header), entryp, sizeof(zval *),
+NULL);
+
+zend_hash_move_forward(Z_ARRVAL_PP(response_header_new));
+ }
+ }
+ goto out;
} else {
- return NULL;
+ fp = NULL;
+ goto out;
}
-#else
- return NULL;
-#endif
}
free_url(resource);
*issock = 1;
+ out:
+ {
+ ELS_FETCH();
+ ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header",
+response_header);
+ }
return (fp);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]