subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svn-r...@apache.org
Subject svn commit: r1515699 - in /subversion/branches/1.8.x: ./ STATUS subversion/libsvn_ra_serf/ra_serf.h subversion/libsvn_ra_serf/util.c
Date Tue, 20 Aug 2013 04:00:50 GMT
Author: svn-role
Date: Tue Aug 20 04:00:49 2013
New Revision: 1515699

URL: http://svn.apache.org/r1515699
Log:
Merge r1503318 from trunk:

 * r1503318
   ra_serf: Do not retry HTTP requests if we started to parse them.
   Discussion: http://svn.haxx.se/dev/archive-2013-07/0290.shtml
   Justification:
      There is absolutely no guarantee that REPORT or PROPFIND responses will
      be equal for every request. Before r1503318 after request we skipped
      recieved N bytes of original request response and continue with
      remaining bytes from retried request. 
   Votes:
     +1: ivan, rhuijben, philip
     +0: danielsh

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/libsvn_ra_serf/ra_serf.h
    subversion/branches/1.8.x/subversion/libsvn_ra_serf/util.c

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1503318

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1515699&r1=1515698&r2=1515699&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Tue Aug 20 04:00:49 2013
@@ -220,18 +220,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1503318
-   ra_serf: Do not retry HTTP requests if we started to parse them.
-   Discussion: http://svn.haxx.se/dev/archive-2013-07/0290.shtml
-   Justification:
-      There is absolutely no guarantee that REPORT or PROPFIND responses will
-      be equal for every request. Before r1503318 after request we skipped
-      recieved N bytes of original request response and continue with
-      remaining bytes from retried request. 
-   Votes:
-     +1: ivan, rhuijben, philip
-     +0: danielsh
-
  * r1514785, r1515201
    ra_serf: Improve SSL certificate verification failure message.
    Justification:

Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/ra_serf.h?rev=1515699&r1=1515698&r2=1515699&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/ra_serf.h Tue Aug 20 04:00:49 2013
@@ -651,11 +651,6 @@ struct svn_ra_serf__xml_parser_t {
 
      See libsvn_ra_serf/util.c  */
   struct svn_ra_serf__pending_t *pending;
-
-  /* Response restart support */
-  const void *headers_baton; /* Last pointer to headers */
-  apr_off_t skip_size; /* Number of bytes to skip */
-  apr_off_t read_size; /* Number of bytes read from response */
 };
 
 

Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/util.c?rev=1515699&r1=1515698&r2=1515699&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/util.c Tue Aug 20 04:00:49 2013
@@ -1631,22 +1631,6 @@ svn_ra_serf__handle_xml_parser(serf_requ
       return svn_error_trace(err);
     }
 
-  if (ctx->headers_baton == NULL)
-    ctx->headers_baton = serf_bucket_response_get_headers(response);
-  else if (ctx->headers_baton != serf_bucket_response_get_headers(response))
-    {
-      /* We got a new response to an existing parser...
-         This tells us the connection has restarted and we should continue
-         where we stopped last time.
-       */
-
-      /* Is this a second attempt?? */
-      if (!ctx->skip_size)
-        ctx->skip_size = ctx->read_size;
-
-      ctx->read_size = 0; /* New request, nothing read */
-    }
-
   if (!ctx->xmlp)
     {
       ctx->xmlp = XML_ParserCreate(NULL);
@@ -1666,41 +1650,11 @@ svn_ra_serf__handle_xml_parser(serf_requ
       apr_size_t len;
 
       status = serf_bucket_read(response, PARSE_CHUNK_SIZE, &data, &len);
-
       if (SERF_BUCKET_READ_ERROR(status))
         {
           return svn_ra_serf__wrap_err(status, NULL);
         }
 
-      ctx->read_size += len;
-
-      if (ctx->skip_size)
-        {
-          /* Handle restarted requests correctly: Skip what we already read */
-          apr_size_t skip;
-
-          if (ctx->skip_size >= ctx->read_size)
-            {
-            /* Eek.  What did the file shrink or something? */
-              if (APR_STATUS_IS_EOF(status))
-                {
-                  SVN_ERR_MALFUNCTION();
-                }
-
-              /* Skip on to the next iteration of this loop. */
-              if (APR_STATUS_IS_EAGAIN(status))
-                {
-                  return svn_ra_serf__wrap_err(status, NULL);
-                }
-              continue;
-            }
-
-          skip = (apr_size_t)(len - (ctx->read_size - ctx->skip_size));
-          data += skip;
-          len -= skip;
-          ctx->skip_size = 0;
-        }
-
       /* Note: once the callbacks invoked by inject_to_parser() sets the
          PAUSED flag, then it will not be cleared. write_to_pending() will
          only save the content. Logic outside of serf_context_run() will
@@ -1871,12 +1825,26 @@ handle_response(serf_request_t *request,
     {
       /* Uh-oh. Our connection died.  */
       if (handler->response_error)
-        SVN_ERR(handler->response_error(request, response, 0,
-                                        handler->response_error_baton));
-
-      /* Requeue another request for this handler.
-         ### how do we know if the handler can deal with this?!  */
-      svn_ra_serf__request_create(handler);
+        {
+          /* Give a handler chance to prevent request requeue. */
+          SVN_ERR(handler->response_error(request, response, 0,
+                                          handler->response_error_baton));
+
+          svn_ra_serf__request_create(handler);
+        }
+      /* Response error callback is not configured. Requeue another request
+         for this handler only if we didn't started to process body.
+         Return error otherwise. */
+      else if (!handler->reading_body)
+        {
+          svn_ra_serf__request_create(handler);
+        }
+      else
+        {
+          return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
+                                    _("%s request on '%s' failed"),
+                                   handler->method, handler->path);
+        }
 
       return SVN_NO_ERROR;
     }



Mime
View raw message