use of org.commonjava.indy.httprox.util.OutputStreamSinkChannel in project indy by Commonjava.
the class ProxyMITMSSLServer method transferRemote.
private void transferRemote(Socket socket, String host, int port, String method, String path, final ProxyMeter meter) throws Exception {
String protocol = "https";
String auth = null;
String query = null;
String fragment = null;
URI uri = new URI(protocol, auth, host, port, path, query, fragment);
URL remoteUrl = uri.toURL();
logger.debug("Requesting remote URL: {}", remoteUrl.toString());
ArtifactStore store = proxyResponseHelper.getArtifactStore(trackingId, remoteUrl);
try (BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream());
HttpConduitWrapper http = new HttpConduitWrapper(new OutputStreamSinkChannel(out), null, contentController, cacheProvider)) {
proxyResponseHelper.transfer(http, store, remoteUrl.getPath(), GET_METHOD.equals(method), proxyUserPass, meter);
out.flush();
}
}
Aggregations