Added max_redirects context option that specifies how many HTTP redirects

to follow.
This commit is contained in:
Ilia Alshanetsky 2005-05-06 02:31:07 +00:00
parent b874c94d81
commit 3ae10919c4
2 changed files with 9 additions and 1 deletions

2
NEWS
View File

@ -101,6 +101,8 @@ PHP NEWS
- Added zlib stream filter support. (Sara)
- Added bz2 stream filter support. (Sara)
- Added HTTP/1.1 and chunked encoding support to http:// wrapper. (Sara)
- Added max_redirects context option that specifies how many HTTP
redirects to follow. (Ilia)
- Added support of parameter=>value arrays to
xsl_xsltprocessor_set_parameter(). (Tony)
- Fixed extension initialization to respect dependancies between extensions.

View File

@ -104,7 +104,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
int protocol_version_len = 3; /* Default: "1.0" */
if (redirect_max < 1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Circular redirect, aborting.");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Redirection limit reached, aborting.");
return NULL;
}
@ -182,6 +182,12 @@ 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);
if (header_init && context && php_stream_context_get_option(context, "http", "max_redirects", &tmpzval) == SUCCESS) {
SEPARATE_ZVAL(tmpzval);
convert_to_long_ex(tmpzval);
redirect_max = Z_LVAL_PP(tmpzval);
}
if (context &&
php_stream_context_get_option(context, "http", "method", &tmpzval) == SUCCESS) {
if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0) {