You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2011/11/23 04:36:22 UTC

svn commit: r1205274 - /httpd/httpd/trunk/modules/mappers/mod_negotiation.c

Author: covener
Date: Wed Nov 23 03:36:22 2011
New Revision: 1205274

URL: http://svn.apache.org/viewvc?rev=1205274&view=rev
Log:
mod_negotiation: don't return non-AP_FILTER_ERROR filter return values 
to ap_run_handler() when sending a body directly from a type-map.

Modified:
    httpd/httpd/trunk/modules/mappers/mod_negotiation.c

Modified: httpd/httpd/trunk/modules/mappers/mod_negotiation.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_negotiation.c?rev=1205274&r1=1205273&r2=1205274&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_negotiation.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_negotiation.c Wed Nov 23 03:36:22 2011
@@ -2972,6 +2972,7 @@ static int handle_map_file(request_rec *
     int res;
     char *udir;
     const char *new_req;
+    apr_status_t rv;
 
     if(strcmp(r->handler,MAP_FILE_MAGIC_TYPE) && strcmp(r->handler,"type-map"))
         return DECLINED;
@@ -3050,7 +3051,16 @@ static int handle_map_file(request_rec *
         e = apr_bucket_eos_create(c->bucket_alloc);
         APR_BRIGADE_INSERT_TAIL(bb, e);
 
-        return ap_pass_brigade(r->output_filters, bb);
+        rv = ap_pass_brigade(r->output_filters, bb);
+        if (rv != APR_SUCCESS) { 
+            if (rv != AP_FILTER_ERROR) {
+                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
+                              "ap_pass_brigade returned %d", rv);
+                return HTTP_INTERNAL_SERVER_ERROR;
+            }
+            return AP_FILTER_ERROR;
+        }
+        return OK;
     }
 
     if (r->path_info && *r->path_info) {



Re: svn commit: r1205274 - /httpd/httpd/trunk/modules/mappers/mod_negotiation.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
Add in r1205419 and used in r1205423
On Nov 23, 2011, at 9:29 AM, Eric Covener wrote:

> On Wed, Nov 23, 2011 at 9:15 AM, Jim Jagielski <ji...@apache.org> wrote:
>> 
>> On Nov 23, 2011, at 7:07 AM, Igor Galić wrote:
>> 
>>> 
>>> 
>>> [snip]
>>>> mod_negotiation: don't return non-AP_FILTER_ERROR filter return
>>>> values
>>> [snip]
>>>> +        rv = ap_pass_brigade(r->output_filters, bb);
>>>> +        if (rv != APR_SUCCESS) {
>>>> +            if (rv != AP_FILTER_ERROR) {
>>>> +                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
>>>> +                              "ap_pass_brigade returned %d", rv);
>>>> +                return HTTP_INTERNAL_SERVER_ERROR;
>>>> +            }
>>>> +            return AP_FILTER_ERROR;
>>>> +        }
>>>> +        return OK;
>>> 
>>> It looks like exactly this kind of code would or should be used
>>> all over the place -- maybe we should put that in a function/macro?
>>> 
>> 
>> ap_pass_brigade_errchk(r, bb)
>> 
>> and the above could compress to
>> 
>>        return ap_pass_brigade_errchk(r, bb);
>> 
>> +1
>> 
>> Unless someone beats me to it, will add to trunk and backport
>> to 2.4...
> 
> maybe additionally a char* for the caller to add a msg -- it was
> useful in this case to find out what the handler was.
> 


Re: svn commit: r1205274 - /httpd/httpd/trunk/modules/mappers/mod_negotiation.c

Posted by Eric Covener <co...@gmail.com>.
On Wed, Nov 23, 2011 at 9:15 AM, Jim Jagielski <ji...@apache.org> wrote:
>
> On Nov 23, 2011, at 7:07 AM, Igor Galić wrote:
>
>>
>>
>> [snip]
>>> mod_negotiation: don't return non-AP_FILTER_ERROR filter return
>>> values
>> [snip]
>>> +        rv = ap_pass_brigade(r->output_filters, bb);
>>> +        if (rv != APR_SUCCESS) {
>>> +            if (rv != AP_FILTER_ERROR) {
>>> +                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
>>> +                              "ap_pass_brigade returned %d", rv);
>>> +                return HTTP_INTERNAL_SERVER_ERROR;
>>> +            }
>>> +            return AP_FILTER_ERROR;
>>> +        }
>>> +        return OK;
>>
>> It looks like exactly this kind of code would or should be used
>> all over the place -- maybe we should put that in a function/macro?
>>
>
> ap_pass_brigade_errchk(r, bb)
>
> and the above could compress to
>
>        return ap_pass_brigade_errchk(r, bb);
>
> +1
>
> Unless someone beats me to it, will add to trunk and backport
> to 2.4...

maybe additionally a char* for the caller to add a msg -- it was
useful in this case to find out what the handler was.

Re: svn commit: r1205274 - /httpd/httpd/trunk/modules/mappers/mod_negotiation.c

Posted by Jim Jagielski <ji...@apache.org>.
On Nov 23, 2011, at 7:07 AM, Igor Galić wrote:

> 
> 
> [snip]
>> mod_negotiation: don't return non-AP_FILTER_ERROR filter return
>> values
> [snip]
>> +        rv = ap_pass_brigade(r->output_filters, bb);
>> +        if (rv != APR_SUCCESS) {
>> +            if (rv != AP_FILTER_ERROR) {
>> +                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
>> +                              "ap_pass_brigade returned %d", rv);
>> +                return HTTP_INTERNAL_SERVER_ERROR;
>> +            }
>> +            return AP_FILTER_ERROR;
>> +        }
>> +        return OK;
> 
> It looks like exactly this kind of code would or should be used
> all over the place -- maybe we should put that in a function/macro?
> 

ap_pass_brigade_errchk(r, bb)

and the above could compress to

	return ap_pass_brigade_errchk(r, bb);

+1

Unless someone beats me to it, will add to trunk and backport
to 2.4...


Re: svn commit: r1205274 - /httpd/httpd/trunk/modules/mappers/mod_negotiation.c

Posted by Jim Jagielski <ji...@apache.org>.
On Nov 23, 2011, at 7:07 AM, Igor Galić wrote:

> 
> 
> [snip]
>> mod_negotiation: don't return non-AP_FILTER_ERROR filter return
>> values
> [snip]
>> +        rv = ap_pass_brigade(r->output_filters, bb);
>> +        if (rv != APR_SUCCESS) {
>> +            if (rv != AP_FILTER_ERROR) {
>> +                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
>> +                              "ap_pass_brigade returned %d", rv);
>> +                return HTTP_INTERNAL_SERVER_ERROR;
>> +            }
>> +            return AP_FILTER_ERROR;
>> +        }
>> +        return OK;
> 
> It looks like exactly this kind of code would or should be used
> all over the place -- maybe we should put that in a function/macro?
> 

ap_pass_brigade_errchk(r, bb)

and the above could compress to

	return ap_pass_brigade_errchk(r, bb);

+1

Unless someone beats me to it, will add to trunk and backport
to 2.4...


Re: svn commit: r1205274 - /httpd/httpd/trunk/modules/mappers/mod_negotiation.c

Posted by Igor Galić <i....@brainsware.org>.

[snip]
> mod_negotiation: don't return non-AP_FILTER_ERROR filter return
> values
[snip]
> +        rv = ap_pass_brigade(r->output_filters, bb);
> +        if (rv != APR_SUCCESS) {
> +            if (rv != AP_FILTER_ERROR) {
> +                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
> +                              "ap_pass_brigade returned %d", rv);
> +                return HTTP_INTERNAL_SERVER_ERROR;
> +            }
> +            return AP_FILTER_ERROR;
> +        }
> +        return OK;

It looks like exactly this kind of code would or should be used
all over the place -- maybe we should put that in a function/macro?

[snip]

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE