[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: svn commit: r982780 - in /subversion/branches/issue-2779-dev/subversion: libsvn_ra_neon/ libsvn_ra_serf/ tests/cmdline/ tests/cmdline/svntest/

From: Bert Huijben <bert_at_qqmail.nl>
Date: Thu, 5 Aug 2010 23:34:23 +0200

> -----Original Message-----
> From: cmpilato_at_apache.org [mailto:cmpilato_at_apache.org]
> Sent: donderdag 5 augustus 2010 22:53
> To: commits_at_subversion.apache.org
> Subject: svn commit: r982780 - in /subversion/branches/issue-2779-
> dev/subversion: libsvn_ra_neon/ libsvn_ra_serf/ tests/cmdline/
> tests/cmdline/svntest/
>
> Author: cmpilato
> Date: Thu Aug 5 20:52:33 2010
> New Revision: 982780
>
> URL: http://svn.apache.org/viewvc?rev=982780&view=rev
> Log:
> On the issue-2779-dev branch: Per dev@ list discussion Now only
> recognize HTTP status 301 as a redirect worthy of automatic handling.
> But also treat an HTTP 307 status code in the same way that 302 is
> treated (with a message back to the user that the repository has been
> temporarily relocated).
>
> * subversion/libsvn_ra_neon/ra_neon.h,
> * subversion/libsvn_ra_neon/util.c
> (svn_ra_neon__request_dispatch): Lose now-unused 'okay_3'
> parameter. Callers updated.
> (generate_error): Also treat HTTP status 307 as a temporary
> redirect.
>
> * subversion/libsvn_ra_neon/commit.c,
> * subversion/libsvn_ra_neon/fetch.c,
> * subversion/libsvn_ra_neon/lock.c
> Update callers of svn_ra_neon__request_dispatch().
>
> * subversion/libsvn_ra_neon/options.c
> (svn_ra_neon__exchange_capabilities): Update call to
> svn_ra_neon__request_dispatch(), and now only specially handle 301
> status codes.
>
> * subversion/libsvn_ra_serf/options.c
> (svn_ra_serf__exchange_capabilities): Don't check for the 302 error
> code any more -- only 301.
>
> * subversion/libsvn_ra_serf/util.c
> (svn_ra_serf__handle_xml_parser, svn_ra_serf__error_on_status): Also
> treat HTTP status 307 as a temporary redirect.
>
> * subversion/tests/cmdline/README
> Update required httpd.conf configuration.
>
> * subversion/tests/cmdline/svntest/sandbox.py
> (Sandbox.redirected_root_url): Add 'temporary' parameter and
> handling. Update return URL format.
>
> Modified:
> subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/commit.c
> subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/fetch.c
> subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/lock.c
> subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/options.c
> subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/ra_neon.h
> subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/util.c
> subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_serf/options.c
> subversion/branches/issue-2779-dev/subversion/libsvn_ra_serf/util.c
> subversion/branches/issue-2779-dev/subversion/tests/cmdline/README
> subversion/branches/issue-2779-
> dev/subversion/tests/cmdline/svntest/sandbox.py
>
> Modified: subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/commit.c
> URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/commit.c?rev=982780&r1=982779&r2=982780&v
> iew=diff
> =======================================================================
> =======
> --- subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/commit.c (original)
> +++ subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/commit.c Thu Aug 5 20:52:33 2010
> @@ -440,7 +440,6 @@ static svn_error_t * do_checkout(commit_
> err = svn_ra_neon__request_dispatch(code, request, extra_headers,
> body,
> 201 /* Created */,
> allow_404 ? 404 /* Not Found */
> : 0,
> - 0,
> pool);
> if (err)
> goto cleanup;
> @@ -824,7 +823,6 @@ static svn_error_t * commit_delete_entry
> err = svn_ra_neon__request_dispatch(&code, request, NULL, body,
> 204 /* Created */,
> 404 /* Not Found */,
> - 0,
> pool);
> cleanup:
> svn_ra_neon__request_destroy(request);
> @@ -1318,7 +1316,6 @@ static svn_error_t * commit_close_file(v
> err = svn_ra_neon__request_dispatch(NULL, request,
> extra_headers, NULL,
> 201 /* Created */,
> 204 /* No Content */,
> - 0,
> pool);
> cleanup:
> svn_ra_neon__request_destroy(request);
>
> Modified: subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/fetch.c
> URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/fetch.c?rev=982780&r1=982779&r2=982780&vi
> ew=diff
> =======================================================================
> =======
> --- subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/fetch.c (original)
> +++ subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/fetch.c Thu Aug 5 20:52:33 2010
> @@ -420,7 +420,6 @@ static svn_error_t *custom_get_request(s
> err = svn_ra_neon__request_dispatch(NULL, request, NULL, NULL,
> 200 /* OK */,
> 226 /* IM Used */,
> - 0,
> pool);
> svn_ra_neon__request_destroy(request);
>
>
> Modified: subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/lock.c
> URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/lock.c?rev=982780&r1=982779&r2=982780&vie
> w=diff
> =======================================================================
> =======
> --- subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/lock.c
> (original)
> +++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/lock.c
> Thu Aug 5 20:52:33 2010
> @@ -296,7 +296,7 @@ do_lock(svn_lock_t **lock,
> apr_psprintf(req->pool, "%ld",
> current_rev));
>
> err = svn_ra_neon__request_dispatch(&code, req, extra_headers, body-
> >data,
> - 200, 0, 0, pool);
> + 200, 0, pool);
> if (err)
> goto cleanup;
>
> @@ -545,7 +545,7 @@ svn_ra_neon__get_lock_internal(svn_ra_ne
> "text/xml; charset=\"utf-8\"");
>
> err = svn_ra_neon__request_dispatch(NULL, req, extra_headers, body,
> - 200, 207, 0, pool);
> + 200, 207, pool);
> if (err)
> {
> err = svn_error_quick_wrap(err, _("Failed to fetch lock
> information"));
>
> Modified: subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/options.c
> URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/options.c?rev=982780&r1=982779&r2=982780&
> view=diff
> =======================================================================
> =======
> --- subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/options.c (original)
> +++ subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/options.c Thu Aug 5 20:52:33 2010
> @@ -285,11 +285,10 @@ svn_ra_neon__exchange_capabilities(svn_r
> "</D:options>",
> 200,
> relocation_location ? 301 :
> 0,
> - relocation_location ? 302 :
> 0,
> pool)))
> goto cleanup;
>
> - if ((req->code == 301) || (req->code == 302))
> + if (req->code == 301)
> {
> *relocation_location = svn_ra_neon__request_get_location(req,
> pool);
> goto cleanup;
>
> Modified: subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/ra_neon.h
> URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/ra_neon.h?rev=982780&r1=982779&r2=982780&
> view=diff
> =======================================================================
> =======
> --- subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/ra_neon.h (original)
> +++ subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/ra_neon.h Thu Aug 5 20:52:33 2010
> @@ -942,10 +942,10 @@ svn_ra_neon__maybe_store_auth_info_after
> NULL, as this will cause Neon to generate a "Content-Length: 0"
> header (which is important to some proxies).
>
> - OKAY_1, OKAY_2, and OKAY_3 are the "acceptable" result codes.
> - Anything other than one of these will generate an error. OKAY_1
> - should always be specified (e.g. as 200); use 0 for OKAY_2 and/or
> - OKAY_3 if additional result codes aren't allowed. */
> + OKAY_1 and OKAY_2 are the "acceptable" result codes. Anything
> + other than one of these will generate an error. OKAY_1 should
> + always be specified (e.g. as 200); use 0 for OKAY_2 if additional
> + result codes aren't allowed. */
> svn_error_t *
> svn_ra_neon__request_dispatch(int *code_p,
> svn_ra_neon__request_t *request,
> @@ -953,7 +953,6 @@ svn_ra_neon__request_dispatch(int *code_
> const char *body,
> int okay_1,
> int okay_2,
> - int okay_3,
> apr_pool_t *pool);
>
> /* A layer over SVN_RA_NEON__REQUEST_DISPATCH() adding a
> @@ -969,8 +968,9 @@ svn_ra_neon__simple_request(int *code,
> const char *url,
> apr_hash_t *extra_headers,
> const char *body,
> - int okay_1, int okay_2, apr_pool_t *pool);
> -
> + int okay_1,
> + int okay_2,
> + apr_pool_t *pool);
>
> /* Convenience statement macro for setting headers in a hash */
> #define svn_ra_neon__set_header(hash, hdr, val) \
>
> Modified: subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/util.c
> URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_neon/util.c?rev=982780&r1=982779&r2=982780&vie
> w=diff
> =======================================================================
> =======
> --- subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/util.c
> (original)
> +++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_neon/util.c
> Thu Aug 5 20:52:33 2010
> @@ -558,6 +558,7 @@ generate_error(svn_ra_neon__request_t *r
>
> case 301:
> case 302:
> + case 307:
> return svn_error_create
> (SVN_ERR_RA_DAV_RELOCATED, NULL,
> apr_psprintf(pool,
> @@ -1259,13 +1260,10 @@ parsed_request(svn_ra_neon__request_t *r
> success_parser,
> pool));
>
> /* run the request and get the resulting status code. */
> - SVN_ERR(svn_ra_neon__request_dispatch(status_code,
> - req, extra_headers, body,
> - (strcmp(method, "PROPFIND") ==
> 0)
> - ? 207 : 200,
> - 0, /* not used */
> - 0, /* not used */
> - pool));
> + SVN_ERR(svn_ra_neon__request_dispatch(
> + status_code, req, extra_headers, body,
> + (strcmp(method, "PROPFIND") == 0) ? 207 : 200,
> + 0, pool));
>
> if (spool_response)
> {
> @@ -1344,7 +1342,7 @@ svn_ra_neon__simple_request(int *code,
> reader. Neon will take care of the Content-Length calculation */
> err = svn_ra_neon__request_dispatch(code, req, extra_headers,
> body ? body : "",
> - okay_1, okay_2, 0, pool);
> + okay_1, okay_2, pool);
> svn_ra_neon__request_destroy(req);
>
> return err;
> @@ -1430,7 +1428,6 @@ svn_ra_neon__request_dispatch(int *code_
> const char *body,
> int okay_1,
> int okay_2,
> - int okay_3,
> apr_pool_t *pool)
> {
> ne_xml_parser *error_parser;
> @@ -1493,9 +1490,7 @@ svn_ra_neon__request_dispatch(int *code_
>
> /* If the status code was one of the two that we expected, then go
> ahead and return now. IGNORE any marshalled error. */
> - if (req->rv == NE_OK && (req->code == okay_1
> - || req->code == okay_2
> - || req->code == okay_3))
> + if (req->rv == NE_OK && (req->code == okay_1 || req->code ==
> okay_2))
> return SVN_NO_ERROR;
>
> /* Any other errors? Report them */
>
> Modified: subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_serf/options.c
> URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_serf/options.c?rev=982780&r1=982779&r2=982780&
> view=diff
> =======================================================================
> =======
> --- subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_serf/options.c (original)
> +++ subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_serf/options.c Thu Aug 5 20:52:33 2010
> @@ -493,8 +493,7 @@ svn_ra_serf__exchange_capabilities(svn_r
> carries such a thing, report as much. We'll disregard ERR --
> it's most likely just a complaint about the response body not
> successfully parsing as XML or somesuch. */
> - if (corrected_url && ((opt_ctx->status_code == 301) ||
> - (opt_ctx->status_code == 302)))
> + if (corrected_url && (opt_ctx->status_code == 301))
> {
> svn_error_clear(err);
> *corrected_url = opt_ctx->parser_ctx->location;
>
> Modified: subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_serf/util.c
> URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-
> dev/subversion/libsvn_ra_serf/util.c?rev=982780&r1=982779&r2=982780&vie
> w=diff
> =======================================================================
> =======
> --- subversion/branches/issue-2779-dev/subversion/libsvn_ra_serf/util.c
> (original)
> +++ subversion/branches/issue-2779-dev/subversion/libsvn_ra_serf/util.c
> Thu Aug 5 20:52:33 2010
> @@ -1169,7 +1169,7 @@ svn_ra_serf__handle_xml_parser(serf_requ
> *ctx->status_code = sl.code;
> }
>
> - if (sl.code == 301 || sl.code == 302)
> + if (sl.code == 301 || sl.code == 302 || sl.code == 307)
> {
> ctx->location = svn_ra_serf__response_get_location(response,
> pool);
> }
> @@ -1418,13 +1418,22 @@ handle_response(serf_request_t *request,
>
> /* Cases where a lack of a response body (via EOF) is okay:
> * - A HEAD request
> - * - 204/304 response
> + * - responses with the following status codes:
> + * 204, 301, 302, 304, 307, 401, 407
> *
> * Otherwise, if we get an EOF here, something went really
> wrong: either
> * the server closed on us early or we're reading too much.
> Either way,
> * scream loudly.
> */
> - if (strcmp(ctx->method, "HEAD") != 0 && sl.code != 204 &&
> sl.code != 304)
> + if (strcmp(ctx->method, "HEAD") != 0
> + && sl.code != 204
> + && sl.code != 301
> + && sl.code != 302
> + && sl.code != 304
> + && sl.code != 307
> + && sl.code != 401
> + && sl.code != 407
> + )

I don't think you have to add all these errors here unless you miss r982761 (The serf 0.3.1 fix), which made these errors get to far.

Most of these HTTP status codes should really have a body.

        Bert
Received on 2010-08-05 23:35:16 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.