Index: subversion/libsvn_ra_serf/options.c =================================================================== --- subversion/libsvn_ra_serf/options.c (revision 1846637) +++ subversion/libsvn_ra_serf/options.c (working copy) @@ -74,6 +74,10 @@ /* Have we received any DAV headers at all? */ svn_boolean_t received_dav_header; + /* ### FIXME: SVN-4789 + Have we received the bespoke GitHub request ID header? */ + svn_boolean_t received_github_request_id_header; + const char *activity_collection; svn_revnum_t youngest_rev; @@ -355,6 +359,22 @@ } } + /* ### FIXME: SVN-4789 + GitHub's Subversion bridge does not set any DAV: headers in its + response, even though it supports bits of our HTTP protocol and + returns a valid response body to an OPTIONS request. We try to work + around that monumental brokenness by checking for this + GitHub-specific response header. + + Note that the case-sensitive string comparison here is intentional; + we do *not* want to support any number of strange hacks, so if + GitHub changes the case of their header name, this becomes their + problem entirely. */ + else if (strcmp(key, "X-GitHub-Request-Id") == 0) + { + opt_ctx->received_github_request_id_header = TRUE; + } + return 0; } @@ -401,18 +421,28 @@ serf_bucket_headers_do(hdrs, capabilities_headers_iterator_callback, opt_ctx); - /* Bail out early if we're not talking to a DAV server. - Note that this check is only valid if we've received a success - response; redirects and errors don't count. */ - if (opt_ctx->handler->sline.code >= 200 - && opt_ctx->handler->sline.code < 300 - && !opt_ctx->received_dav_header) + /* ### FIXME: SVN-4789 */ + if (!opt_ctx->received_github_request_id_header) { - return svn_error_createf - (SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL, - _("The server at '%s' does not support the HTTP/DAV protocol"), - session->session_url_str); + /* Bail out early if we're not talking to a DAV server. Note + that this check is only valid if we've received a success + response; redirects and errors don't count. */ + if (opt_ctx->handler->sline.code >= 200 + && opt_ctx->handler->sline.code < 300 + && !opt_ctx->received_dav_header) + { + return svn_error_createf + (SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL, + _("The server at '%s' does not support the WebDAV protocol"), + session->session_url_str); + } } + else if (!opt_ctx->received_dav_header) + { + /* ### FIXME: SVN-4789 + We really should emit a warning here, there's no API for that. */ + opt_ctx->received_dav_header = TRUE; + } /* Assume mergeinfo capability unsupported, if didn't receive information about server or repository mergeinfo capability. */ Index: subversion/tests/cmdline/dav_tests.py =================================================================== --- subversion/tests/cmdline/dav_tests.py (revision 1846637) +++ subversion/tests/cmdline/dav_tests.py (working copy) @@ -69,12 +69,15 @@ #---------------------------------------------------------------------- -@XFail() +@Issue(4789) @SkipUnless(svntest.main.is_remote_http_connection_allowed) def connect_to_github_server(sbox): "connect to GitHub's SVN bridge" - github_mirror_url = 'https://github.com/apache/subversion/trunk' + # FIXME: For some reason, trying this against Subversion's own mirror + # always results in: 504 Gateway Timeout. + #github_mirror_url = 'https://github.com/apache/subversion/trunk/' + github_mirror_url = 'https://github.com/apache/httpd/trunk/' # Skip this test if we can't connect to the GitHub server. # We check this here instead of in a SkipUnless() predicate decorator,