You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/11/25 14:34:53 UTC

svn commit: r1716400 - in /subversion/trunk/subversion/libsvn_ra_serf: ra_serf.h replay.c serf.c util.c

Author: rhuijben
Date: Wed Nov 25 13:34:52 2015
New Revision: 1716400

URL: http://svn.apache.org/viewvc?rev=1716400&view=rev
Log:
Apply some minor tweaks to libsvn_ra_serf to handle some http/2 cases.

This reduces the number of testfailures to 3 or 5 for me when running
the tests over http/2 with a slightly patched serf trunk.
(2 tests that rely on the http reason text.
 2 tests that somehow hit an httpd limit
 And one segfault/abort in serf triggered by a svnmover test)

* subversion/libsvn_ra_serf/ra_serf.h
  (svn_ra_serf__session_t): Add boolean.

* subversion/libsvn_ra_serf/replay.c
  (svn_ra_serf__replay_range): Implement api for http/2.0 by not implementing
    it. See comment.

* subversion/libsvn_ra_serf/serf.c
  (svn_ra_serf__open): Initialize new var.
  (ra_serf_dup_session): Document that we dup a variable.

* subversion/libsvn_ra_serf/util.c
  (conn_negotiate_protocol): Tweak a few more vars.
  (handle_response): Also detect 2.0

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
    subversion/trunk/subversion/libsvn_ra_serf/replay.c
    subversion/trunk/subversion/libsvn_ra_serf/serf.c
    subversion/trunk/subversion/libsvn_ra_serf/util.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1716400&r1=1716399&r2=1716400&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Wed Nov 25 13:34:52 2015
@@ -137,6 +137,10 @@ struct svn_ra_serf__session_t {
      HTTP/1.0. Thus, we cannot send chunked requests.  */
   svn_boolean_t http10;
 
+  /* We are talking to the server via http/2. Responses of scheduled
+     requests may come in any order */
+  svn_boolean_t http20;
+
   /* Should we use Transfer-Encoding: chunked for HTTP/1.1 servers. */
   svn_boolean_t using_chunked_requests;
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/replay.c?rev=1716400&r1=1716399&r2=1716400&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/replay.c Wed Nov 25 13:34:52 2015
@@ -649,6 +649,24 @@ svn_ra_serf__replay_range(svn_ra_session
   svn_boolean_t done;
   apr_pool_t *subpool = svn_pool_create(scratch_pool);
 
+  if (session->http20) {
+      /* ### Auch... this doesn't work yet... 
+
+         This code relies on responses coming in in an exact order, while
+         http2 does everything to deliver responses as fast as possible.
+
+         With http/1.1 we were quite lucky that this worked, as serf doesn't
+         promise in order delivery.... (Please do not use authz with keys
+         that expire)
+
+         For now fall back to the legacy callback in libsvn_ra that is
+         used by all the other ra layers as workaround.
+
+         ### TODO: Optimize
+         */
+      return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL);
+  }
+
   SVN_ERR(svn_ra_serf__report_resource(&report_target, session,
                                        subpool));
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1716400&r1=1716399&r2=1716400&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Wed Nov 25 13:34:52 2015
@@ -530,6 +530,7 @@ svn_ra_serf__open(svn_ra_session_t *sess
   /* 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;
+  serf_sess->http20 = FALSE;
 
   /* If we switch to HTTP/1.1, then we will use chunked requests. We may disable
      this, if we find an intervening proxy does not support chunked requests.  */
@@ -636,6 +637,7 @@ ra_serf_dup_session(svn_ra_session_t *ne
   /* using_ssl */
   /* using_compression */
   /* http10 */
+  /* http20 */
   /* using_chunked_requests */
   /* detect_chunking */
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1716400&r1=1716399&r2=1716400&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Wed Nov 25 13:34:52 2015
@@ -496,7 +496,9 @@ conn_negotiate_protocol(void *data,
 
       /* Disable generating content-length headers. */
       conn->session->http10 = FALSE;
+      conn->session->http20 = TRUE;
       conn->session->using_chunked_requests = TRUE;
+      conn->session->detect_chunking = FALSE;
     }
   else
     {
@@ -1335,6 +1337,10 @@ handle_response(serf_request_t *request,
       /* HTTP/1.1? (or later)  */
       if (sl.version != SERF_HTTP_10)
         handler->session->http10 = FALSE;
+
+      if (sl.version >= SERF_HTTP_VERSION(2, 0)) {
+        handler->session->http20 = TRUE;
+      }
     }
 
   /* Keep reading from the network until we've read all the headers.  */