You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by lg...@apache.org on 2012/10/09 20:10:56 UTC
svn commit: r1396147 - in /subversion/trunk/subversion/libsvn_ra_serf:
serf.c util.c
Author: lgo
Date: Tue Oct 9 18:10:55 2012
New Revision: 1396147
URL: http://svn.apache.org/viewvc?rev=1396147&view=rev
Log:
Replace r1395777, -86: assume the server only supports HTTP/1.0, upgrade
to HTTP/1.1 when the response indicates that it's possible.
Keep adding the "Connection: keep-alive" header for HTTP/1.0 requests.
This should make ra_serf work over all HTTP/1.0 proxies.
* subversion/libsvn_ra_serf/serf.c
(svn_ra_serf__open): Set HTTP/1.0 as default.
* subversion/libsvn_ra_serf/util.c
(handle_response): Upgrade to HTTP/1.1 when possible. Remove the code that
checks for specific error messages from the server, we now only need to
verify the version in the status line.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/serf.c
subversion/trunk/subversion/libsvn_ra_serf/util.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1396147&r1=1396146&r2=1396147&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Tue Oct 9 18:10:55 2012
@@ -399,10 +399,9 @@ svn_ra_serf__open(svn_ra_session_t *sess
serf_sess->capabilities = apr_hash_make(serf_sess->pool);
- /* Assume HTTP/1.1 is supported. When the server responds HTTP/1.0, switch
- from chunked encoding to Content-Length, and set Connection:keep-alive
- header to try and keep the pipeline open. */
- serf_sess->http10 = FALSE;
+ /* We have to assume that the server only supports HTTP/1.0. Once it's clear
+ HTTP/1.1 is supported, we can upgrade. */
+ serf_sess->http10 = TRUE;
SVN_ERR(load_config(serf_sess, config, serf_sess->pool));
Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1396147&r1=1396146&r2=1396147&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Tue Oct 9 18:10:55 2012
@@ -1801,9 +1801,9 @@ handle_response(serf_request_t *request,
handler->sline = sl;
handler->sline.reason = apr_pstrdup(handler->handler_pool, sl.reason);
- /* Fall back to HTTP/1.0 needed? */
- if (sl.version == SERF_HTTP_10)
- handler->session->http10 = TRUE;
+ /* HTTP/1.1? (or later) */
+ if (sl.version != SERF_HTTP_10)
+ handler->session->http10 = FALSE;
}
/* Keep reading from the network until we've read all the headers. */
@@ -1914,17 +1914,6 @@ handle_response(serf_request_t *request,
}
}
- /* These error codes might indicate that the server or proxy does not support
- HTTP/1.1 (completely), so fall back to HTTP/1.0. */
- if (handler->session->http10 == FALSE &&
- (handler->sline.code == 400 /* 400 Bad Request */
- || handler->sline.code == 411 /* 411 Length Required */
- || handler->sline.code == 501)) /* 501 Not Implemented */
- {
- handler->discard_body = TRUE;
- handler->session->http10 = TRUE;
- }
-
/* Stop processing the above, on every packet arrival. */
handler->reading_body = TRUE;