本文整理汇总了Python中httplib.LineTooLong方法的典型用法代码示例。如果您正苦于以下问题:Python httplib.LineTooLong方法的具体用法?Python httplib.LineTooLong怎么用?Python httplib.LineTooLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类httplib
的用法示例。
在下文中一共展示了httplib.LineTooLong方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_overflowing_status_line
# 需要导入模块: import httplib [as 别名]
# 或者: from httplib import LineTooLong [as 别名]
def test_overflowing_status_line(self):
self.skipTest("disabled for HTTP 0.9 support")
body = "HTTP/1.1 200 Ok" + "k" * 65536 + "\r\n"
resp = httplib.HTTPResponse(FakeSocket(body))
self.assertRaises((httplib.LineTooLong, httplib.BadStatusLine), resp.begin)
示例2: test_overflowing_header_line
# 需要导入模块: import httplib [as 别名]
# 或者: from httplib import LineTooLong [as 别名]
def test_overflowing_header_line(self):
body = (
'HTTP/1.1 200 OK\r\n'
'X-Foo: bar' + 'r' * 65536 + '\r\n\r\n'
)
resp = httplib.HTTPResponse(FakeSocket(body))
self.assertRaises(httplib.LineTooLong, resp.begin)
示例3: test_overflowing_chunked_line
# 需要导入模块: import httplib [as 别名]
# 或者: from httplib import LineTooLong [as 别名]
def test_overflowing_chunked_line(self):
body = (
'HTTP/1.1 200 OK\r\n'
'Transfer-Encoding: chunked\r\n\r\n'
+ '0' * 65536 + 'a\r\n'
'hello world\r\n'
'0\r\n'
)
resp = httplib.HTTPResponse(FakeSocket(body))
resp.begin()
self.assertRaises(httplib.LineTooLong, resp.read)