Hi I've changed http_fopen_wrapper.c (not in CVS yet) so that it follows redirects, just like fopen() did before 4.0.3, which I think is good. I've also changed $http_response_header so that all headers will be present. For instance if I do fopen("http://yahoo.com/", "r") the contents will be: array(7) { [0]=> string(15) "HTTP/1.0 302 RD" [1]=> string(31) "Location: http://www.yahoo.com/" [2]=> string(0) "" [3]=> string(0) "" [4]=> string(15) "HTTP/1.0 200 OK" [5]=> string(21) "Content-Length: 15315" [6]=> string(23) "Content-Type: text/html" } I chose two empty strings as delimiter since that will never be present in a header. Does this look okay? Below is the patch, could someone more experienced have a quick look? In particular I'm wondering how/where I should call ELS_FETCH() and the refcounting. Is this correct, and is there a better way? I'm commiting this to CVS unless I get any objections. Stig --- /src/cvs/php4/ext/standard/http_fopen_wrapper.c Sat Oct 28 20:10:02 2000 +++ http_fopen_wrapper.c Thu Jan 11 01:20:10 2001 @@ -78,7 +78,7 @@ unsigned char *tmp; int len; int reqok = 0; - zval *response_header; + zval *response_header, **response_header_new; char *http_header_line; int http_header_line_length, http_header_line_size; @@ -263,26 +263,44 @@ } } } - { - 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); + 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) { + zval *entry, **entryp; + + entryp = &entry; + MAKE_STD_ZVAL(entry); + ZVAL_EMPTY_STRING(entry); + zval_add_ref(entryp); + +zend_hash_next_index_insert(Z_ARRVAL_P(response_header), entryp, sizeof(zval *), +NULL); + +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 Development 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]