NullPointerException in AsyncNHttpServiceHandler on empty entity-enclosing 
request
----------------------------------------------------------------------------------

                 Key: HTTPCORE-228
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-228
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore NIO
    Affects Versions: 4.0.1
         Environment: [r...@dev3 DCS]# uname -a
Linux dev3 2.6.18-164.9.1.el5 #1 SMP Tue Dec 15 20:57:57 EST 2009 x86_64 x86_64 
x86_64 GNU/Linux
[r...@dev3 DCS]# java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)

            Reporter: Sam Crawford


When a client sends an entity-enclosing request, but does not include an 
entity, an IOReactorException is thrown which in turns terminates the server. 
The cause appears to be a missing null-check around line 317 in the following 
code:

313         ConsumingNHttpEntity consumingEntity = 
connState.getConsumingEntity();
314
315         try {
316
317             consumingEntity.consumeContent(decoder, conn);
318             if (decoder.isCompleted()) {
319                 conn.suspendInput();
320                 processRequest(conn, request);
321             }


The issue can be reproduced using the following:

[...@dev3 ~]$ curl -v -d "" https://proj.acmecorp.com/
* About to connect() to proj.acmecorp.com port 443
*   Trying 192.168.254.22... connected
* Connected to proj.acmecorp.com (192.168.254.22) port 443
* SSL certificate verify ok.
> POST / HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 
> OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: proj.acmecorp.com
> Accept: */*
> Content-Length: 0
> Content-Type: application/x-www-form-urlencoded
>
(No response is ever received)


Complete stacktrace:

INFO com.acmecorp.proj.http.HttpSSLServer: Connection open: 
[proj.acmecorp.com/192.168.254.22:47992]
ERROR com.acmecorp.proj.http.HttpSSLServer: I/O error
org.apache.http.nio.reactor.IOReactorException: I/O dispatch worker terminated 
abnormally
        at 
org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:326)
        at com.acmecorp.proj.http.HttpSSLServer$1.run(HttpSSLServer.java:162)
Caused by: java.lang.NullPointerException
        at 
org.apache.http.nio.protocol.AsyncNHttpServiceHandler.inputReady(AsyncNHttpServiceHandler.java:317)
        at 
org.apache.http.impl.nio.DefaultNHttpServerConnection.consumeInput(DefaultNHttpServerConnection.java:179)
        at 
org.apache.http.impl.nio.SSLServerIOEventDispatch.inputReady(SSLServerIOEventDispatch.java:225)
        at 
org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:153)
        at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:314)
        at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:294)
        at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:256)
        at 
org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:96)
        at 
org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:556)
        at java.lang.Thread.run(Thread.java:619)
INFO com.acmecorp.proj.http.HttpSSLServer: Shutdown HTTP server


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to