问题描述:

Can the HTTP client send a request while receiving the HTTP response?

For example, a client sends HTTP request A to server. Then, the server starts to send HTTP response. Before the client finish to receive HTTP response A, the client sends additional request B. Can it be possible? or Does it follow the HTTP RFC?

I think that above scenario is different from the pipelining. What I know about the pipelining is the scenario that client send multiple request A,B,C then the server response A,B,C consecutively. However, in the above scenario, request B is issued while the processing the response A.

Thank you

网友答案:

With the same connection object you must read the whole response before you can send a new request to the server, because response provides access to the request headers, return type and the entity body, If you send new request before fully reading response, client may get confused with mismatched responses.

Again it totally depends upon client library you using. Library could allow asynchronous requests.

There are concepts like
AsyncTask in android, promis in Angularjs etc.

allow asynchronous request.

相关阅读:
Top