You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by je...@apache.org on 2012/06/12 23:20:51 UTC
svn commit: r1349545 - /subversion/trunk/subversion/libsvn_ra_serf/util.c
Author: jerenkrantz
Date: Tue Jun 12 21:20:51 2012
New Revision: 1349545
URL: http://svn.apache.org/viewvc?rev=1349545&view=rev
Log:
Fix lock tests #37 & #42 by properly calling our XML error response delegator.
* subversion/libsvn_ra_serf/util.c
(handle_response): Appropriately set up the error callbacks or use our
defaults if there is no XML error response with a friendly message.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/util.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1349545&r1=1349544&r2=1349545&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Tue Jun 12 21:20:51 2012
@@ -1843,28 +1843,43 @@ handle_response(serf_request_t *request,
/* 405 Method Not allowed.
409 Conflict: can indicate a hook error.
5xx (Internal) Server error. */
- /* ### this is completely wrong. it only catches the current network
- ### packet. we need ongoing parsing. see SERVER_ERROR down below
- ### in the process_body: area. we'll eventually move to that. */
- SVN_ERR(handle_server_error(request, response, scratch_pool));
+ serf_bucket_t *hdrs;
+ const char *val;
- if (!handler->session->pending_error)
+ hdrs = serf_bucket_response_get_headers(response);
+ val = serf_bucket_headers_get(hdrs, "Content-Type");
+ if (val && strncasecmp(val, "text/xml", sizeof("text/xml") - 1) == 0)
{
- apr_status_t apr_err = SVN_ERR_RA_DAV_REQUEST_FAILED;
+ svn_ra_serf__server_error_t *server_err;
- /* 405 == Method Not Allowed (Occurs when trying to lock a working
- copy path which no longer exists at HEAD in the repository. */
- if (handler->sline.code == 405
- && strcmp(handler->method, "LOCK") == 0)
- apr_err = SVN_ERR_FS_OUT_OF_DATE;
+ server_err = begin_error_parsing(start_error, end_error, cdata_error,
+ handler->handler_pool);
+ /* Get the parser to set our DONE flag. */
+ server_err->parser.done = &handler->done;
- return svn_error_createf(apr_err, NULL,
- _("%s request on '%s' failed: %d %s"),
+ handler->server_error = server_err;
+ }
+ else
+ {
+ handler->discard_body = TRUE;
+
+ if (!handler->session->pending_error)
+ {
+ apr_status_t apr_err = SVN_ERR_RA_DAV_REQUEST_FAILED;
+
+ /* 405 == Method Not Allowed (Occurs when trying to lock a working
+ copy path which no longer exists at HEAD in the repository. */
+ if (handler->sline.code == 405
+ && strcmp(handler->method, "LOCK") == 0)
+ apr_err = SVN_ERR_FS_OUT_OF_DATE;
+
+ handler->session->pending_error =
+ svn_error_createf(apr_err, NULL,
+ _("%s request on '%s' failed: %d %s"),
handler->method, handler->path,
handler->sline.code, handler->sline.reason);
+ }
}
-
- return SVN_NO_ERROR; /* Error is set in caller */
}
/* Stop processing the above, on every packet arrival. */
Re: svn commit: r1349545 - /subversion/trunk/subversion/libsvn_ra_serf/util.c
Posted by Justin Erenkrantz <je...@apache.org>.
On Wed, Jun 13, 2012 at 2:14 AM, Johan Corveleyn <jc...@gmail.com> wrote:
> So maybe we can take another look at this tomorrow (unless someone
> else fixes it first of course :-)).
It happens here on my Mac too - should be fixed in r1349651. Thanks! -- justin
Re: svn commit: r1349545 - /subversion/trunk/subversion/libsvn_ra_serf/util.c
Posted by Johan Corveleyn <jc...@gmail.com>.
On Tue, Jun 12, 2012 at 11:20 PM, <je...@apache.org> wrote:
> Author: jerenkrantz
> Date: Tue Jun 12 21:20:51 2012
> New Revision: 1349545
>
> URL: http://svn.apache.org/viewvc?rev=1349545&view=rev
> Log:
> Fix lock tests #37 & #42 by properly calling our XML error response delegator.
>
> * subversion/libsvn_ra_serf/util.c
> (handle_response): Appropriately set up the error callbacks or use our
> defaults if there is no XML error response with a friendly message.
>
> Modified:
> subversion/trunk/subversion/libsvn_ra_serf/util.c
>
> Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1349545&r1=1349544&r2=1349545&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
> +++ subversion/trunk/subversion/libsvn_ra_serf/util.c Tue Jun 12 21:20:51 2012
> @@ -1843,28 +1843,43 @@ handle_response(serf_request_t *request,
> /* 405 Method Not allowed.
> 409 Conflict: can indicate a hook error.
> 5xx (Internal) Server error. */
> - /* ### this is completely wrong. it only catches the current network
> - ### packet. we need ongoing parsing. see SERVER_ERROR down below
> - ### in the process_body: area. we'll eventually move to that. */
> - SVN_ERR(handle_server_error(request, response, scratch_pool));
> + serf_bucket_t *hdrs;
> + const char *val;
>
> - if (!handler->session->pending_error)
> + hdrs = serf_bucket_response_get_headers(response);
> + val = serf_bucket_headers_get(hdrs, "Content-Type");
> + if (val && strncasecmp(val, "text/xml", sizeof("text/xml") - 1) == 0)
> {
> - apr_status_t apr_err = SVN_ERR_RA_DAV_REQUEST_FAILED;
> + svn_ra_serf__server_error_t *server_err;
>
> - /* 405 == Method Not Allowed (Occurs when trying to lock a working
> - copy path which no longer exists at HEAD in the repository. */
> - if (handler->sline.code == 405
> - && strcmp(handler->method, "LOCK") == 0)
> - apr_err = SVN_ERR_FS_OUT_OF_DATE;
> + server_err = begin_error_parsing(start_error, end_error, cdata_error,
> + handler->handler_pool);
> + /* Get the parser to set our DONE flag. */
> + server_err->parser.done = &handler->done;
>
> - return svn_error_createf(apr_err, NULL,
> - _("%s request on '%s' failed: %d %s"),
> + handler->server_error = server_err;
> + }
> + else
> + {
> + handler->discard_body = TRUE;
> +
> + if (!handler->session->pending_error)
> + {
> + apr_status_t apr_err = SVN_ERR_RA_DAV_REQUEST_FAILED;
> +
> + /* 405 == Method Not Allowed (Occurs when trying to lock a working
> + copy path which no longer exists at HEAD in the repository. */
> + if (handler->sline.code == 405
> + && strcmp(handler->method, "LOCK") == 0)
> + apr_err = SVN_ERR_FS_OUT_OF_DATE;
> +
> + handler->session->pending_error =
> + svn_error_createf(apr_err, NULL,
> + _("%s request on '%s' failed: %d %s"),
> handler->method, handler->path,
> handler->sline.code, handler->sline.reason);
> + }
> }
> -
> - return SVN_NO_ERROR; /* Error is set in caller */
> }
>
> /* Stop processing the above, on every packet arrival. */
This fixes those lock tests, but apparently causes authz_tests.py#13
("authz issue #2712") to go into an infinite loop (pegging a cpu).
This happens with and without SurfShield, and I think the
svn-slik-w2k3-x64-ra buildbot is seeing it too.
I can reproduce this from my debugger by executing the last command
from that test:
svn.exe switch http://localhost/svn-test-work/local_tmp/repos/A/B/E
svn-test-work\working_copies\authz_tests-14\A\D\G --ignore-ancestry
--config-dir R:\test\subversion\tests\cmdline\svn-test-work\local_tmp\config
--password rayjandom --no-auth-cache --username jrandom
So maybe we can take another look at this tomorrow (unless someone
else fixes it first of course :-)).
--
Johan