subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1672372 - in /subversion/trunk/subversion: libsvn_ra_serf/util.c tests/cmdline/commit_tests.py
Date Thu, 09 Apr 2015 14:49:36 GMT
Author: rhuijben
Date: Thu Apr  9 14:49:35 2015
New Revision: 1672372

URL: http://svn.apache.org/r1672372
Log:
Stop trying to process the results of a PUT request during commit
as an error just because it happens to have a content type 'text/xml'.

(I'm still trying to find out why it has this header, but it is
 certainly not an error case for our client)

* subversion/libsvn_ra_serf/util.c
  (svn_ra_serf__expect_empty_body): Stop trying to parse the bodies of requests of
    success results as a server generated error.

* subversion/tests/cmdline/commit_tests.py
  (commit_xml): New test.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/util.c
    subversion/trunk/subversion/tests/cmdline/commit_tests.py

Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1672372&r1=1672371&r2=1672372&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Thu Apr  9 14:49:35 2015
@@ -1107,7 +1107,9 @@ svn_ra_serf__expect_empty_body(serf_requ
 
   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)
+  if (val
+      && (handler->sline.code < 200 || handler->sline.code >= 300)
+      && strncasecmp(val, "text/xml", sizeof("text/xml") - 1) == 0)
     {
       svn_ra_serf__server_error_t *server_err;
 
@@ -1120,7 +1122,7 @@ svn_ra_serf__expect_empty_body(serf_requ
     }
   else
     {
-      /* The body was not text/xml, so we don't know what to do with it.
+      /* The body was not text/xml, or we got a success code.
          Toss anything that arrives.  */
       handler->discard_body = TRUE;
     }

Modified: subversion/trunk/subversion/tests/cmdline/commit_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/commit_tests.py?rev=1672372&r1=1672371&r2=1672372&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/commit_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/commit_tests.py Thu Apr  9 14:49:35 2015
@@ -3087,6 +3087,32 @@ def mkdir_conflict_proper_error(sbox):
                                      'mkdir', repo_url + '/A',
                                      '-m', '')
 
+def commit_xml(sbox):
+  "commit an xml file"
+
+  sbox.build()
+
+  sbox.simple_add_text('index.xml', 'index.xml')
+  sbox.simple_add_text('index.html', 'index.html')
+  sbox.simple_propset('svn:mime-type', 'text/xml', 'index.xml')
+  sbox.simple_propset('svn:mime-type', 'text/html', 'index.xml')
+
+  # This currently (2015-04-09) makes mod_dav return a 'HTTP/1.1 201 Created'
+  # result with content type text/xml (copied from file), which used to
+  # invoke the error parsing.
+  #
+  # Depending on the Apache version and config, this may cause an xml error.
+  sbox.simple_commit()
+
+  # This currently (2015-04-09) makes mod_dav return a 'HTTP/1.1 204 Updated'
+  # result with content type text/xml (copied from file), which used to
+  # invoke the error parsing.
+  #
+  # Depending on the Apache version and config, this may cause an xml error.
+  sbox.simple_append('index.xml', '<Q></R>', True)
+  sbox.simple_append('index.html', '<Q></R>', True)
+  sbox.simple_commit()
+
 ########################################################################
 # Run the tests
 
@@ -3163,6 +3189,7 @@ test_list = [ None,
               commit_deep_deleted,
               commit_mergeinfo_ood,
               mkdir_conflict_proper_error,
+              commit_xml,
              ]
 
 if __name__ == '__main__':



Mime
View raw message