Rev 5515: Correctly set the Content-Type header when POSTing. in file:///home/vila/src/bzr/bugs/665100-content-type/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Sat Oct 23 09:27:11 BST 2010
At file:///home/vila/src/bzr/bugs/665100-content-type/
------------------------------------------------------------
revno: 5515
revision-id: v.ladeuil+lp at free.fr-20101023082711-40j4jawodrrnjza6
parent: pqm at pqm.ubuntu.com-20101022181024-0xj4kn2fc8s1cr3r
fixes bug(s): https://launchpad.net/bugs/665100
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 665100-content-type
timestamp: Sat 2010-10-23 10:27:11 +0200
message:
Correctly set the Content-Type header when POSTing.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py 2010-10-18 10:01:47 +0000
+++ b/bzrlib/tests/test_http.py 2010-10-23 08:27:11 +0000
@@ -507,6 +507,8 @@
self.assertTrue(
server.received_bytes.startswith('POST /.bzr/smart HTTP/1.'))
self.assertTrue('content-length: 19\r' in server.received_bytes.lower())
+ self.assertTrue('content-type: application/octet-stream\r'
+ in server.received_bytes.lower())
# The transport should not be assuming that the server can accept
# chunked encoding the first time it connects, because HTTP/1.1, so we
# check for the literal string.
=== modified file 'bzrlib/transport/http/_pycurl.py'
--- a/bzrlib/transport/http/_pycurl.py 2010-10-08 04:38:25 +0000
+++ b/bzrlib/transport/http/_pycurl.py 2010-10-23 08:27:11 +0000
@@ -268,7 +268,9 @@
# We override the Expect: header so that pycurl will send the POST
# body immediately.
try:
- self._curl_perform(curl, header, ['Expect: '])
+ self._curl_perform(curl, header,
+ ['Expect: ',
+ 'Content-Type: application/octet-stream'])
except pycurl.error, e:
if e[0] == CURLE_SEND_ERROR:
# When talking to an HTTP/1.0 server, getting a 400+ error code
=== modified file 'bzrlib/transport/http/_urllib.py'
--- a/bzrlib/transport/http/_urllib.py 2010-06-01 13:01:20 +0000
+++ b/bzrlib/transport/http/_urllib.py 2010-10-23 08:27:11 +0000
@@ -138,8 +138,10 @@
abspath = self._remote_path('.bzr/smart')
# We include 403 in accepted_errors so that send_http_smart_request can
# handle a 403. Otherwise a 403 causes an unhandled TransportError.
- response = self._perform(Request('POST', abspath, body_bytes,
- accepted_errors=[200, 403]))
+ response = self._perform(
+ Request('POST', abspath, body_bytes,
+ {'Content-Type': 'application/octet-stream'},
+ accepted_errors=[200, 403]))
code = response.code
data = handle_response(abspath, code, response.info(), response)
return code, data
=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt 2010-10-21 07:51:44 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt 2010-10-23 08:27:11 +0000
@@ -49,6 +49,9 @@
* ``bzr status -r X..Y`` was failing because RevisionTree didn't implement
``get_shelf_manager``. (John Arbash Meinel, #662053)
+* Correctly set the Content-Type header when http POSTing to comply
+ with stricter web frameworks. (Vincent Ladeuil, #655100)
+
* Don't force openssh to use protocol=2, since that is now the default.
(Neil Martinsen-Burrell, #561061)
More information about the bazaar-commits
mailing list