NanoHttpd / nanohttpd

Tiny, easily embeddable HTTP server in Java.
http://nanohttpd.org
BSD 3-Clause "New" or "Revised" License
6.92k stars 1.69k forks source link

Issue #392 wasn't properly fixed #524

Closed evgk closed 5 years ago

evgk commented 5 years ago

Here is the stack trace:

javax.net.ssl.SSLException: Write error: ssl=0xec6d3908: I/O error during system call, Broken pipe
    at com.android.org.conscrypt.NativeCrypto.SSL_write(Native Method)
    at com.android.org.conscrypt.NativeSsl.write(NativeSsl.java:414)
    at com.android.org.conscrypt.ConscryptFileDescriptorSocket$SSLOutputStream.write(ConscryptFileDescriptorSocket.java:623)
    at java.io.OutputStream.write(OutputStream.java:75)
    at org.nanohttpd.protocols.http.response.ChunkedOutputStream.write(ChunkedOutputStream.java:68)
    at org.nanohttpd.protocols.http.response.ChunkedOutputStream.write(ChunkedOutputStream.java:61)
    at java.util.zip.GZIPOutputStream.writeHeader(GZIPOutputStream.java:182)
    at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:94)
    at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:109)
    at org.nanohttpd.protocols.http.response.Response.sendBodyWithCorrectEncoding(Response.java:308)
    at org.nanohttpd.protocols.http.response.Response.sendBodyWithCorrectTransferAndEncoding(Response.java:299)
    at org.nanohttpd.protocols.http.response.Response.send(Response.java:268)
    at org.nanohttpd.protocols.http.HTTPSession.execute(HTTPSession.java:458)
    at org.nanohttpd.protocols.http.ClientHandler.run(ClientHandler.java:75)

So GZIPOutputStream calls WriteHeader in it's constructor which writes to ChunkedOutputStream. If the client abruptly closes the connection, then the same exception as in #392 is raised.

LordFokas commented 5 years ago

@evgk run your tests again in the master branch, if it has been properly fixed please close this, otherwise commit a better fix ;)

evgk commented 5 years ago

Hi, Yes, seems to be solved now. Thanks.