How to drop body of a request after checking headers in Servlet

后端 未结 2 1357
半阙折子戏
半阙折子戏 2021-01-21 22:15

I want to check the header of the request whether it contains a certain header or not before continuing with the body. For example, I want to check whether a multipart/form-data

相关标签:
2条回答
  • 2021-01-21 22:52

    That's the limitation of HTTP. You can't send a response when the request hasn't been read fully to end.

    0 讨论(0)
  • 2021-01-21 22:59

    RFC 2616 says:

    An HTTP/1.1 (or later) client sending a message-body SHOULD monitor the network connection for an error status while it is transmitting the request. If the client sees an error status, it SHOULD immediately cease transmitting the body.

    So I disagree, this is not a HTTP limitation but a servlet one.

    0 讨论(0)
提交回复
热议问题