summaryrefslogtreecommitdiffstats
path: root/src/kernel
ModeNameSize
-rw-r--r--blk.c9543logstatsplainblame
-rw-r--r--blk.h1254logstatsplainblame
-rw-r--r--core.c2153logstatsplainblame
-rw-r--r--dnbd3.h2368logstatsplainblame
-rw-r--r--net.c36621logstatsplainblame
-rw-r--r--net.h1361logstatsplainblame
-rw-r--r--serialize_kmod.c98logstatsplainblame
-rw-r--r--sysfs.c5355logstatsplainblame
-rw-r--r--sysfs.h1207logstatsplainblame
-rw-r--r--utils.c1148logstatsplainblame
-rw-r--r--utils.h879logstatsplainblame
0;
+ pending = sendContentLengthHeaderIfNotAlreadyPresent( sb, header, pending );
+ sb.append( "\r\n" );
+ outputStream.write( sb.toString().getBytes( StandardCharsets.UTF_8 ) );
+ sb.setLength( 0 );
+ sendAsFixedLength( outputStream, pending );
+ }
- if ( sb.length() != 0 ) {
- outputStream.write( sb.toString().getBytes( StandardCharsets.UTF_8 ) );
- }
- safeClose( data );
- } catch ( IOException ioe ) {
- // Couldn't write? No can do.
+ if ( sb.length() != 0 ) {
+ outputStream.write( sb.toString().getBytes( StandardCharsets.UTF_8 ) );
}
+ safeClose( data );
}
protected int sendContentLengthHeaderIfNotAlreadyPresent( StringBuilder sb,
@@ -893,14 +889,10 @@ public abstract class NanoHTTPD implements Runnable
try {
read = inputStream.read( buf, 0, BUFSIZE );
} catch ( Exception e ) {
- safeClose( inputStream );
- safeClose( outputStream );
throw e;
}
if ( read == -1 ) {
// socket was been closed
- safeClose( inputStream );
- safeClose( outputStream );
throw new SocketException( "NanoHttpd Shutdown" );
}
while ( read > 0 ) {
@@ -912,6 +904,9 @@ public abstract class NanoHTTPD implements Runnable
if ( maxRequestSize != 0 && rlen > maxRequestSize )
throw new SocketException( "Request too large" );
}
+ if ( splitbyte == 0 ) {
+ throw new SocketException( "Connection was closed" );
+ }
}
if ( splitbyte < rlen ) {