<div dir="ltr">Daniel: Thanks, it did seem improbable, but seemed to be the only common factor. But I suspect Joakim's astute observation is more relevant.<div><div><br></div><div>I'm running on Linux, not Mac, and t's just a thrown together node.js server. I guess that means the real bug is probably in node, though one would think that the Java implementation should be robust enough to at least not crash (</div></div><div><br></div><div>I'll see if I can a) make it work if I run against say a JAX-RS server, and b) file an appropriate bug.</div><div><br></div><div>Thanks everyone.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, May 15, 2018 at 5:38 AM Joakim Erdfelt <<a href="mailto:joakim.erdfelt@gmail.com">joakim.erdfelt@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You're server is reporting the wrong Content-Length.<div><br></div><div>"<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><html><body><h1>Heading</h1><</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">p>Some Text</p></body></html>" is 59 characters</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">But the server said "Content-Length: 58"</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Also, "Connection: keep-alive" is a HTTP/1.0 concept only, but is being reported on your HTTP/1.1 request/response improperly.</span></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 14, 2018 at 7:20 PM, Simon Roberts <span dir="ltr"><<a href="mailto:simon@dancingcloudservices.com" target="_blank">simon@dancingcloudservices.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div>I have a very simple attempt to use the Java 10 / incubator httpclient api. It works on "regular" resources, but fails horribly when attempting to get things from localhost. It fails using 127.0.0.1, the actual non-loopback IP, and the name localhost. The server is running, and presenting a very simple web page (I originally tried json, but have since simplified it attempting to find out what's amiss).<div><br></div><div>The code is as simple as I can imagine (and that might be the problem :)</div><div><div style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">--------------------------------------------------------------</div></div><div><div>Â Â HttpClient client = HttpClient.newHttpClient();</div><div>Â Â URI uri = URI.create("<a href="http://192.168.1.102:8080/index.html" target="_blank">http://192.168.1.102:8080/index.html</a>");<br></div><div><br></div><div>Â Â HttpRequest getRequest = HttpRequest.newBuilder()</div><div>Â Â Â Â .uri(uri).GET().build();</div><div><br></div><div>Â Â HttpResponse<String> response = client.send(getRequest,</div><div>Â Â Â Â HttpResponse.BodyHandler.asString());</div><div>Â Â System.out.println("response to get: " + response.body());</div><div><div style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">--------------------------------------------------------------</div><br></div><div>The error prints a long stack trace, which I suppose I must post in its entiretly:</div><div><div style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">--------------------------------------------------------------</div><br></div><div><div>WARNING: Using incubator modules: jdk.incubator.httpclient</div><div>Exception in thread "main" java.io.EOFException: EOF reached while reading</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.Http1AsyncReceiver$Http1TubeSubscriber.onComplete(Http1AsyncReceiver.java:507)</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$ReadSubscription.signalCompletion(SocketTube.java:551)</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$InternalReadSubscription.read(SocketTube.java:728)</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$SocketFlowTask.run(SocketTube.java:171)</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:198)</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:271)</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:224)</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$InternalReadSubscription.signalReadable(SocketTube.java:675)</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$ReadEvent.signalEvent(SocketTube.java:829)</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.SocketTube$SocketFlowEvent.handle(SocketTube.java:243)</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.handleEvent(HttpClientImpl.java:769)</div><div><span style="white-space:pre-wrap"> </span>at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:731)</div><div><br></div><div>Process finished with exit code 1</div></div><div>--------------------------------------------------------------</div><div><br></div><div>If I use a curl to make the request of my (node/express) server, I get:</div><div><div style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">--------------------------------------------------------------</div></div><div><div>$ curl -v <a href="http://localhost:8080/index.html" target="_blank">http://localhost:8080/index.html</a></div><div>*Â Â Trying 127.0.0.1...</div><div>* Connected to localhost (127.0.0.1) port 8080 (#0)</div><div>> GET /index.html HTTP/1.1</div><div>> Host: localhost:8080</div><div>> User-Agent: curl/7.47.0</div><div>> Accept: */*</div><div>>Â </div><div>< HTTP/1.1 200 OK</div><div>< X-Powered-By: Express</div><div>< Content-Type: text/html; charset=utf-8</div><div>< Content-Length: 58</div><div>< ETag: W/"3a-EwoPOQKsJivlqZA3z/ulngzMv9U"</div><div>< Date: Tue, 15 May 2018 00:18:47 GMT</div><div>< Connection: keep-alive</div><div><Â </div><div>* Connection #0 to host localhost left intact</div><div><html><body><h1>Heading</h1><p>Some Text</p></body></html></div></div><div><div style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">--------------------------------------------------------------</div><br class="m_-986226689730977812m_7744352144914843179gmail-Apple-interchange-newline">Anyone able to tell me what I'm doing wrong?</div><div><br></div><div>TIA!</div><div><br></div><div dir="ltr" class="m_-986226689730977812m_7744352144914843179gmail_signature"><div><br></div></div></div></div>
</blockquote></div><br></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Simon Roberts<div>(303) 249 3613</div><div><br></div></div>