You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ni...@apache.org on 2007/10/07 15:41:51 UTC
svn commit: r582630 - in /httpd/httpd/trunk: include/http_protocol.h
server/protocol.c
Author: niq
Date: Sun Oct 7 06:41:50 2007
New Revision: 582630
URL: http://svn.apache.org/viewvc?rev=582630&view=rev
Log:
Introduce ap_send_interim_response function and API, for interim
(HTTP 1xx) responses sent by an application or backend.
Modified:
httpd/httpd/trunk/include/http_protocol.h
httpd/httpd/trunk/server/protocol.c
Modified: httpd/httpd/trunk/include/http_protocol.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_protocol.h?rev=582630&r1=582629&r2=582630&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_protocol.h (original)
+++ httpd/httpd/trunk/include/http_protocol.h Sun Oct 7 06:41:50 2007
@@ -664,6 +664,12 @@
* @param sub_r Subrequest that is now compete
*/
AP_DECLARE(void) ap_finalize_sub_req_protocol(request_rec *sub_r);
+
+/**
+ * Send an interim (HTTP 1xx) response immediately.
+ * @param r The request
+ */
+AP_DECLARE(void) ap_send_interim_response(request_rec *r);
#ifdef __cplusplus
}
Modified: httpd/httpd/trunk/server/protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=582630&r1=582629&r2=582630&view=diff
==============================================================================
--- httpd/httpd/trunk/server/protocol.c (original)
+++ httpd/httpd/trunk/server/protocol.c Sun Oct 7 06:41:50 2007
@@ -1631,6 +1631,41 @@
}
}
+typedef struct hdr_ptr {
+ ap_filter_t *f;
+ apr_bucket_brigade *bb;
+} hdr_ptr;
+static int send_header(void *data, const char *key, const char *val)
+{
+ ap_fputstrs(((hdr_ptr*)data)->f, ((hdr_ptr*)data)->bb,
+ key, ": ", val, CRLF, NULL);
+ return 1;
+}
+AP_DECLARE(void) ap_send_interim_response(request_rec *r)
+{
+ hdr_ptr x;
+
+ if (r->proto_num < 1001) {
+ /* don't send interim response to HTTP/1.0 Client */
+ return;
+ }
+ if (!ap_is_HTTP_INFO(r->status)) {
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, NULL,
+ "Status is %d - not sending interim response", r->status);
+ return;
+ }
+
+ x.f = r->connection->output_filters;
+ x.bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
+ ap_fputstrs(x.f, x.bb, AP_SERVER_PROTOCOL, " ", r->status_line, CRLF, NULL);
+ apr_table_do(send_header, &x, r->headers_out, NULL);
+ ap_fputs(x.f, x.bb, CRLF);
+ ap_fflush(x.f, x.bb);
+ apr_brigade_destroy(x.bb);
+ apr_table_clear(r->headers_out);
+}
+
+
AP_IMPLEMENT_HOOK_RUN_ALL(int,post_read_request,
(request_rec *r), (r), OK, DECLINED)
AP_IMPLEMENT_HOOK_RUN_ALL(int,log_transaction,
Re: svn commit: r582630 - in /httpd/httpd/trunk: include/http_protocol.h
server/protocol.c
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
> --- httpd/httpd/trunk/include/http_protocol.h (original)
> +++ httpd/httpd/trunk/include/http_protocol.h Sun Oct 7 06:41:50 2007
> @@ -664,6 +664,12 @@
> * @param sub_r Subrequest that is now compete
> */
> AP_DECLARE(void) ap_finalize_sub_req_protocol(request_rec *sub_r);
> +
> +/**
> + * Send an interim (HTTP 1xx) response immediately.
> + * @param r The request
> + */
> +AP_DECLARE(void) ap_send_interim_response(request_rec *r);
Corresponding MMN bump?