You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ro...@imdb.com> on 1997/01/21 02:20:13 UTC
new API hook is called too often
The new header_parse API hook gets called before redirected requests
as well as the original. That's a horrible waste and probably not what
was intended. The headers aren't going to change just because we do an
internal redirect.
BTW, it might be useful to add a few lines of code so that header_parse()
can return a value which causes a jump back to line 864 [if (!r->proxyreq)]
in process_request_internal(). That will allow a module that uses this
API hook to do URL rewriting before any real work is devoted to the
request. I just tried it as an experiment and it works fine. I'll provide
a patch if anyone is interested in seeing one.
Here's a patch to make the header_parse functions get called once only..
Index: http_request.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_request.c,v
retrieving revision 1.8
diff -u -r1.8 http_request.c
--- http_request.c 1997/01/20 14:50:09 1.8
+++ http_request.c 1997/01/21 00:35:55
@@ -831,7 +831,7 @@
return 0;
}
-void process_request_internal (request_rec *r)
+void process_request_internal (request_rec *r, int parse_headers)
{
int access_status;
@@ -902,7 +902,7 @@
return;
}
- if ((access_status = header_parse (r))) {
+ if (parse_headers && (access_status = header_parse (r))) {
die (access_status, r);
return;
}
@@ -970,7 +970,7 @@
#ifdef STATUS
int old_stat;
#endif /* STATUS */
- process_request_internal (r);
+ process_request_internal (r, 1);
#ifdef STATUS
old_stat = update_child_status (r->connection->child_num, SERVER_BUSY_LOG,
r);
@@ -1055,7 +1055,7 @@
void internal_redirect (const char *new_uri, request_rec *r)
{
request_rec *new = internal_internal_redirect(new_uri, r);
- process_request_internal (new);
+ process_request_internal (new, 0);
}
/* This function is designed for things like actions or CGI scripts, when
@@ -1068,5 +1068,5 @@
request_rec *new = internal_internal_redirect(new_uri, r);
if (r->handler)
new->content_type = r->content_type;
- process_request_internal (new);
+ process_request_internal (new, 0);
}