Summary:
Added generic_fullresp_recv_resp() to force full response.
This patch adds a new handler that always retrieves the entire response.
This handler is needed because we currently do not have a way to tell
flood to always retrieve the entire response. We have a "wantresponse"
flag that tells the socket code whether or not to retrieve the entire
response. Handlers such as round_robin_create_req() set this flag based
on varying factors. With the new generic_fullresp_recv_resp() handler,
you can specify it in your <profile> section like this:
<recv_resp>generic_fullresp_recv_resp</recv_resp>
to cause flood to retrieve the entire response.
When used with the handler:
relative_times_process_stats
you can measure the total bytes sent and received with each request
and response.
Files affected by this patch:
flood_profile.c
flood_socket_generic.c
flood_socket_generic.h
Index: flood_profile.c
===================================================================
RCS file: /home/cvspublic/httpd-test/flood/flood_profile.c,v
retrieving revision 1.23
diff -u -r1.23 flood_profile.c
--- flood_profile.c 7 Feb 2003 07:39:21 -0000 1.23
+++ flood_profile.c 12 Feb 2003 16:10:03 -0000
@@ -252,6 +252,9 @@
/* Alternative Implementations that are currently available: */
+ /* Always retrieve the full response */
+ {"recv_resp", "generic_fullresp_recv_resp",
&generic_fullresp_recv_resp},
+
/* Keep-Alive support */
{"socket_init", "keepalive_socket_init", &keepalive_socket_init},
{"begin_conn", "keepalive_begin_conn", &keepalive_begin_conn},
Index: flood_socket_generic.c
===================================================================
RCS file: /home/cvspublic/httpd-test/flood/flood_socket_generic.c,v
retrieving revision 1.8
diff -u -r1.8 flood_socket_generic.c
--- flood_socket_generic.c 3 Feb 2003 17:10:56 -0000 1.8
+++ flood_socket_generic.c 12 Feb 2003 16:10:03 -0000
@@ -201,6 +201,26 @@
}
/**
+ * This implementation always retrieves the full response.
+ * We temporarily set the "wantresponse" flag to true and
+ * call generic_recv_resp() to do the real work.
+ */
+apr_status_t generic_fullresp_recv_resp(response_t **resp,
+ socket_t *sock,
+ apr_pool_t *pool)
+{
+ generic_socket_t *gsock = (generic_socket_t *)sock;
+ int orig_wantresponse = gsock->wantresponse;
+ apr_status_t status;
+
+ gsock->wantresponse = 1;
+ status = generic_recv_resp(resp, sock, pool);
+ gsock->wantresponse = orig_wantresponse;
+
+ return status;
+}
+
+/**
* Generic implementation for end_conn.
*/
apr_status_t generic_end_conn(socket_t *sock, request_t *req, response_t *resp)
Index: flood_socket_generic.h
===================================================================
RCS file: /home/cvspublic/httpd-test/flood/flood_socket_generic.h,v
retrieving revision 1.3
diff -u -r1.3 flood_socket_generic.h
--- flood_socket_generic.h 3 Feb 2003 17:10:56 -0000 1.3
+++ flood_socket_generic.h 12 Feb 2003 16:10:03 -0000
@@ -62,6 +62,7 @@
apr_status_t generic_socket_init(socket_t **sock, apr_pool_t *pool);
apr_status_t generic_begin_conn(socket_t *sock, request_t *req, apr_pool_t
*pool);
apr_status_t generic_send_req(socket_t *sock, request_t *req, apr_pool_t
*pool);
+apr_status_t generic_fullresp_recv_resp(response_t **resp, socket_t *sock,
apr_pool_t *pool);
apr_status_t generic_recv_resp(response_t **resp, socket_t *sock, apr_pool_t
*pool);
apr_status_t generic_end_conn(socket_t *sock, request_t *req, response_t
*resp);
apr_status_t generic_socket_destroy(socket_t *socket);