提交 68edc2ac 编写于 作者: W weijun

7175041: HttpTimestamper should accept https URI

Reviewed-by: mullan
上级 effbcb61
/* /*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -68,12 +68,15 @@ public class HttpTimestamper implements Timestamper { ...@@ -68,12 +68,15 @@ public class HttpTimestamper implements Timestamper {
/** /**
* Creates a timestamper that connects to the specified TSA. * Creates a timestamper that connects to the specified TSA.
* *
* @param tsa The location of the TSA. It must be an HTTP URI. * @param tsa The location of the TSA. It must be an HTTP or HTTPS URI.
* @throws IllegalArgumentException if tsaURI is not an HTTP URI * @throws IllegalArgumentException if tsaURI is not an HTTP or HTTPS URI
*/ */
public HttpTimestamper(URI tsaURI) { public HttpTimestamper(URI tsaURI) {
if (!tsaURI.getScheme().equalsIgnoreCase("http")) if (!tsaURI.getScheme().equalsIgnoreCase("http") &&
throw new IllegalArgumentException("TSA must be an HTTP URI"); !tsaURI.getScheme().equalsIgnoreCase("https")) {
throw new IllegalArgumentException(
"TSA must be an HTTP or HTTPS URI");
}
this.tsaURI = tsaURI; this.tsaURI = tsaURI;
} }
...@@ -144,13 +147,12 @@ public class HttpTimestamper implements Timestamper { ...@@ -144,13 +147,12 @@ public class HttpTimestamper implements Timestamper {
} }
verifyMimeType(connection.getContentType()); verifyMimeType(connection.getContentType());
int total = 0;
int contentLength = connection.getContentLength(); int contentLength = connection.getContentLength();
replyBuffer = IOUtils.readFully(input, contentLength, false); replyBuffer = IOUtils.readFully(input, contentLength, false);
if (debug != null) { if (debug != null) {
debug.println("received timestamp response (length=" + debug.println("received timestamp response (length=" +
total + ")"); replyBuffer.length + ")");
} }
} finally { } finally {
if (input != null) { if (input != null) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册