summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-04-28 17:39:48 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-04-28 17:39:48 (GMT)
commit71fb6c88a8f8e04968a726945ef53b4dee6e10c9 (patch)
treeae97135471f1cc012166bf824f71d7682ba90e3c /Doc/library
parent6237daf8c5c17db55af6620460e6c3c7ef2d35ef (diff)
downloadcpython-71fb6c88a8f8e04968a726945ef53b4dee6e10c9.zip
cpython-71fb6c88a8f8e04968a726945ef53b4dee6e10c9.tar.gz
cpython-71fb6c88a8f8e04968a726945ef53b4dee6e10c9.tar.bz2
Merged revisions 80583 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r80583 | senthil.kumaran | 2010-04-28 22:50:43 +0530 (Wed, 28 Apr 2010) | 3 lines Fixed Issue6312 - httplib fails with HEAD requests to pages with "transfer-encoding: chunked" ........
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/http.client.rst16
1 files changed, 16 insertions, 0 deletions
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
index bc50423..17373a7 100644
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -521,6 +521,22 @@ Here is an example session that uses the ``GET`` method::
>>> data2 = r2.read()
>>> conn.close()
+Here is an example session that uses ``HEAD`` method. Note that ``HEAD`` method
+never returns any data. ::
+
+
+ >>> import http.client
+ >>> conn = http.client.HTTPConnection("www.python.org")
+ >>> conn.request("HEAD","/index.html")
+ >>> res = conn.getresponse()
+ >>> print(res.status, res.reason)
+ 200 OK
+ >>> data = res.read()
+ >>> print(len(data))
+ 0
+ >>> data == b''
+ True
+
Here is an example session that shows how to ``POST`` requests::
>>> import http.client, urllib.parse