diff --git a/include/http_protocol.h b/include/http_protocol.h
index 43a0a6aa45..c52b141d1f 100644
--- a/include/http_protocol.h
+++ b/include/http_protocol.h
@@ -165,6 +165,13 @@ API_EXPORT(int) ap_rflush(request_rec *r);
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) */
API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy);
diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c
index ab7709313e..a320a9a179 100644
--- a/modules/dav/main/mod_dav.c
+++ b/modules/dav/main/mod_dav.c
@@ -595,10 +595,12 @@ static void dav_send_multistatus(request_rec *r, int status,
ap_rputs("" DEBUG_CR, r);
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,
- "HTTP/1.1 %d status text goes here"
- DEBUG_CR, first->status);
+ "HTTP/1.1 %s" DEBUG_CR,
+ ap_get_status_line(first->status));
}
else {
/* assume this includes and is quoted properly */
diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c
index bb08a8ee40..4fd5608370 100644
--- a/modules/http/http_protocol.c
+++ b/modules/http/http_protocol.c
@@ -1466,6 +1466,11 @@ API_EXPORT(int) ap_index_of_response(int status)
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
* 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.