fielding 97/05/08 06:09:27
Modified: src CHANGES http_core.c http_request.c mod_include.c
Log:
Test for error conditions before creating output header fields, since
we don't want the error message to include those fields. Likewise,
reset the content_language(s) and content_encoding of the response
before generating or redirecting to an error message, since the new
message will have its own Content-* definitions.
This is only a partial solution to the problem of error messages
inheriting header fields and request_rec variables from almost-succeeded
requests, but this part is needed for the general solution anyway.
A fix for the latter will be in a separate patch.
Submitted by: Dean Gaudet
Reviewed by: Roy Fielding, Ken Coar, Jim Jagielski
Revision Changes Path
1.270 +7 -1 apache/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache/src/CHANGES,v
retrieving revision 1.269
retrieving revision 1.270
diff -C3 -r1.269 -r1.270
*** CHANGES 1997/05/08 11:27:27 1.269
--- CHANGES 1997/05/08 13:09:23 1.270
***************
*** 1,10 ****
Changes with Apache 1.2
*) Fixed a couple places where a check for the default Content-Type was
not properly checking both the value configured by the DefaultType
directive and the DEFAULT_TYPE symbol in httpd.h. Changed the value
of DEFAULT_TYPE to match the documented default (text/plain).
! [Dean Gaudet]
*) Escape the HTML-sensitive characters in the Request-URI that is
output for each child by mod_status. [Dean Gaudet and Ken Coar] PR#501
--- 1,16 ----
Changes with Apache 1.2
+ *) Test for error conditions before creating output header fields, since
+ we don't want the error message to include those fields. Likewise,
+ reset the content_language(s) and content_encoding of the response
+ before generating or redirecting to an error message, since the new
+ message will have its own Content-* definitions. [Dean Gaudet]
+
*) Fixed a couple places where a check for the default Content-Type was
not properly checking both the value configured by the DefaultType
directive and the DEFAULT_TYPE symbol in httpd.h. Changed the value
of DEFAULT_TYPE to match the documented default (text/plain).
! [Dean Gaudet] PR#506
*) Escape the HTML-sensitive characters in the Request-URI that is
output for each child by mod_status. [Dean Gaudet and Ken Coar] PR#501
1.81 +4 -4 apache/src/http_core.c
Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -C3 -r1.80 -r1.81
*** http_core.c 1997/04/24 10:19:09 1.80
--- http_core.c 1997/05/08 13:09:24 1.81
***************
*** 1322,1331 ****
return NOT_FOUND;
}
if (r->method_number != M_GET) return METHOD_NOT_ALLOWED;
-
- if ((errstatus = set_last_modified (r, r->finfo.st_mtime))
- || (errstatus = set_content_length (r, r->finfo.st_size)))
- return errstatus;
#ifdef __EMX__
/* Need binary mode for OS/2 */
--- 1322,1327 ----
***************
*** 1338,1343 ****
--- 1334,1343 ----
log_reason("file permissions deny server access", r->filename, r);
return FORBIDDEN;
}
+
+ if ((errstatus = set_last_modified (r, r->finfo.st_mtime))
+ || (errstatus = set_content_length (r, r->finfo.st_size)))
+ return errstatus;
if (d->content_md5 & 1) {
table_set (r->headers_out, "Content-MD5", md5digest(r->pool, f));
1.48 +11 -1 apache/src/http_request.c
Index: http_request.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_request.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -C3 -r1.47 -r1.48
*** http_request.c 1997/04/07 11:47:05 1.47
--- http_request.c 1997/05/08 13:09:24 1.48
***************
*** 763,769 ****
}
r->status = type;
!
/* Two types of custom redirects --- plain text, and URLs.
* Plain text has a leading '"', so the URL code, here, is triggered
* on its absence
--- 763,779 ----
}
r->status = type;
!
! /* XXX: this is an awful thing to have to do here, in fact there are
! * probably other cases that need this attention. Essentially we're
! * about to report an error, and if we don't do an internal_redirect
! * below then we'll report the error with the wrong headers -- we'll
! * use headers belonging to the original request.
! */
! r->content_language = NULL;
! r->content_languages = NULL;
! r->content_encoding = NULL;
!
/* Two types of custom redirects --- plain text, and URLs.
* Plain text has a leading '"', so the URL code, here, is triggered
* on its absence
1.31 +7 -7 apache/src/mod_include.c
Index: mod_include.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_include.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C3 -r1.30 -r1.31
*** mod_include.c 1997/04/24 23:35:21 1.30
--- mod_include.c 1997/05/08 13:09:25 1.31
***************
*** 1740,1746 ****
: r->filename, r);
return NOT_FOUND;
}
!
if (*state == xbithack_full
#ifndef __EMX__
/* OS/2 dosen't support Groups. */
--- 1740,1751 ----
: r->filename, r);
return NOT_FOUND;
}
!
! if(!(f=pfopen(r->pool, r->filename, "r"))) {
! log_reason("file permissions deny server access", r->filename, r);
! return FORBIDDEN;
! }
!
if (*state == xbithack_full
#ifndef __EMX__
/* OS/2 dosen't support Groups. */
***************
*** 1748,1759 ****
#endif
&& (errstatus = set_last_modified (r, r->finfo.st_mtime)))
return errstatus;
!
! if(!(f=pfopen(r->pool, r->filename, "r"))) {
! log_reason("file permissions deny server access", r->filename, r);
! return FORBIDDEN;
! }
!
send_http_header(r);
if (r->header_only) {
--- 1753,1759 ----
#endif
&& (errstatus = set_last_modified (r, r->finfo.st_mtime)))
return errstatus;
!
send_http_header(r);
if (r->header_only) {