Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asa 7933 #134

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/main/java/com/hcl/appscan/sdk/http/HttpClient.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
/**
* © Copyright IBM Corporation 2016.
* © Copyright HCL Technologies Ltd. 2017, 2023.
* © Copyright HCL Technologies Ltd. 2017, 2024.
* LICENSE: Apache License, Version 2.0 https://www.apache.org/licenses/LICENSE-2.0
*/

package com.hcl.appscan.sdk.http;

import org.apache.wink.json4j.JSON;
import org.apache.wink.json4j.JSONObject;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.Proxy;
import java.net.URL;
import java.net.URLEncoder;
Expand Down Expand Up @@ -256,7 +254,7 @@ public HttpResponse postMultipart(String url,
private HttpResponse makeMultipartRequest(Method method, String url,
Map<String, String> headerProperties, List<HttpPart> parts)
throws IOException {
HttpsURLConnection conn = makeConnection(url, method, headerProperties);
HttpURLConnection conn = makeConnection(url, method, headerProperties);

DataOutputStream outputStream = null;
conn.setChunkedStreamingMode(1024);
Expand Down Expand Up @@ -312,7 +310,7 @@ private HttpResponse makeMultipartRequest(Method method, String url,
private HttpResponse makeRequest(Method method, String url,
Map<String, String> headerProperties, String payload)
throws IOException {
HttpsURLConnection conn = makeConnection(url, method, headerProperties);
HttpURLConnection conn = makeConnection(url, method, headerProperties);

// Write payload
if (payload != null) {
Expand All @@ -327,15 +325,15 @@ private HttpResponse makeRequest(Method method, String url,
return new HttpResponse(conn);
}

private HttpsURLConnection makeConnection(String url, Method method,
private HttpURLConnection makeConnection(String url, Method method,
Map<String, String> headerProperties) throws IOException {
URL requestURL = new URL(url);
HttpsURLConnection conn = null;
conn = (HttpsURLConnection) requestURL.openConnection(m_proxy);
HttpURLConnection conn = null;
conn = (HttpURLConnection) requestURL.openConnection(m_proxy);
conn.setRequestMethod(method.name());
conn.setReadTimeout(0);
if(m_bypassSSL) {
bypassSSL(conn);
if((conn instanceof HttpsURLConnection) && m_bypassSSL) {
bypassSSL((HttpsURLConnection)conn);
}

// HTTP headers
Expand Down
Loading