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"
........
diff --git a/Doc/library/httplib.rst b/Doc/library/httplib.rst
index e48c95c..da2169c 100644
--- a/Doc/library/httplib.rst
+++ b/Doc/library/httplib.rst
@@ -541,6 +541,22 @@
>>> data2 = r2.read()
>>> conn.close()
+Here is an example session that uses ``HEAD`` method. Note that ``HEAD`` method
+never returns any data. ::
+
+
+ >>> import httplib
+ >>> conn = httplib.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 == ''
+ True
+
Here is an example session that shows how to ``POST`` requests::
>>> import httplib, urllib