Skip to content

Commit

Permalink
SNOW-872558: add path to private link OCSP retry url (#1495)
Browse files Browse the repository at this point in the history
* add path to private link OCSP retry url

* use path variable

* fix syntax error in drop table query

---------

Co-authored-by: sfc-gh-ext-simba-lb <[email protected]>
  • Loading branch information
sfc-gh-ext-simba-jl and sfc-gh-ext-simba-lb authored Aug 19, 2023
1 parent c97a5de commit 3bffa14
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
26 changes: 20 additions & 6 deletions src/main/java/net/snowflake/client/core/SFTrustManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1115,16 +1115,30 @@ private OCSPResp fetchOcspResponse(
telemetryData.setOcspReq(ocspReqDerBase64);

URL url;
String path = "";
if (!ocspCacheServer.new_endpoint_enabled) {
String urlEncodedOCSPReq = URLUtil.urlEncode(ocspReqDerBase64);
if (SF_OCSP_RESPONSE_CACHE_SERVER_RETRY_URL_PATTERN != null) {
URL ocspUrl = new URL(ocspUrlStr);
url =
new URL(
String.format(
SF_OCSP_RESPONSE_CACHE_SERVER_RETRY_URL_PATTERN,
ocspUrl.getHost(),
urlEncodedOCSPReq));
if (!Strings.isNullOrEmpty(ocspUrl.getPath())) {
path = ocspUrl.getPath();
}
if (ocspUrl.getPort() > 0) {
url =
new URL(
String.format(
SF_OCSP_RESPONSE_CACHE_SERVER_RETRY_URL_PATTERN,
ocspUrl.getHost() + ":" + ocspUrl.getPort() + path,
urlEncodedOCSPReq));
} else {
url =
new URL(
String.format(
SF_OCSP_RESPONSE_CACHE_SERVER_RETRY_URL_PATTERN,
ocspUrl.getHost() + path,
urlEncodedOCSPReq));
}

} else {
url = new URL(String.format("%s/%s", ocspUrlStr, urlEncodedOCSPReq));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ public void testHTAPStatementParameterCaching() throws SQLException {
resultSet.next();
// Verify it matches the new statement parameter specified output format
assertEquals("08/17/2023", resultSet.getString(3));
statement.execute("drop table timetable if exists");
statement.execute("drop table if exists timetable");
statement.close();
con.close();
// cleanup
Expand Down

0 comments on commit 3bffa14

Please sign in to comment.