Daniel Fuchs daniel.fuchs at oracle.com
Tue May 15 11:28:44 UTC 2018


Hi Simon,

We are using localhost/127.0.0.1 in all our tests so I doubt this
is the problem here. It's difficult to say what is happening with
just the stack trace.
If you're on Mac that could be an issue with the system proxy
configuration.

Could you please log a bug through
https://bugreport.java.com/bugreport/
and include a reproducer?

best regards,

-- daniel

On 15/05/2018 01:20, Simon Roberts wrote:
> 
> 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).
> 
> The code is as simple as I can imagine (and that might be the problem :)
> 
> --------------------------------------------------------------
>      HttpClient client = HttpClient.newHttpClient();
>      URI uri = URI.create("http://192.168.1.102:8080/index.html");
> 
>      HttpRequest getRequest = HttpRequest.newBuilder()
>          .uri(uri).GET().build();
> 
>      HttpResponse<String> response = client.send(getRequest,
>          HttpResponse.BodyHandler.asString());
>      System.out.println("response to get: " + response.body());
> --------------------------------------------------------------
> 
> The error prints a long stack trace, which I suppose I must post in its 
> entiretly:
> 
> --------------------------------------------------------------
> 
> WARNING: Using incubator modules: jdk.incubator.httpclient
> Exception in thread "main" java.io.EOFException: EOF reached while reading
> at 
> jdk.incubator.httpclient/jdk.incubator.http.Http1AsyncReceiver$Http1TubeSubscriber.onComplete(Http1AsyncReceiver.java:507)
> at 
> jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$ReadSubscription.signalCompletion(SocketTube.java:551)
> at 
> jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$InternalReadSubscription.read(SocketTube.java:728)
> at 
> jdk.incubator.httpclient/jdk.incubator.http.SocketTube$SocketFlowTask.run(SocketTube.java:171)
> at 
> jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:198)
> at 
> jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:271)
> at 
> jdk.incubator.httpclient/jdk.incubator.http.internal.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:224)
> at 
> jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$InternalReadSubscription.signalReadable(SocketTube.java:675)
> at 
> jdk.incubator.httpclient/jdk.incubator.http.SocketTube$InternalReadPublisher$ReadEvent.signalEvent(SocketTube.java:829)
> at 
> jdk.incubator.httpclient/jdk.incubator.http.SocketTube$SocketFlowEvent.handle(SocketTube.java:243)
> at 
> jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.handleEvent(HttpClientImpl.java:769)
> at 
> jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:731)
> 
> Process finished with exit code 1
> --------------------------------------------------------------
> 
> If I use a curl to make the request of my (node/express) server, I get:
> 
> --------------------------------------------------------------
> $ curl -v http://localhost:8080/index.html
> *   Trying 127.0.0.1...
> * Connected to localhost (127.0.0.1) port 8080 (#0)
>  > GET /index.html HTTP/1.1
>  > Host: localhost:8080
>  > User-Agent: curl/7.47.0
>  > Accept: */*
>  >
> < HTTP/1.1 200 OK
> < X-Powered-By: Express
> < Content-Type: text/html; charset=utf-8
> < Content-Length: 58
> < ETag: W/"3a-EwoPOQKsJivlqZA3z/ulngzMv9U"
> < Date: Tue, 15 May 2018 00:18:47 GMT
> < Connection: keep-alive
> <
> * Connection #0 to host localhost left intact
> <html><body><h1>Heading</h1><p>Some Text</p></body></html>
> --------------------------------------------------------------
> 
> Anyone able to tell me what I'm doing wrong?
> 
> TIA!
> 
> 



More information about the net-dev mailing list