mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8335135: HttpURLConnection#HttpInputStream does not throw IOException when response is truncated
Reviewed-by: dfuchs
This commit is contained in:
parent
4ab7e98c79
commit
b6ffb442ac
4 changed files with 120 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2024, 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
|
||||
|
@ -54,6 +54,9 @@ public class MeteredStream extends FilterInputStream {
|
|||
assert isLockHeldByCurrentThread();
|
||||
|
||||
if (n == -1) {
|
||||
if (expected > count) {
|
||||
throw new IOException("Premature EOF");
|
||||
}
|
||||
|
||||
/*
|
||||
* don't close automatically when mark is set and is valid;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue