[serf] r2500 committed - Attempt to fix issue #172: handle a server-triggered renegotiation cor...

0 views
Skip to first unread message

se...@googlecode.com

unread,
Aug 15, 2015, 8:13:57 AM8/15/15
to serf...@googlegroups.com
Revision: 2500
Author: lieven.govaerts
Date: Sat Aug 15 12:13:40 2015 UTC
Log: Attempt to fix issue #172: handle a server-triggered
renegotiation correctly.
The issue fixed in this change is that serf stops sending OpenSSL's data
needed
to handle the renegotiation, when pipeling is disabled and a request is
already
written.

* outgoing.c
(write_to_connection): Make sure serf keeps writing data for the SSL
layer,
even if there is already a request outstanding and pipeling is
disabled.
(request_or_data_pending): Only queue the next request when pipelining or
no request is pending yet. Initialize the output variable to NULL
correctly. Adapt the logging text.
(read_from_connection): Add some debug logging.

https://code.google.com/p/serf/source/detail?r=2500

Modified:
/trunk/outgoing.c

=======================================
--- /trunk/outgoing.c Wed Apr 8 12:45:40 2015 UTC
+++ /trunk/outgoing.c Sat Aug 15 12:13:40 2015 UTC
@@ -96,16 +96,29 @@
static int
request_or_data_pending(serf_request_t **next_req, serf_connection_t *conn)
{
- /* Skip all requests that have been written completely but we're still
- waiting for a response. */
- serf_request_t *request = conn->unwritten_reqs;
+ int reqs_in_progress;
+
+ reqs_in_progress = conn->completed_requests -
conn->completed_responses;
+
+ /* Prepare the next request */
+ if (conn->pipelining || (!conn->pipelining && reqs_in_progress == 0))
+ {
+ /* Skip all requests that have been written completely but we're
still
+ waiting for a response. */
+ serf_request_t *request = conn->unwritten_reqs;
+
+ if (next_req)
+ *next_req = request;
+
+ if (request != NULL) {
+ return 1;
+ }
+ }

if (next_req)
- *next_req = request;
+ *next_req = NULL;

- if (request != NULL) {
- return 1;
- } else if (conn->ostream_head) {
+ if (conn->ostream_head) {
const char *dummy;
apr_size_t len;
apr_status_t status;
@@ -114,7 +127,7 @@
&len);
if (!SERF_BUCKET_READ_ERROR(status) && len) {
serf__log(LOGLVL_DEBUG, LOGCOMP_CONN, __FILE__, conn->config,
- "All requests written but still data pending.\n");
+ "Extra data to be written after sending complete
requests.\n");
return 1;
}
}
@@ -828,13 +841,6 @@
/* backoff for now. */
return APR_SUCCESS;
}
-
- /* If pipelining is disabled, max. one request should be in
progress */
- if (!conn->pipelining && reqs_in_progress > 0)
- {
- /* backoff for now. */
- return APR_SUCCESS;
- }

/* If we have unwritten data, then write what we can. */
while (conn->vec_len) {
@@ -1312,6 +1318,10 @@
on a connection using HTTP pipelining, we reset the connection,
disable pipelining and reconnect to the server. */
if (status == SERF_ERROR_SSL_NEGOTIATE_IN_PROGRESS) {
+ serf__log(LOGLVL_WARNING, LOGCOMP_CONN, __FILE__, conn->config,
+ "The server requested renegotiation. Disable HTTP "
+ "pipelining and reset the connection.\n", conn);
+
serf__connection_set_pipelining(conn, 0);
reset_connection(conn, 1);
status = APR_SUCCESS;
Reply all
Reply to author
Forward
0 new messages