src/java.base/share/classes/sun/security/timestamp/HttpTimestamper.java
Print this page
*** 25,41 ****
package sun.security.timestamp;
import java.io.BufferedInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.net.HttpURLConnection;
import java.util.*;
- import sun.misc.IOUtils;
import sun.security.util.Debug;
/**
* A timestamper that communicates with a Timestamping Authority (TSA)
* over HTTP.
--- 25,41 ----
package sun.security.timestamp;
import java.io.BufferedInputStream;
import java.io.DataOutputStream;
+ import java.io.EOFException;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.net.HttpURLConnection;
import java.util.*;
import sun.security.util.Debug;
/**
* A timestamper that communicates with a Timestamping Authority (TSA)
* over HTTP.
*** 145,156 ****
}
debug.println();
}
verifyMimeType(connection.getContentType());
! int contentLength = connection.getContentLength();
! replyBuffer = IOUtils.readFully(input, contentLength, false);
if (debug != null) {
debug.println("received timestamp response (length=" +
replyBuffer.length + ")");
}
--- 145,159 ----
}
debug.println();
}
verifyMimeType(connection.getContentType());
! int clen = connection.getContentLength();
! replyBuffer = input.readAllBytes();
! if (clen != -1 && replyBuffer.length != clen)
! throw new EOFException("Expected:" + clen +
! ", read:" + replyBuffer.length);
if (debug != null) {
debug.println("received timestamp response (length=" +
replyBuffer.length + ")");
}