问答详情
源自:5-4 编写基础HTTP服务器测试用例

加上了 self.write_error(404, None) 和 self.send(),依然empty response

有报错


2019-10-18 14:34:43,829 - base_http_handler.py[line:38] - ERROR:not enough values to unpack (expected 3, got 0)

Traceback (most recent call last):

  File "C:\pythonlearning\HTTPLearning\httpserver\handler\base_http_handler.py", line 24, in handle

    if not self.parse_request():

  File "C:\pythonlearning\HTTPLearning\httpserver\handler\base_http_handler.py", line 64, in parse_request

    self.method, self.path, self.version = words

ValueError: not enough values to unpack (expected 3, got 0)


提问者:慕的地5238837 2019-10-18 14:36

个回答

  • strValue
    2019-10-19 16:16:21

    看报错应该是处理请求那里的问题吧?你可以尝试在parse这个方法里面,把传入的参数都打印出来,尤其是words这个,显然里面是没有数据的导致解析这里报错。