You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/03/31 05:43:26 UTC
[PATCH] mod_negotiation: not copying headers, and more memory fixes
Petr's patch to merge r->notes, r->headers_out and r->err_headers_out
didn't call overlay_tables properly. This is the only bug fix in this
patch, it's the last hunk. I think this might actually fix a PR but I
don't have the time to find it.
The other hunks are more destroy_sub_req()s that are similar to the other
cleanups that Petr's patch performed. But they're not strictly necessary,
just nice to prevent bloat during a request.
Dean
Index: mod_negotiation.c
===================================================================
RCS file: /hot/repository/apache/src/mod_negotiation.c,v
retrieving revision 1.9
diff -c -3 -r1.9 mod_negotiation.c
*** mod_negotiation.c 1997/03/18 06:40:07 1.9
--- mod_negotiation.c 1997/03/31 03:07:22
***************
*** 764,770 ****
if (sub_req->handler && !sub_req->content_type)
sub_req->content_type = CGI_MAGIC_TYPE;
! if (sub_req->status != HTTP_OK || !sub_req->content_type) continue;
/* If it's a map file, we use that instead of the map
* we're building...
--- 764,773 ----
if (sub_req->handler && !sub_req->content_type)
sub_req->content_type = CGI_MAGIC_TYPE;
! if (sub_req->status != HTTP_OK || !sub_req->content_type) {
! destroy_sub_req (sub_req);
! continue;
! }
/* If it's a map file, we use that instead of the map
* we're building...
***************
*** 1791,1799 ****
char *sub_vary;
if (!variant->sub_req) {
sub_req = sub_req_lookup_file(variant->file_name, r);
! if (sub_req->status != HTTP_OK && sub_req->status != HTTP_MULTIPLE_CHOICES)
! return sub_req->status;
variant->sub_req = sub_req;
}
else
--- 1794,1807 ----
char *sub_vary;
if (!variant->sub_req) {
+ int status;
+
sub_req = sub_req_lookup_file(variant->file_name, r);
! status = sub_req->status;
! if (status != HTTP_OK && status != HTTP_MULTIPLE_CHOICES) {
! destroy_sub_req (sub_req);
! return status;
! }
variant->sub_req = sub_req;
}
else
***************
*** 1955,1960 ****
--- 1963,1969 ----
sub_req = sub_req_lookup_file (best->file_name, r);
if (sub_req->status != HTTP_OK) {
res = sub_req->status;
+ destroy_sub_req (sub_req);
goto return_from_multi;
}
}
***************
*** 1982,1990 ****
r->content_language = sub_req->content_language;
r->finfo = sub_req->finfo;
/* copy output headers from subrequest, but leave negotiation headers */
! overlay_tables(r->pool, sub_req->notes, r->notes);
! overlay_tables(r->pool, sub_req->headers_out, r->headers_out);
! overlay_tables(r->pool, sub_req->err_headers_out, r->err_headers_out);
avail_recs = (var_rec *)neg->avail_vars->elts;
for (j = 0; j < neg->avail_vars->nelts; ++j) {
var_rec *variant = &avail_recs[j];
--- 1991,1999 ----
r->content_language = sub_req->content_language;
r->finfo = sub_req->finfo;
/* copy output headers from subrequest, but leave negotiation headers */
! r->notes = overlay_tables(r->pool, sub_req->notes, r->notes);
! r->headers_out = overlay_tables(r->pool, sub_req->headers_out, r->headers_out);
! r->err_headers_out = overlay_tables(r->pool, sub_req->err_headers_out, r->err_headers_out);
avail_recs = (var_rec *)neg->avail_vars->elts;
for (j = 0; j < neg->avail_vars->nelts; ++j) {
var_rec *variant = &avail_recs[j];
Re: [PATCH] mod_negotiation: not copying headers, and more memory fixes
Posted by Chuck Murcko <ch...@topsail.org>.
Dean Gaudet wrote:
>
> Petr's patch to merge r->notes, r->headers_out and r->err_headers_out
> didn't call overlay_tables properly. This is the only bug fix in this
> patch, it's the last hunk. I think this might actually fix a PR but I
> don't have the time to find it.
>
> The other hunks are more destroy_sub_req()s that are similar to the other
> cleanups that Petr's patch performed. But they're not strictly necessary,
> just nice to prevent bloat during a request.
>
+1. This is really weird code.
--
chuck
Chuck Murcko
The Topsail Group, West Chester PA USA
chuck@topsail.org