开发者

Does com.sun.net.httpserver.HttpServer support pipelining?

开发者 https://www.devze.com 2023-02-05 08:34 出处:网络
Does com.sun.net.httpserver.HttpServer support single-connection pipelining? 开发者_JAVA技巧It seems to handle multiple clients in parallel, but a single connection\'s requests are being serially exec

Does com.sun.net.httpserver.HttpServer support single-connection pipelining? 开发者_JAVA技巧It seems to handle multiple clients in parallel, but a single connection's requests are being serially executed.

Is this accurate, and if so, is there a way to work around this?


HTTP pipelining means something really simple: client can write next request to the connection without having read the previous response.

It's really difficult for any http server to not support pipelining. It has to look ahead, and if it finds bytes available beyond current request, it needs to abort ... but that's ridiculous, and nobody does it.

This has nothing to do with how requests are processed by server - serially or paralleled. Doing it in parallel is of course more difficult, and there are some questions that must be resolved.


HTTP servers compliant to HTTP 1.1 are expected to support pipelining. Note that pipelining is supposed to be also supported by client.
According to httpserver

The API provides a partial implementation of RFC 2616 (HTTP 1.1) and RFC 2818 (HTTP over TLS).

it seems to imply that the com.sun.net.httpserver.HttpServer does not fully support HTTP1.1.
HttpURLConnection does not support pipelining and so I am leaning to think that the com.sun.net.httpserver.HttpServer does not support pipelining either.
You say you did some tests. How did you test this?

Update:
From the note it seems that pipelining is supported.
If, as you say you send the requests pipelined, the responses should come back according to the arrival of the requests (irrelevant of time it takes to finish each request i.e. some are faster than others).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号