[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/standard http_fopen_wrapper.c

2009-05-16 Thread Arnaud Le Blanc
lbarnaudSat May 16 20:34:49 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   http_fopen_wrapper.c 
/php-srcNEWS 
  Log:
  Fixed bug #38802 (max_redirects and ignore_errors)
  (patch by datib...@php.net)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.99.2.12.2.9.2.16r2=1.99.2.12.2.9.2.17diff_format=u
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.16 
php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.17
--- php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.16Thu May 
14 13:36:56 2009
+++ php-src/ext/standard/http_fopen_wrapper.c   Sat May 16 20:34:48 2009
@@ -19,7 +19,7 @@
|  Sara Golemon poll...@php.net  |
+--+
  */
-/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.9.2.16 2009/05/14 13:36:56 cellog 
Exp $ */ 
+/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.9.2.17 2009/05/16 20:34:48 lbarnaud 
Exp $ */ 
 
 #include php.h
 #include php_globals.h
@@ -104,7 +104,7 @@
size_t chunk_size = 0, file_size = 0;
int eol_detect = 0;
char *transport_string, *errstr = NULL;
-   int transport_len, have_header = 0, request_fulluri = 0;
+   int transport_len, have_header = 0, request_fulluri = 0, ignore_errors 
= 0;
char *protocol_version = NULL;
int protocol_version_len = 3; /* Default: 1.0 */
struct timeval timeout;
@@ -557,9 +557,11 @@
} else {
response_code = 0;
}
+   if (context  
SUCCESS==php_stream_context_get_option(context, http, ignore_errors, 
tmpzval)) {
+   ignore_errors = zend_is_true(*tmpzval);
+   }
/* when we request only the header, don't fail even on 
error codes */
-   if ((options  STREAM_ONLY_GET_HEADERS) ||
-   (context  
php_stream_context_get_option(context, http, ignore_errors,  tmpzval) == 
SUCCESS  zend_is_true(*tmpzval)) ) {
+   if ((options  STREAM_ONLY_GET_HEADERS) || 
ignore_errors) {
reqok = 1;
}
/* all status codes in the 2xx range are defined by the 
specification as successful;
@@ -656,7 +658,7 @@
}

if (!reqok || location[0] != '\0') {
-   if (options  STREAM_ONLY_GET_HEADERS  redirect_max = 1) {
+   if (((options  STREAM_ONLY_GET_HEADERS) || ignore_errors)  
redirect_max = 1) {
goto out;
}
 
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.604r2=1.2027.2.547.2.965.2.605diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.604 
php-src/NEWS:1.2027.2.547.2.965.2.605
--- php-src/NEWS:1.2027.2.547.2.965.2.604   Thu May 14 22:03:35 2009
+++ php-src/NEWSSat May 16 20:34:48 2009
@@ -14,6 +14,8 @@
   --enable-zend-multibyte is used). (Jani)
 - Fixed bug #48188 (Cannot execute a scrollable cursors twice with
   PDO_PGSQL). (Matteo)
+- Fixed bug #38802 (max_redirects and ignore_errors).
+  (patch by datib...@php.net)
 
 
 07 May 2009, PHP 5.3.0 RC 2



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/standard http_fopen_wrapper.c

2008-07-28 Thread Arnaud Le Blanc
lbarnaudMon Jul 28 19:08:02 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   http_fopen_wrapper.c 
/php-srcNEWS 
  Log:
  MFH: When automatically redirecting an HTTP request, use the GET method when 
the
  original method was not HEAD or GET (fixes #45540)
  #
  # The RFC says that in case of 3xx code, The action required MAY be 
  # carried out [...] *only if the method used in the second request is GET or 
  # HEAD*.
  #
  # This may not break anything as actually POST requests replying 
  # with a Location header never worked as the redirecting request was sent 
using
  # the POST method, but without Entity-Body (and without Content-Length 
header, 
  # which caused the server to reply with a 411 Length Required or to treat 
  # the request as GET).
  #
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.99.2.12.2.9.2.9r2=1.99.2.12.2.9.2.10diff_format=u
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.9 
php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.10
--- php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.9 Fri Jul 25 
08:27:37 2008
+++ php-src/ext/standard/http_fopen_wrapper.c   Mon Jul 28 19:08:02 2008
@@ -19,7 +19,7 @@
|  Sara Golemon [EMAIL PROTECTED]  |
+--+
  */
-/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.9.2.9 2008/07/25 08:27:37 mike Exp 
$ */ 
+/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.9.2.10 2008/07/28 19:08:02 lbarnaud 
Exp $ */ 
 
 #include php.h
 #include php_globals.h
@@ -252,10 +252,17 @@
 
if (context  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,  );
+   /* As per the RFC, automatically redirected requests 
MUST NOT use other methods than
+* GET and HEAD unless it can be confirmed by the user 
*/
+   if (redirect_max == PHP_URL_REDIRECT_MAX
+   || (Z_STRLEN_PP(tmpzval) == 3  memcmp(GET, 
Z_STRVAL_PP(tmpzval), 3) == 0)
+   || (Z_STRLEN_PP(tmpzval) == 4  
memcmp(HEAD,Z_STRVAL_PP(tmpzval), 4) == 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,  );
+   }
}
}
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.229r2=1.2027.2.547.2.965.2.230diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.229 
php-src/NEWS:1.2027.2.547.2.965.2.230
--- php-src/NEWS:1.2027.2.547.2.965.2.229   Mon Jul 28 11:54:37 2008
+++ php-src/NEWSMon Jul 28 19:08:02 2008
@@ -253,6 +253,7 @@
   prop of wrapped object). (robin_fernandes at uk dot ibm dot com, Arnaud)
 - Fixed bug #45571 (ReflectionClass::export() shows superclasses' private
   static methods). (robin_fernandes at uk dot ibm dot com)
+- Fixed bug #45540 (stream_context_create creates bad http request). (Arnaud)
 - Fixed bug #45430 (windows implementation of crypt is not thread safe).
   (Pierre)
 - Fixed bug #45345 (SPLFileInfo::getPathInfo() returning dir info instead of



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/standard http_fopen_wrapper.c

2008-07-25 Thread Michael Wallner
mikeFri Jul 25 08:27:38 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-srcNEWS 
/php-src/ext/standard   http_fopen_wrapper.c 
  Log:
  - Changed HTTP stream wrapper to accept any code between and including
200 to 399 as successful. (patch by Noah Fontes)
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.221r2=1.2027.2.547.2.965.2.222diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.221 
php-src/NEWS:1.2027.2.547.2.965.2.222
--- php-src/NEWS:1.2027.2.547.2.965.2.221   Fri Jul 25 04:54:08 2008
+++ php-src/NEWSFri Jul 25 08:27:37 2008
@@ -16,6 +16,8 @@
 - Changed PCRE, SPL and reflection extensions to always be enabled. (Marcus)
 - Changed md5() to use improved implementation. (Solar Designer, Dmitry)
 - Changed mhash to be a wrapper layer around the hash extension. (Scott)
+- Changed HTTP stream wrapper to accept any code between and including
+  200 to 399 as successful. (Mike, Noah Fontes)
 
 - Improved PHP syntax and semantics:
   . Added lambda functions and closures (Christian Seiler, Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.99.2.12.2.9.2.8r2=1.99.2.12.2.9.2.9diff_format=u
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.8 
php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.9
--- php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.8 Fri Jul 11 
10:25:15 2008
+++ php-src/ext/standard/http_fopen_wrapper.c   Fri Jul 25 08:27:37 2008
@@ -19,7 +19,7 @@
|  Sara Golemon [EMAIL PROTECTED]  |
+--+
  */
-/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.9.2.8 2008/07/11 10:25:15 tony2001 
Exp $ */ 
+/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.9.2.9 2008/07/25 08:27:37 mike Exp 
$ */ 
 
 #include php.h
 #include php_globals.h
@@ -529,25 +529,25 @@
(context  
php_stream_context_get_option(context, http, ignore_errors,  tmpzval) == 
SUCCESS  zend_is_true(*tmpzval)) ) {
reqok = 1;
}
-   switch(response_code) {
-   case 200:
-   case 206: /* partial content */
-   case 302:
-   case 303:
-   case 301:
-   reqok = 1;
-   break;
-   case 403:
-   php_stream_notify_error(context, 
PHP_STREAM_NOTIFY_AUTH_RESULT,
-   tmp_line, 
response_code);
-   break;
-   default:
-   /* safety net in the event tmp_line == 
NULL */
-   if (!tmp_line_len) {
-   tmp_line[0] = '\0';
-   }
-   php_stream_notify_error(context, 
PHP_STREAM_NOTIFY_FAILURE,
-   tmp_line, 
response_code);
+   /* all status codes in the 2xx range are defined by the 
specification as successful;
+* all status codes in the 3xx range are for 
redirection, and so also should never
+* fail */
+   if (response_code = 200  response_code  400) {
+   reqok = 1;
+   } else {
+   switch(response_code) {
+   case 403:
+   
php_stream_notify_error(context, PHP_STREAM_NOTIFY_AUTH_RESULT,
+   tmp_line, 
response_code);
+   break;
+   default:
+   /* safety net in the event 
tmp_line == NULL */
+   if (!tmp_line_len) {
+   tmp_line[0] = '\0';
+   }
+   
php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE,
+   tmp_line, 
response_code);
+   }
}
if (tmp_line[tmp_line_len - 1] == '\n') {
--tmp_line_len;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/standard http_fopen_wrapper.c

2007-11-04 Thread Sara Golemon
pollita Mon Nov  5 01:00:44 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   http_fopen_wrapper.c 
/php-srcNEWS 
  Log:
  MFH: http/ignore_errors context option
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.99.2.12.2.9.2.1r2=1.99.2.12.2.9.2.2diff_format=u
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.1 
php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.2
--- php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.1 Sun Sep 30 
05:49:45 2007
+++ php-src/ext/standard/http_fopen_wrapper.c   Mon Nov  5 01:00:43 2007
@@ -19,7 +19,7 @@
|  Sara Golemon [EMAIL PROTECTED]  |
+--+
  */
-/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.9.2.1 2007/09/30 05:49:45 jani Exp 
$ */ 
+/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.9.2.2 2007/11/05 01:00:43 pollita 
Exp $ */ 
 
 #include php.h
 #include php_globals.h
@@ -501,7 +501,8 @@
response_code = 0;
}
/* when we request only the header, don't fail even on 
error codes */
-   if (options  STREAM_ONLY_GET_HEADERS) {
+   if ((options  STREAM_ONLY_GET_HEADERS) ||
+   (php_stream_context_get_option(context, http, 
ignore_errors,  tmpzval) == SUCCESS  zend_is_true(*tmpzval)) ) {
reqok = 1;
}
switch(response_code) {
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.40r2=1.2027.2.547.2.965.2.41diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.40 
php-src/NEWS:1.2027.2.547.2.965.2.41
--- php-src/NEWS:1.2027.2.547.2.965.2.40Sat Nov  3 20:56:58 2007
+++ php-src/NEWSMon Nov  5 01:00:43 2007
@@ -22,6 +22,7 @@
   (Etienne Kneuss)
 - Added compact handler for Zend MM storage. (Dmitry)
 - Added '+' and '*' specifiers to zend_parse_parameters(). (Andrei)
+- Added 'ignore_errors' option to http fopen wrapper. (David Zulke, Sara)
 
 - Upgraded PCRE to version 7.4 (Nuno)
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php