Rev 5515: (vila) Correctly set the Content-Type header when POSTing http requests. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Oct 26 08:02:32 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5515 [merge]
revision-id: pqm at pqm.ubuntu.com-20101026070231-xn5fwikevh6q40qu
parent: pqm at pqm.ubuntu.com-20101022181024-0xj4kn2fc8s1cr3r
parent: v.ladeuil+lp at free.fr-20101023082711-40j4jawodrrnjza6
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-10-26 08:02:31 +0100
message:
(vila) Correctly set the Content-Type header when POSTing http requests.
(Vincent Ladeuil)
modified:
bzrlib/tests/test_http.py testhttp.py-20051018020158-b2eef6e867c514d9
bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== 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