subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phi...@apache.org
Subject svn commit: r1489526 - /subversion/trunk/subversion/libsvn_ra_serf/locks.c
Date Tue, 04 Jun 2013 17:21:03 GMT
Author: philip
Date: Tue Jun  4 17:20:57 2013
New Revision: 1489526

URL: http://svn.apache.org/r1489526
Log:
Avoid dropping errors when handling locking requests over serf.  I
don't know whether a standard server will ever trigger the code path
that drops the error but it's simple for a modified server to return
an error, 412 for example, that gets dropped.

* subversion/libsvn_ra_serf/locks.c
  (determine_error): Check status line if err is not set, check
   reason string is not null.
  (svn_ra_serf__get_lock, svn_ra_serf__lock): Add tracing.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/locks.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/locks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/locks.c?rev=1489526&r1=1489525&r2=1489526&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/locks.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/locks.c Tue Jun  4 17:20:57 2013
@@ -214,29 +214,26 @@ static svn_error_t *
 determine_error(svn_ra_serf__handler_t *handler,
                 svn_error_t *err)
 {
-    {
-      apr_status_t errcode;
+  apr_status_t errcode;
 
-      if (handler->sline.code == 423)
-        errcode = SVN_ERR_FS_PATH_ALREADY_LOCKED;
-      else if (handler->sline.code == 403)
-        errcode = SVN_ERR_RA_DAV_FORBIDDEN;
-      else
-        return err;
-
-      /* Client-side or server-side error already. Return it.  */
-      if (err != NULL)
-        return err;
-
-      /* The server did not send us a detailed human-readable error.
-         Provide a generic error.  */
-      err = svn_error_createf(errcode, NULL,
-                              _("Lock request failed: %d %s"),
-                              handler->sline.code,
-                              handler->sline.reason);
-    }
+  if (err)
+    return err;
 
-  return err;
+  if (handler->sline.code == 200 || handler->sline.code == 207)
+    return SVN_NO_ERROR;
+  else if (handler->sline.code == 423)
+    errcode = SVN_ERR_FS_PATH_ALREADY_LOCKED;
+  else if (handler->sline.code == 403)
+    errcode = SVN_ERR_RA_DAV_FORBIDDEN;
+  else
+    errcode = SVN_ERR_RA_DAV_REQUEST_FAILED;
+
+  /* The server did not send us a detailed human-readable error.
+     Provide a generic error.  */
+  return svn_error_createf(errcode, NULL,
+                           _("Lock request failed: %d %s"),
+                           handler->sline.code,
+                           handler->sline.reason ? handler->sline.reason : "");
 }
 
 
@@ -406,7 +403,7 @@ svn_ra_serf__get_lock(svn_ra_session_t *
   lock_ctx->handler = handler;
 
   err = svn_ra_serf__context_run_one(handler, pool);
-  err = determine_error(handler, err);
+  err = svn_error_trace(determine_error(handler, err));
 
   if (handler->sline.code == 404)
     {
@@ -497,7 +494,7 @@ svn_ra_serf__lock(svn_ra_session_t *ra_s
       lock_ctx->handler = handler;
 
       err = svn_ra_serf__context_run_one(handler, iterpool);
-      err = determine_error(handler, err);
+      err = svn_error_trace(determine_error(handler, err));
 
       if (lock_func)
         new_err = lock_func(lock_baton, lock_ctx->path, TRUE, lock_ctx->lock,



Mime
View raw message