简体   繁体   English

com.sun.net.httpserver.HttpServer是否支持管道传输?

[英]Does com.sun.net.httpserver.HttpServer support pipelining?

Does com.sun.net.httpserver.HttpServer support single-connection pipelining? com.sun.net.httpserver.HttpServer是否支持单连接流水线? 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 servers compliant to HTTP 1.1 are expected to support pipelining. 符合HTTP 1.1的HTTP服务器应支持流水线。 Note that pipelining is supposed to be also supported by client. 注意,客户端也应该支持流水线操作。
According to httpserver 根据httpserver

The API provides a partial implementation of RFC 2616 (HTTP 1.1) and RFC 2818 (HTTP over TLS). 该API提供了RFC 2616(HTTP 1.1)和RFC 2818(TLS上的HTTP)的部分实现。

it seems to imply that the com.sun.net.httpserver.HttpServer does not fully support HTTP1.1. 似乎暗示com.sun.net.httpserver.HttpServer不完全支持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. HttpURLConnection不支持管道,因此我倾向于认为com.sun.net.httpserver.HttpServer也不支持管道。
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 ie some are faster than others). 如您所说,如果您以流水线形式发送请求,则响应应根据请求的到达来返回(与完成每个请求所花费的时间无关,即某些请求比其他请求要快)。

HTTP pipelining means something really simple: client can write next request to the connection without having read the previous response. HTTP流水线的意思很简单:客户端可以将下一个请求写入连接,而无需读取前一个响应。

It's really difficult for any http server to not support pipelining. 任何http服务器都不支持流水线确实很困难。 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. 并行执行此操作当然会更加困难,并且有些问题必须解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM