← Back to team overview

dulwich-users team mailing list archive

[PATCH 13/13] web: Use correct result MIME types.

 

From: Dave Borowitz <dborowitz@xxxxxxxxxx>

We inherited the incorrect type from C git, which has since fixed this
bug. The C git client doesn't actually check the MIME type, but other
clients, such as JGit, may.

For more details, see:
http://repo.or.cz/w/git.git/commitdiff/8efa5f629efb9a8af48619ee90dee02343e0f19d
http://code.google.com/p/support/issues/detail?id=5576

Change-Id: I66f94c59ef85fcc0a79c339b204cdc1798ed797c
---
 NEWS                      |    2 ++
 dulwich/tests/test_web.py |    2 +-
 dulwich/web.py            |    2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 24d4611..7c132ed 100644
--- a/NEWS
+++ b/NEWS
@@ -54,6 +54,8 @@
   * Fix add/add and add/rename conflicts in tree_changes_for_merge.
     (Dave Borowitz)
 
+  * Use correct MIME types in web server. (Dave Borowitz)
+
  API CHANGES
 
   * write_pack no longer takes the num_objects argument and requires an object
diff --git a/dulwich/tests/test_web.py b/dulwich/tests/test_web.py
index 112c875..7d0ed3d 100644
--- a/dulwich/tests/test_web.py
+++ b/dulwich/tests/test_web.py
@@ -316,7 +316,7 @@ class SmartHandlersTestCase(WebTestCase):
         # Ensure all output was written via the write callback.
         self.assertEqual('', handler_output)
         self.assertEqual('handled input: foo', write_output)
-        self.assertContentTypeEquals('application/x-git-upload-pack-response')
+        self.assertContentTypeEquals('application/x-git-upload-pack-result')
         self.assertFalse(self._handler.advertise_refs)
         self.assertTrue(self._handler.http_req)
         self.assertFalse(self._req.cached)
diff --git a/dulwich/web.py b/dulwich/web.py
index 9734b33..19e6e85 100644
--- a/dulwich/web.py
+++ b/dulwich/web.py
@@ -235,7 +235,7 @@ def handle_service_request(req, backend, mat):
         yield req.forbidden('Unsupported service %s' % service)
         return
     req.nocache()
-    write = req.respond(HTTP_OK, 'application/x-%s-response' % service)
+    write = req.respond(HTTP_OK, 'application/x-%s-result' % service)
 
     input = req.environ['wsgi.input']
     # This is not necessary if this app is run from a conforming WSGI server.
-- 
1.7.3.1



References