1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-10 02:02:49 +03:00

add ap_get_status_line() so that modules can get a standardized

Status-Line value for their response.

Submitted by: Joe Orton <joe@orton.demon.co.uk>
Reviewed by: Greg Stein


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85762 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Greg Stein
2000-07-04 00:28:25 +00:00
parent 6dcafac17f
commit d02f5c7aba
3 changed files with 17 additions and 3 deletions

View File

@@ -165,6 +165,13 @@ API_EXPORT(int) ap_rflush(request_rec *r);
API_EXPORT(int) ap_index_of_response(int status); API_EXPORT(int) ap_index_of_response(int status);
/*
* Return the Status-Line for a given status code (excluding the
* HTTP-Version field). If an invalid or unknown status code is
* passed, "500 Internal Server Error" will be returned.
*/
API_EXPORT(const char *) ap_get_status_line(int status);
/* Reading a block of data from the client connection (e.g., POST arg) */ /* Reading a block of data from the client connection (e.g., POST arg) */
API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy); API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy);

View File

@@ -595,10 +595,12 @@ static void dav_send_multistatus(request_rec *r, int status,
ap_rputs("</D:href>" DEBUG_CR, r); ap_rputs("</D:href>" DEBUG_CR, r);
if (first->propresult.propstats == NULL) { if (first->propresult.propstats == NULL) {
/* ### it would be nice to get a status line from Apache */ /* use the Status-Line text from Apache. Note, this will
* default to 500 Internal Server Error if first->status
* is not a known (or valid) status code. */
ap_rprintf(r, ap_rprintf(r,
"<D:status>HTTP/1.1 %d status text goes here</D:status>" "<D:status>HTTP/1.1 %s</D:status>" DEBUG_CR,
DEBUG_CR, first->status); ap_get_status_line(first->status));
} }
else { else {
/* assume this includes <propstat> and is quoted properly */ /* assume this includes <propstat> and is quoted properly */

View File

@@ -1466,6 +1466,11 @@ API_EXPORT(int) ap_index_of_response(int status)
return LEVEL_500; /* 600 or above is also illegal */ return LEVEL_500; /* 600 or above is also illegal */
} }
API_EXPORT(const char *) ap_get_status_line(int status)
{
return status_lines[ap_index_of_response(status)];
}
/* Send a single HTTP header field to the client. Note that this function /* Send a single HTTP header field to the client. Note that this function
* is used in calls to table_do(), so their interfaces are co-dependent. * is used in calls to table_do(), so their interfaces are co-dependent.
* In other words, don't change this one without checking table_do in alloc.c. * In other words, don't change this one without checking table_do in alloc.c.