summaryrefslogtreecommitdiffstats
path: root/contrib/serf/ssltunnel.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2014-02-22 18:55:49 +0000
committerpeter <peter@FreeBSD.org>2014-02-22 18:55:49 +0000
commit92739d7a0b63f570534b21b1dcc909457336c381 (patch)
tree3f025a453a6555531748fc481d3388e91cee0004 /contrib/serf/ssltunnel.c
parent30ff5acc637e49d3458503caf8ca7871e2910ecb (diff)
downloadFreeBSD-src-92739d7a0b63f570534b21b1dcc909457336c381.zip
FreeBSD-src-92739d7a0b63f570534b21b1dcc909457336c381.tar.gz
MFC r262324: serf 1.3.4 - improve SSL handling with svn-1.8.8 and other
speedups and quality of life fixes.
Diffstat (limited to 'contrib/serf/ssltunnel.c')
-rw-r--r--contrib/serf/ssltunnel.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/contrib/serf/ssltunnel.c b/contrib/serf/ssltunnel.c
index 480c799..28ca127 100644
--- a/contrib/serf/ssltunnel.c
+++ b/contrib/serf/ssltunnel.c
@@ -68,9 +68,10 @@ static apr_status_t handle_response(serf_request_t *request,
apr_status_t status;
serf_status_line sl;
req_ctx_t *ctx = handler_baton;
+ serf_connection_t *conn = request->conn;
if (! response) {
- serf_connection_request_create(request->conn,
+ serf_connection_request_create(conn,
setup_request,
ctx);
return APR_SUCCESS;
@@ -97,17 +98,34 @@ static apr_status_t handle_response(serf_request_t *request,
connection.
*/
if (sl.code >= 200 && sl.code < 300) {
- request->conn->state = SERF_CONN_CONNECTED;
+ serf_bucket_t *hdrs;
+ const char *val;
+
+ conn->state = SERF_CONN_CONNECTED;
/* Body is supposed to be empty. */
apr_pool_destroy(ctx->pool);
- serf_bucket_destroy(request->conn->ssltunnel_ostream);
- request->conn->stream = NULL;
+ serf_bucket_destroy(conn->ssltunnel_ostream);
+ serf_bucket_destroy(conn->stream);
+ conn->stream = NULL;
ctx = NULL;
- serf__log(CONN_VERBOSE, __FILE__,
- "successfully set up ssl tunnel on connection 0x%x\n",
- request->conn);
+ serf__log_skt(CONN_VERBOSE, __FILE__, conn->skt,
+ "successfully set up ssl tunnel.\n");
+
+ /* Fix for issue #123: ignore the "Connection: close" header here,
+ leaving the header in place would make the serf's main context
+ loop close this connection immediately after reading the 200 OK
+ response. */
+
+ hdrs = serf_bucket_response_get_headers(response);
+ val = serf_bucket_headers_get(hdrs, "Connection");
+ if (val && strcasecmp("close", val) == 0) {
+ serf__log_skt(CONN_VERBOSE, __FILE__, conn->skt,
+ "Ignore Connection: close header on this reponse, don't "
+ "close the connection now that the tunnel is set up.\n");
+ serf__bucket_headers_remove(hdrs, "Connection");
+ }
return APR_EOF;
}
@@ -171,8 +189,8 @@ apr_status_t serf__ssltunnel_connect(serf_connection_t *conn)
ctx);
conn->state = SERF_CONN_SETUP_SSLTUNNEL;
- serf__log(CONN_VERBOSE, __FILE__,
- "setting up ssl tunnel on connection 0x%x\n", conn);
+ serf__log_skt(CONN_VERBOSE, __FILE__, conn->skt,
+ "setting up ssl tunnel on connection.\n");
return APR_SUCCESS;
}
OpenPOWER on IntegriCloud