RE: [PHP-DEV] [Patch] http_fopen_wrapper.c and allowing any response code w/o warning
| From: | Jared Williams | Date: | Fri, 02 Nov 2007 15:39:27 +0000 |
| Subject: | RE: [PHP-DEV] [Patch] http_fopen_wrapper.c and allowing any response code w/o warning | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33005@lists.php.net to get a copy of this message | ||
Yes, had fun with trying to use http php streams ... Imo, 2xx status codes
should always be considered succesful.
http://bugs.php.net/bug.php?id=36947
http://marc.info/?l=php-internals&m=111384113712112&w=2
J
> -----Original Message-----
> From: David Zülke [mailto:dz@bitxtender.com]
> Sent: 01 November 2007 23:10
> To: PHP Internals
> Subject: Re: [PHP-DEV] [Patch] http_fopen_wrapper.c and
> allowing any response code w/o warning
>
> This is probably better:
>
> if (options & STREAM_ONLY_GET_HEADERS ||
> (php_stream_context_get_option(context, "http", "ignore_errors",
> &tmpzval) == SUCCESS && Z_BVAL_PP(tmpzval))) {
>
>
> - David
>
>
> Am 02.11.2007 um 00:06 schrieb David Zülke:
>
> > Hi folks,
> >
> > I've recently played with CouchDB, which is a document
> database with a
> > RESTful HTTP interface.
> >
> > I noticed, however, that there is no way to prevent PHP
> from throwing
> > a warning on response codes other than 200, 206, 301, 302 and 303.
> >
> > Something like 201 Created throws a warning, for example.
> >
> > But I'm not sure if simply adding that one to the list is
> the proper
> > way forward, as I imagine there are many situations when
> you just want
> > to get the response content and look at the headers afterwards (w/
> > stream_get_meta_data). So I looked at the code and came up
> with this
> > change for http_fopen_wrapper.c line 547
> >
> (http://lxr.php.net/source/php-src/ext/standard/http_fopen_wrapper.c#5
> > 47
> > ):
> >
> > if ((options & STREAM_ONLY_GET_HEADERS) ||
> > (php_stream_context_get_option(context, "http", "ignore_errors",
> > &tmpzval) == SUCCESS && Z_TYPE_PP(tmpzval) == IS_BOOL &&
> > Z_BVAL(retval))) {
> >
> > So when the option "ignore_errors" is set for HTTP on the
> context, no
> > error will be thrown, and the response body is returned properly.
> >
> > Is that a reasonable idea? I'm not entirely sure about the
> > "ignore_errors" name, maybe someone has a better suggestion.
> >
> > I'd be happy to supply a full patch, but I wanted to hear if anyone
> > has thoughts on this first.
> >
> > Cheers,
> >
> > David
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List To
> unsubscribe,
> > visit: http://www.php.net/unsub.php
> >
> >
>
> --
> PHP Internals - PHP Runtime Development Mailing List To
> unsubscribe, visit: http://www.php.net/unsub.php
>