8190793: Httpserver does not detect truncated request body

Reviewed-by: chegar, dfuchs
This commit is contained in:
Michael McMahon 2017-11-06 16:32:00 +00:00
parent 2060b8fc57
commit 62d9659c87
3 changed files with 134 additions and 2 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -135,6 +135,8 @@ class ChunkedInputStream extends LeftOverInputStream {
needToReadHeader = true;
consumeCRLF();
}
if (n < 0 && !eof)
throw new IOException("connection closed before all data received");
return n;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -60,6 +60,8 @@ class FixedLengthInputStream extends LeftOverInputStream {
t.getServerImpl().requestCompleted (t.getConnection());
}
}
if (n < 0 && !eof)
throw new IOException("connection closed before all data received");
return n;
}