Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
selftests: fix java.io.IOException: HTTP/1.1 header parser received n…
…o bytes First, `HttpServer.start()` already manages threads, no reason to wrap it in `new Thread`. Second, the docs for HttpServer say that "One or more HttpHandler objects must be associated with a server in order to process requests." When I added one, and implemented the barest minimum, things started to work reliably. The barest minimum for a `HttpExchange` is "5) sendResponseHeaders(int,long) to send the response headers. Must be called before next step. 6) getResponseBody() to get a OutputStream to send the response body. When the response body has been written, the stream must be closed to terminate the exchange." Checked this by running the selftest 10000 times in a loop, all passed. Previously, I always got a failure after about 500 attempts. * https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/HttpServer.html * https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/HttpExchange.html
- Loading branch information