英文:
How should HTTP server behave when failed to parse request data?
问题
客户端可能会发送无效数据,无法正确解析到HTTP服务器。
例如,一个糟糕的客户端可能会发送GED /a/b/c HTTP/1.1\r\n
,其中GED不是正确的HTTP方法名称。
或者,客户端可能会漏掉\r
来表示新行。
是否有状态码来表示来自客户端的错误原始数据?
或者是否有关于HTTP服务器处理这种情况的任何指南?
英文:
A client may send invalid data which cannot be parsed properly to HTTP server.
For instance, a bad client could send GED /a/b/c HTTP/1.1\r\n
where GED is not a proper HTTP method name.
Or, a client may miss \r
for new line.
Is there a status code to denote wrong raw data from client?
Or is there any guideline about HTTP server for such situation?
答案1
得分: 0
GED /a/b/c HTTP/1.1\r\n where GED is not a proper HTTP method name.
通常情况下,这会是 501 Not Implemented
。
Or, a client may miss \r for new line.
通常情况下,这会是 400 Bad Request
。
Or is there any guideline about HTTP server for such situation?
如果有帮助的话,我写了一个关于所有HTTP状态码及其使用情况的指南。
英文:
> GED /a/b/c HTTP/1.1\r\n where GED is not a proper HTTP method name.
Usually this is 501 Not Implemented
> Or, a client may miss \r for new line.
Usually this is 400 Bad Request
> Or is there any guideline about HTTP server for such situation?
If it helps, I wrote a guideline on all HTTP status codes and when to use them.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论