diff --git a/agent/http_client_5/settings.xml b/agent/http_client_5/settings.xml index c6ff5b210..66273e2da 100644 --- a/agent/http_client_5/settings.xml +++ b/agent/http_client_5/settings.xml @@ -125,6 +125,8 @@ com.intuit.tank.okhttpclient.TankOkHttpClient + com.intuit.tank.httpclient6.TankHttpClient6 + Apache HttpClient 3.1 diff --git a/agent/http_client_6/pom.xml b/agent/http_client_6/pom.xml new file mode 100644 index 000000000..1c25ecb52 --- /dev/null +++ b/agent/http_client_6/pom.xml @@ -0,0 +1,39 @@ + + 4.0.0 + + + com.intuit.tank + agent-parent + 2.3.1 + + + http_client_commons_6 + + jar + Http Client for commons apache 4.5 + + + 4.1.42.Final + + + + + ${project.groupId} + api + ${project.version} + + + + ${project.groupId} + agent-common + ${project.version} + + + + io.netty + netty-all + ${netty.version} + + + \ No newline at end of file diff --git a/agent/http_client_6/src/main/java/com/intuit/tank/httpclient6/TankHttpClient6.java b/agent/http_client_6/src/main/java/com/intuit/tank/httpclient6/TankHttpClient6.java new file mode 100644 index 000000000..3972fbf47 --- /dev/null +++ b/agent/http_client_6/src/main/java/com/intuit/tank/httpclient6/TankHttpClient6.java @@ -0,0 +1,380 @@ +package com.intuit.tank.httpclient6; + +import com.intuit.tank.http.AuthCredentials; +import com.intuit.tank.http.BaseRequest; +import com.intuit.tank.http.TankCookie; +import com.intuit.tank.http.TankHttpClient; +import com.intuit.tank.httpclient6.utils.TankHttpClientHandler; +import com.intuit.tank.httpclient6.utils.TankHttpClientInitializer; +import io.netty.bootstrap.Bootstrap; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.Channel; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannelConfig; +import io.netty.channel.socket.nio.NioSocketChannel; +import io.netty.handler.codec.http.*; +import io.netty.handler.codec.http.cookie.ClientCookieEncoder; +import io.netty.handler.codec.http.cookie.DefaultCookie; +import io.netty.handler.proxy.HttpProxyHandler; +import io.netty.handler.ssl.SslContext; +import io.netty.handler.ssl.SslContextBuilder; +import io.netty.handler.ssl.util.InsecureTrustManagerFactory; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import javax.net.ssl.SSLException; +import java.net.InetSocketAddress; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; + +public class TankHttpClient6 implements TankHttpClient { + + private static final Logger LOG = LogManager.getLogger(TankHttpClient6.class); + + private EventLoopGroup group; + private Bootstrap bootstrap; + private TankHttpClientHandler httpClientHandler; + private Channel channel; + private HttpProxyHandler httpProxyHandler; + + private String host; + private String username; + private String password; + private final List cookies; + + public TankHttpClient6() { + this.cookies = new ArrayList<>(); + } + + @Override + public Object createHttpClient() { + this.httpClientHandler = new TankHttpClientHandler(); + this.group = new NioEventLoopGroup(); + this.bootstrap = new Bootstrap(); + this.bootstrap.group(group) + .channel(NioSocketChannel.class); + return this.bootstrap; + } + + @Override + public void setHttpClient(Object httpClient) { + + } + + @Override + public void setConnectionTimeout(long connectionTimeout) { + SocketChannelConfig config = (SocketChannelConfig) this.channel.config(); + config.setConnectTimeoutMillis(Long.valueOf(connectionTimeout).intValue()); + } + + private Pair getHostPortFromUrl(String url) throws URISyntaxException { + URI uri = new URI(url); + String scheme = uri.getScheme() == null ? "http": uri.getScheme(); + + if (!"http".equalsIgnoreCase(scheme) && !"https".equalsIgnoreCase(scheme)) { + LOG.error("Only HTTP(S) is supported."); + throw new URISyntaxException("URL is incorrect", ""); + } + + String host = uri.getHost() == null ? "127.0.0.1": uri.getHost(); + int port = uri.getPort(); + + if (port == -1) { + if ("http".equalsIgnoreCase(scheme)) { + port = 80; + } else if ("https".equalsIgnoreCase(scheme)) { + port = 443; + } + } + + return Pair.of(host, port); + } + + private SslContext useSslContext(String url) throws URISyntaxException, SSLException { + URI uri = new URI(url); + String scheme = uri.getScheme() == null ? "http": uri.getScheme(); + final boolean ssl = "https".equalsIgnoreCase(scheme); + final SslContext sslContext; + if (ssl) { + sslContext = SslContextBuilder.forClient() + .trustManager(InsecureTrustManagerFactory.INSTANCE).build(); + } else { + sslContext = null; + } + return sslContext; + } + + @Override + public void doGet(BaseRequest request) { + try { + createHttpClient(); + this.httpClientHandler.setRequest(request); + Pair hostPortPair = this.getHostPortFromUrl(request.getRequestUrl()); + + SslContext sslContext = this.useSslContext(request.getRequestUrl()); + + this.bootstrap.handler(new TankHttpClientInitializer(this.httpProxyHandler, sslContext, this.httpClientHandler)); + + this.channel = this.bootstrap.connect(hostPortPair.getLeft(), hostPortPair.getRight()).sync().channel(); + this.setConnectionTimeout(60000); + + HttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, + HttpMethod.GET, new URI(request.getRequestUrl()).getRawPath(), Unpooled.EMPTY_BUFFER); + httpRequest.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); + httpRequest.headers().set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP); + + if (this.cookies.size() > 0) { + this.httpClientHandler.setCookieList(this.cookies); + httpRequest.headers().set( + HttpHeaderNames.COOKIE, + ClientCookieEncoder.STRICT.encode(this.cookies)); + } + + if (this.host != null) { + httpRequest.headers().set(HttpHeaderNames.HOST, host); + } else { + httpRequest.headers().set(HttpHeaderNames.HOST, hostPortPair.getKey()); + } + if (this.username != null && this.password != null) { + httpRequest.headers().set(HttpHeaderNames.AUTHORIZATION, + "Basic " + Base64.getEncoder().encodeToString((this.username + ":" + this.password).getBytes())); + } + + long waitTime = 0L; + this.httpClientHandler.setStartTimestamp(waitTime); + this.channel.writeAndFlush(httpRequest); + this.channel.closeFuture().sync(); + } catch (URISyntaxException | SSLException | InterruptedException ex) { + throw new RuntimeException(ex.getCause()); + } + } + + @Override + public void doPut(BaseRequest request) { + try { + createHttpClient(); + this.httpClientHandler.setRequest(request); + Pair hostPortPair = this.getHostPortFromUrl(request.getRequestUrl()); + + SslContext sslContext = this.useSslContext(request.getRequestUrl()); + this.bootstrap.handler(new TankHttpClientInitializer(this.httpProxyHandler, sslContext, this.httpClientHandler)); + + this.channel = this.bootstrap.connect(hostPortPair.getLeft(), hostPortPair.getRight()).sync().channel(); + this.setConnectionTimeout(60000); + + FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, + HttpMethod.PUT, new URI(request.getRequestUrl()).getRawPath()); + httpRequest.headers().set(HttpHeaderNames.HOST, hostPortPair.getKey()); + httpRequest.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); + httpRequest.headers().set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP); + + if (this.cookies.size() > 0) { + this.httpClientHandler.setCookieList(this.cookies); + httpRequest.headers().set( + HttpHeaderNames.COOKIE, + ClientCookieEncoder.STRICT.encode(this.cookies)); + } + + if (this.host != null) { + httpRequest.headers().set(HttpHeaderNames.HOST, host); + } else { + httpRequest.headers().set(HttpHeaderNames.HOST, hostPortPair.getKey()); + } + if (this.username != null && this.password != null) { + httpRequest.headers().set(HttpHeaderNames.AUTHORIZATION, + "Basic " + Base64.getEncoder().encodeToString((this.username + ":" + this.password).getBytes())); + } + + String requestBody = request.getBody(); + ByteBuf byteBuf = Unpooled.copiedBuffer(requestBody, StandardCharsets.UTF_8); + httpRequest.content().clear().writeBytes(byteBuf); + + long waitTime = 0L; + this.httpClientHandler.setStartTimestamp(waitTime); + this.channel.writeAndFlush(httpRequest); + this.channel.closeFuture().sync(); + } catch (URISyntaxException | SSLException | InterruptedException ex) { + throw new RuntimeException(ex.getCause()); + } + } + + @Override + public void doDelete(BaseRequest request) { + try { + createHttpClient(); + this.httpClientHandler.setRequest(request); + Pair hostPortPair = this.getHostPortFromUrl(request.getRequestUrl()); + + SslContext sslContext = this.useSslContext(request.getRequestUrl()); + this.bootstrap.handler(new TankHttpClientInitializer(this.httpProxyHandler, sslContext, this.httpClientHandler)); + + this.channel = this.bootstrap.connect(hostPortPair.getLeft(), hostPortPair.getRight()).sync().channel(); + this.setConnectionTimeout(60000); + + HttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, + HttpMethod.DELETE, new URI(request.getRequestUrl()).getRawPath(), Unpooled.EMPTY_BUFFER); + httpRequest.headers().set(HttpHeaderNames.HOST, hostPortPair.getKey()); + httpRequest.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); + httpRequest.headers().set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP); + + if (this.cookies.size() > 0) { + this.httpClientHandler.setCookieList(this.cookies); + httpRequest.headers().set( + HttpHeaderNames.COOKIE, + ClientCookieEncoder.STRICT.encode(this.cookies)); + } + + if (this.host != null) { + httpRequest.headers().set(HttpHeaderNames.HOST, host); + } else { + httpRequest.headers().set(HttpHeaderNames.HOST, hostPortPair.getKey()); + } + if (this.username != null && this.password != null) { + httpRequest.headers().set(HttpHeaderNames.AUTHORIZATION, + "Basic " + Base64.getEncoder().encodeToString((this.username + ":" + this.password).getBytes())); + } + + long waitTime = 0L; + this.httpClientHandler.setStartTimestamp(waitTime); + this.channel.writeAndFlush(httpRequest); + this.channel.closeFuture().sync(); + } catch (URISyntaxException | SSLException | InterruptedException ex) { + throw new RuntimeException(ex.getCause()); + } + } + + @Override + public void doOptions(BaseRequest request) { + try { + createHttpClient(); + this.httpClientHandler.setRequest(request); + Pair hostPortPair = this.getHostPortFromUrl(request.getRequestUrl()); + + SslContext sslContext = this.useSslContext(request.getRequestUrl()); + this.bootstrap.handler(new TankHttpClientInitializer(this.httpProxyHandler, sslContext, this.httpClientHandler)); + + this.channel = this.bootstrap.connect(hostPortPair.getLeft(), hostPortPair.getRight()).sync().channel(); + this.setConnectionTimeout(60000); + + HttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, + HttpMethod.OPTIONS, new URI(request.getRequestUrl()).getRawPath(), Unpooled.EMPTY_BUFFER); + httpRequest.headers().set(HttpHeaderNames.HOST, hostPortPair.getKey()); + httpRequest.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); + httpRequest.headers().set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP); + + if (this.cookies.size() > 0) { + this.httpClientHandler.setCookieList(this.cookies); + httpRequest.headers().set( + HttpHeaderNames.COOKIE, + ClientCookieEncoder.STRICT.encode(this.cookies)); + } + + if (this.host != null) { + httpRequest.headers().set(HttpHeaderNames.HOST, host); + } else { + httpRequest.headers().set(HttpHeaderNames.HOST, hostPortPair.getKey()); + } + if (this.username != null && this.password != null) { + httpRequest.headers().set(HttpHeaderNames.AUTHORIZATION, + "Basic " + Base64.getEncoder().encodeToString((this.username + ":" + this.password).getBytes())); + } + + long waitTime = 0L; + this.httpClientHandler.setStartTimestamp(waitTime); + this.channel.writeAndFlush(httpRequest); + this.channel.closeFuture().sync(); + } catch (URISyntaxException | SSLException | InterruptedException ex) { + throw new RuntimeException(ex.getCause()); + } + } + + @Override + public void doPost(BaseRequest request) { + try { + createHttpClient(); + this.httpClientHandler.setRequest(request); + Pair hostPortPair = this.getHostPortFromUrl(request.getRequestUrl()); + + SslContext sslContext = this.useSslContext(request.getRequestUrl()); + this.bootstrap.handler(new TankHttpClientInitializer(this.httpProxyHandler, sslContext, this.httpClientHandler)); + + this.channel = this.bootstrap.connect(hostPortPair.getLeft(), hostPortPair.getRight()).sync().channel(); + this.setConnectionTimeout(60000); + + FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, + HttpMethod.POST, new URI(request.getRequestUrl()).getRawPath()); + httpRequest.headers().set(HttpHeaderNames.HOST, hostPortPair.getKey()); + httpRequest.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); + httpRequest.headers().set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP); + + if (this.cookies.size() > 0) { + this.httpClientHandler.setCookieList(this.cookies); + httpRequest.headers().set( + HttpHeaderNames.COOKIE, + ClientCookieEncoder.STRICT.encode(this.cookies)); + } + + if (this.host != null) { + httpRequest.headers().set(HttpHeaderNames.HOST, host); + } else { + httpRequest.headers().set(HttpHeaderNames.HOST, hostPortPair.getKey()); + } + if (this.username != null && this.password != null) { + httpRequest.headers().set(HttpHeaderNames.AUTHORIZATION, + "Basic " + Base64.getEncoder().encodeToString((this.username + ":" + this.password).getBytes())); + } + + String requestBody = request.getBody(); + ByteBuf byteBuf = Unpooled.copiedBuffer(requestBody, StandardCharsets.UTF_8); + httpRequest.content().clear().writeBytes(byteBuf); + + long waitTime = 0L; + this.httpClientHandler.setStartTimestamp(waitTime); + this.channel.writeAndFlush(httpRequest); + this.channel.closeFuture().sync(); + } catch (URISyntaxException | SSLException | InterruptedException ex) { + throw new RuntimeException(ex.getCause()); + } + } + + @Override + public void addAuth(AuthCredentials creds) { + this.username = creds.getUserName(); + this.password = creds.getPassword(); + this.host = creds.getHost(); + } + + @Override + public void clearSession() { + if (this.cookies.size() > 0) { + this.cookies.clear(); + } + + if (this.group != null) { + this.group.shutdownGracefully(); + } + } + + @Override + public void setCookie(TankCookie cookie) { + DefaultCookie defaultCookie = new DefaultCookie(cookie.getName(), cookie.getValue()); + defaultCookie.setDomain(cookie.getDomain()); + defaultCookie.setPath(cookie.getPath()); + this.cookies.add(defaultCookie); + } + + @Override + public void setProxy(String proxyhost, int proxyport) { + if (StringUtils.isNotBlank(proxyhost)) { + this.httpProxyHandler = new HttpProxyHandler(new InetSocketAddress(proxyhost, proxyport)); + } + } +} \ No newline at end of file diff --git a/agent/http_client_6/src/main/java/com/intuit/tank/httpclient6/utils/TankHttpClientHandler.java b/agent/http_client_6/src/main/java/com/intuit/tank/httpclient6/utils/TankHttpClientHandler.java new file mode 100644 index 000000000..f3871d811 --- /dev/null +++ b/agent/http_client_6/src/main/java/com/intuit/tank/httpclient6/utils/TankHttpClientHandler.java @@ -0,0 +1,126 @@ +package com.intuit.tank.httpclient6.utils; + +import com.intuit.tank.http.BaseRequest; +import com.intuit.tank.http.BaseResponse; +import com.intuit.tank.http.TankHttpUtil; +import com.intuit.tank.logging.LogEventType; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.handler.codec.http.HttpContent; +import io.netty.handler.codec.http.HttpObject; +import io.netty.handler.codec.http.HttpResponse; +import io.netty.handler.codec.http.LastHttpContent; +import io.netty.handler.codec.http.cookie.Cookie; +import io.netty.handler.codec.http.cookie.DefaultCookie; +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.zip.GZIPInputStream; + +public class TankHttpClientHandler extends SimpleChannelInboundHandler { + + private static final Logger LOG = LogManager.getLogger(TankHttpClientHandler.class); + + private BaseRequest request; + private long startTimestamp; + private List cookieList; + + public void setRequest(BaseRequest request) { + this.request = request; + } + + public void setStartTimestamp(long startTimestamp) { + this.startTimestamp = startTimestamp; + } + + public void setCookieList(List cookieList) { + this.cookieList = cookieList; + } + + @Override + protected void channelRead0(ChannelHandlerContext channelHandlerContext, HttpObject msg) throws Exception { + long waitTime = System.currentTimeMillis() - this.startTimestamp; + BaseResponse finalResponse = this.request.getResponse(); + try { + if (msg instanceof HttpResponse) { + HttpResponse response = (HttpResponse) msg; + + Map headers = new HashMap<>(); + + String contentType = ""; + if (!response.headers().isEmpty()) { + for (CharSequence name : response.headers().names()) { + for (CharSequence value : response.headers().getAll(name)) { + if (name.equals("Content-Type")) { + contentType = value.toString(); + } + + headers.put(name.toString(), value.toString()); + } + } + } + + if (finalResponse == null) { + finalResponse = TankHttpUtil.newResponseObject(contentType); + request.setResponse(finalResponse); + } + finalResponse.setResponseTime(waitTime); + + finalResponse.setHttpMessage(response.getStatus().reasonPhrase()); + finalResponse.setHttpCode(response.getStatus().code()); + + for (Map.Entry header : headers.entrySet()) { + finalResponse.setHeader(header.getKey(), header.getValue()); + } + + if (cookieList != null) { + for (Cookie cookie : cookieList) { + finalResponse.setCookie(cookie.name(), cookie.value()); + } + } + } + if (msg instanceof HttpContent) { + String contentType = finalResponse.getHttpHeader("Content-Type"); + String contentEncode = finalResponse.getHttpHeader("Content-Encoding"); + HttpContent content = (HttpContent) msg; + byte[] bResponse = content.content().array(); + + byte[] currentResponse = finalResponse.getResponseBytes(); + if (currentResponse == null) { + currentResponse = new byte[]{}; + } + + byte[] newResponse = new byte[currentResponse.length + bResponse.length]; + System.arraycopy(currentResponse, 0, newResponse, 0, currentResponse.length); + System.arraycopy(bResponse, 0, newResponse, currentResponse.length, bResponse.length); + finalResponse.setResponseBody(newResponse); + + if (content instanceof LastHttpContent) { + if (BaseResponse.isDataType(contentType) && contentEncode != null + && contentEncode.toLowerCase().contains("gzip")) { + // decode gzip for data types + try (GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(bResponse)); + ByteArrayOutputStream out = new ByteArrayOutputStream()) { + IOUtils.copy(in, out); + bResponse = out.toByteArray(); + } catch (IOException | NullPointerException ex) { + LOG.warn(request.getLogUtil().getLogMessage("cannot decode gzip stream: {}" + ex, LogEventType.System)); + } + } + + finalResponse.logResponse(); + channelHandlerContext.close(); + } + } + } catch (Exception ex) { + LOG.warn("Unable to get response: " + ex.getMessage()); + } + } +} \ No newline at end of file diff --git a/agent/http_client_6/src/main/java/com/intuit/tank/httpclient6/utils/TankHttpClientInitializer.java b/agent/http_client_6/src/main/java/com/intuit/tank/httpclient6/utils/TankHttpClientInitializer.java new file mode 100644 index 000000000..11a26a95d --- /dev/null +++ b/agent/http_client_6/src/main/java/com/intuit/tank/httpclient6/utils/TankHttpClientInitializer.java @@ -0,0 +1,42 @@ +package com.intuit.tank.httpclient6.utils; + +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelPipeline; +import io.netty.channel.socket.SocketChannel; +import io.netty.handler.codec.http.HttpClientCodec; +import io.netty.handler.codec.http.HttpContentDecompressor; +import io.netty.handler.proxy.HttpProxyHandler; +import io.netty.handler.ssl.SslContext; + +public class TankHttpClientInitializer extends ChannelInitializer { + + private final HttpProxyHandler httpProxyHandler; + private final SslContext sslContext; + private final TankHttpClientHandler httpClientHandler; + + public TankHttpClientInitializer(HttpProxyHandler httpProxyHandler, SslContext sslContext, + TankHttpClientHandler httpClientHandler) { + this.httpProxyHandler = httpProxyHandler; + this.sslContext = sslContext; + this.httpClientHandler = httpClientHandler; + } + + @Override + protected void initChannel(SocketChannel socketChannel) throws Exception { + ChannelPipeline channelPipeline = socketChannel.pipeline(); + + if (sslContext != null) { + channelPipeline.addLast(sslContext.newHandler(socketChannel.alloc())); + } + + if (httpProxyHandler != null) { + channelPipeline.addLast(httpProxyHandler); + } + + channelPipeline.addLast(new HttpClientCodec()); + + channelPipeline.addLast(new HttpContentDecompressor()); + + channelPipeline.addLast(this.httpClientHandler); + } +} \ No newline at end of file diff --git a/agent/http_client_6/src/main/resources/log4j2.xml b/agent/http_client_6/src/main/resources/log4j2.xml new file mode 100644 index 000000000..ad393bcaa --- /dev/null +++ b/agent/http_client_6/src/main/resources/log4j2.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/agent/http_client_6/src/test/java/com/intuit/tank/httpclient6/MockBaseRequest.java b/agent/http_client_6/src/test/java/com/intuit/tank/httpclient6/MockBaseRequest.java new file mode 100644 index 000000000..4f1136e6d --- /dev/null +++ b/agent/http_client_6/src/test/java/com/intuit/tank/httpclient6/MockBaseRequest.java @@ -0,0 +1,26 @@ +package com.intuit.tank.httpclient6; + +import com.intuit.tank.http.BaseRequest; +import com.intuit.tank.http.TankHttpClient; + +public class MockBaseRequest extends BaseRequest { + + protected MockBaseRequest(TankHttpClient httpClient) { + super(httpClient, new MockLogUtil()); + } + + @Override + public void setKey(String key, String value) { + + } + + @Override + public String getKey(String key) { + return null; + } + + @Override + public void setNamespace(String name, String value) { + + } +} \ No newline at end of file diff --git a/agent/http_client_6/src/test/java/com/intuit/tank/httpclient6/MockLogUtil.java b/agent/http_client_6/src/test/java/com/intuit/tank/httpclient6/MockLogUtil.java new file mode 100644 index 000000000..ea79cb669 --- /dev/null +++ b/agent/http_client_6/src/test/java/com/intuit/tank/httpclient6/MockLogUtil.java @@ -0,0 +1,68 @@ +/** + * + */ +package com.intuit.tank.httpclient6; + +import com.intuit.tank.http.TankHttpLogger; +import com.intuit.tank.logging.LogEventType; +import com.intuit.tank.logging.LoggingProfile; +import com.intuit.tank.vm.settings.AgentConfig; +import com.intuit.tank.vm.settings.TankConfig; +import org.apache.logging.log4j.message.ObjectMessage; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author denisa + * + */ +public class MockLogUtil implements TankHttpLogger { + + /* (non-Javadoc) + * @see com.intuit.tank.http.TankHttpLogger#getLogMessage(java.lang.String) + */ + @Override + public ObjectMessage getLogMessage(String msg) { + Map map = new HashMap(); + map.put("Message", msg); + return new ObjectMessage(map); + } + + /* (non-Javadoc) + * @see com.intuit.tank.http.TankHttpLogger#getLogMessage(java.lang.String, com.intuit.tank.logging.LogEventType) + */ + @Override + public ObjectMessage getLogMessage(String msg, LogEventType type) { + Map map = new HashMap(); + map.put("Message", msg); + return new ObjectMessage(map); + } + + /* (non-Javadoc) + * @see com.intuit.tank.http.TankHttpLogger#getLogMessage(java.lang.String, com.intuit.tank.logging.LogEventType, com.intuit.tank.logging.LoggingProfile) + */ + @Override + public ObjectMessage getLogMessage(String msg, LogEventType type, LoggingProfile profile) { + Map map = new HashMap(); + map.put("Message", msg); + return new ObjectMessage(map); + } + + /* (non-Javadoc) + * @see com.intuit.tank.http.TankHttpLogger#isTextMimeType(java.lang.String) + */ + @Override + public boolean isTextMimeType(String mimeType) { + return true; + } + + /* (non-Javadoc) + * @see com.intuit.tank.http.TankHttpLogger#getAgentConfig() + */ + @Override + public AgentConfig getAgentConfig() { + return new TankConfig().getAgentConfig(); + } + +} diff --git a/agent/http_client_6/src/test/java/com/intuit/tank/httpclient6/TankHttpClient6Test.java b/agent/http_client_6/src/test/java/com/intuit/tank/httpclient6/TankHttpClient6Test.java new file mode 100644 index 000000000..527d97cf8 --- /dev/null +++ b/agent/http_client_6/src/test/java/com/intuit/tank/httpclient6/TankHttpClient6Test.java @@ -0,0 +1,182 @@ +package com.intuit.tank.httpclient6; + +import com.intuit.tank.http.*; +import com.intuit.tank.test.TestGroups; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.io.IOException; +import java.net.URL; + +public class TankHttpClient6Test { + + @Test(groups = TestGroups.FUNCTIONAL) + public void testBasicAuth() { + BaseRequest request = getRequest(new TankHttpClient6(), "http://httpbin.org/basic-auth/test/test_pass"); + request.getHttpclient().addAuth(AuthCredentials.builder().withUserName("test").withPassword("test_pass").withHost("httpbin.org").withRealm("Fake Realm").withScheme(AuthScheme.Basic).build()); + + request.doGet(null); + BaseResponse response = request.getResponse(); + Assert.assertNotNull(response); + Assert.assertEquals(200, response.getHttpCode()); + Assert.assertNotNull(response.getBody()); + } + + @Test(groups = TestGroups.FUNCTIONAL) + public void doDelete() { + BaseRequest request = getRequest(new TankHttpClient6(), "http://httpbin.org/delete"); + request.doDelete(null); + BaseResponse response = request.getResponse(); + Assert.assertNotNull(response); + Assert.assertEquals(200, response.getHttpCode()); + } + + @Test(groups = TestGroups.FUNCTIONAL) + public void doGet() { + BaseRequest request = getRequest(new TankHttpClient6(), "http://httpbin.org/get"); + request.getHttpclient().addAuth(AuthCredentials.builder().withHost("httpbin.org").build()); + request.doGet(null); + BaseResponse response = request.getResponse(); + Assert.assertNotNull(response); + Assert.assertEquals(200, response.getHttpCode()); + Assert.assertNotNull(response.getBody()); + } + + @Test(groups = TestGroups.FUNCTIONAL) + public void doPost() { + BaseRequest request = getRequest(new TankHttpClient6(), "http://httpbin.org/post"); + request.doPost(null); + BaseResponse response = request.getResponse(); + Assert.assertNotNull(response); + Assert.assertEquals(200, response.getHttpCode()); + Assert.assertNotNull(response.getBody()); + } + + @Test(groups = TestGroups.FUNCTIONAL) + public void doPut() { + BaseRequest request = getRequest(new TankHttpClient6(), "http://httpbin.org/put"); + request.doPut(null); + BaseResponse response = request.getResponse(); + Assert.assertNotNull(response); + Assert.assertEquals(200, response.getHttpCode()); + } + + @Test(groups = TestGroups.FUNCTIONAL) + public void clearSession() { + BaseRequest request = getRequest(new TankHttpClient6(), "http://httpbin.org/cookies"); + request.getHttpclient().setCookie(TankCookie.builder().withName("test-cookie").withValue("test-value").withDomain("httpbin.org").withPath("/").build()); + request.doGet(null); + BaseResponse response = request.getResponse(); + Assert.assertNotNull(response); + Assert.assertEquals(200, response.getHttpCode()); + Assert.assertTrue(response.getBody().contains("test-cookie")); + request.getHttpclient().clearSession(); + + request.doGet(null); + response = request.getResponse(); + Assert.assertNotNull(response); + Assert.assertEquals(200, response.getHttpCode()); + Assert.assertTrue(!response.getBody().contains("test-cookie")); + } + + @Test(groups = TestGroups.FUNCTIONAL) + public void setCookie() { + BaseRequest request = getRequest(new TankHttpClient6(), "http://httpbin.org/cookies"); + request.getHttpclient().setCookie(TankCookie.builder().withName("test-cookie").withValue("test-value").withDomain("httpbin.org").withPath("/").build()); + request.doGet(null); + BaseResponse response = request.getResponse(); + Assert.assertNotNull(response); + Assert.assertEquals(200, response.getHttpCode()); + Assert.assertTrue(response.getBody().contains("test-cookie")); + } + + @Test(groups = TestGroups.MANUAL) + public void testSSL() { + BaseRequest request = getRequest(new TankHttpClient6(), "https://www.pcwebshop.co.uk/"); + request.doGet(null); + BaseResponse response = request.getResponse(); + Assert.assertNotNull(response); + } + + @Test(groups = TestGroups.FUNCTIONAL) + public void doPostMultipartwithFile() throws IOException { + BaseRequest request = getRequest(new TankHttpClient6(), "http://httpbin.org/post"); + request.setContentType(BaseRequest.CONTENT_TYPE_MULTIPART); + request.setBody( + "LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0xNzI2MTE1MzQ5Mjk4MjYNCkNvbnRlbnQ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JtbHlaV1p2ZUM4ME1TNHc8L3ZhbHVlPgogICAgICAgICAgICA8L2hlYWRlcj4KICAgICAgICAgICAgPGhlYWRlcj4KICAgICAgIC" + + "AgICAgICAgIDxrZXk+QWNjZXB0PC9rZXk+CiAgICAgICAgICAgICAgICA8dmFsdWU+ZEdWNGRDOW9kRzFzTEdGd2NHeHBZMkYwYVc5dUwzaG9kRzFzSzNodGJDe" + + "GhjSEJzYVdOaGRHbHZiaTk0Yld3N2NUMHdMamtzS2k4cU8zRTlNQzQ0PC92YWx1ZT4KICAgICAgICAgICAgPC9oZWFkZXI+CiAgICAgICAgICAgIDxoZWFkZXI+" + + "CiAgICAgICAgICAgICAgICA8a2V5PkFjY2VwdC1MYW5ndWFnZTwva2V5PgogICAgICAgICAgICAgICAgPHZhbHVlPlpXNHRWVk1zWlc0N2NUMHdMalU9PC92YWx1" + + "ZT4KICAgICAgICAgICAgPC9oZWFkZXI+CiAgICAgICAgICAgIDxoZWFkZXI+CiAgICAgICAgICAgICAgICA8a2V5PkFjY2VwdC1FbmNvZGluZzwva2V5PgogICAg" + + "ICAgICAgICAgICAgPHZhbHVlPlozcHBjQ3dnWkdWbWJHRjBaUT09PC92YWx1ZT4KICAgICAgICAgICAgPC9oZWFkZXI+CiAgICAgICAgICAgIDxoZWFkZXI+CiA" + + "gICAgICAgICAgICAgICA8a2V5PlJlZmVyZXI8L2tleT4KICAgICAgICAgICAgICAgIDx2YWx1ZT5hSFIwY0RvdkwybHVkR1Z5Ym1Gc0xYUmhibXN0Y0c5akxURX" + + "dNVGs0TVRjek56Z3VkWE10ZDJWemRDMHlMbVZzWWk1aGJXRjZiMjVoZDNNdVkyOXRMM05qY21sd2RITXZZM0psWVhSbFRtVjNVMk55YVhCMExtcHpaajlqYVdRO" + + "U1RPT08L3ZhbHVlPgogICAgICAgICAgICA8L2hlYWRlcj4KICAgICAgICAgICAgPGhlYWRlcj4KICAgICAgICAgICAgICAgIDxrZXk+Q29va2llPC9rZXk+CiA" + + "gICAgICAgICAgICAgICA8dmFsdWU+U2xORlUxTkpUMDVKUkQweU5VRXhNams1UVRBMU9EWkNSRVUwUkVNNFJrSTVNa1l5TVRCQlFqTkRRdz09PC92YWx1ZT4KIC" + + "AgICAgICAgICAgPC9oZWFkZXI+CiAgICAgICAgICAgIDxoZWFkZXI+CiAgICAgICAgICAgICAgICA8a2V5PkNvbm5lY3Rpb248L2tleT4KICAgICAgICAgICAgIC" + + "AgIDx2YWx1ZT5hMlZsY0MxaGJHbDJaUT09PC92YWx1ZT4KICAgICAgICAgICAgPC9oZWFkZXI+CiAgICAgICAgICAgIDxoZWFkZXI+CiAgICAgICAgICAgICAgIC" + + "A8a2V5PlgtUFJPWFktQVBQPC9rZXk+CiAgICAgICAgICAgICAgICA8dmFsdWU+Y21Wa2FYSmxZM1JEYjJ4c1lYQnpaUT09PC92YWx1ZT4KICAgICAgICAgICAgPC9" + + "oZWFkZXI+CiAgICAgICAgICAgIDxoZWFkZXI+CiAgICAgICAgICAgICAgICA8a2V5PlgtUmVkaXJlY3QtTG9jYXRpb248L2tleT4KICAgICAgICAgICAgICAgIDx2" + + "YWx1ZT5hSFIwY0RvdkwybHVkR1Z5Ym1Gc0xYUmhibXN0Y0c5akxURXdNVGs0TVRjek56Z3VkWE10ZDJWemRDMHlMbVZzWWk1aGJXRjZiMjVoZDNNdVkyOXRMM0J5Y" + + "jJwbFkzUnpMdz09PC92YWx1ZT4KICAgICAgICAgICAgPC9oZWFkZXI+CiAgICAgICAgPC9oZWFkZXJzPgogICAgPC9yZXF1ZXN0PgogICAgPHJlc3BvbnNlPgogIC" + + "AgICAgIDxmaXJzdExpbmU+SFRUUC8xLjEgMzA0IE5vdCBNb2RpZmllZDwvZmlyc3RMaW5lPgogICAgICAgIDxoZWFkZXJzPgogICAgICAgICAgICA8aGVhZGVyPgo" + + "gICAgICAgICAgICAgICAgPGtleT5EYXRlPC9rZXk+CiAgICAgICAgICAgICAgICA8dmFsdWU+VjJWa0xDQXpNQ0JUWlh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S0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTE3MjYxMTUzNDkyOTgyNg0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJqYXZheC5" + + "mYWNlcy5WaWV3U3RhdGUiDQoNCi0yMDU5ODE2MTg5MDc2NDYzMzg5Oi01NDAzNTEzNDYxNzE3MjAzMDUNCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tMTcyN" + + "jExNTM0OTI5ODI2LS0NCg=="); + request.doPost(null); + BaseResponse response = request.getResponse(); + Assert.assertNotNull(response); + Assert.assertEquals(200, response.getHttpCode()); + Assert.assertNotNull(response.getBody()); + } + + private BaseRequest getRequest(TankHttpClient client, String url) { + try { + URL u = new URL(url); + client.setHttpClient(null); + BaseRequest request = new MockBaseRequest(client); + request.setHost(u.getHost()); + request.setPort(u.getPort()); + request.setPath(u.getPath()); + request.setProtocol(u.getProtocol()); + return request; + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + } +} \ No newline at end of file diff --git a/agent/pom.xml b/agent/pom.xml index fb9c2165d..77401aec6 100644 --- a/agent/pom.xml +++ b/agent/pom.xml @@ -21,6 +21,7 @@ http_client_3 http_client_4 http_client_5 + http_client_6 agent_common diff --git a/api/src/main/java/com/intuit/tank/vm/settings/AgentConfig.java b/api/src/main/java/com/intuit/tank/vm/settings/AgentConfig.java index ded176a2a..d8d16ca98 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/AgentConfig.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/AgentConfig.java @@ -101,6 +101,7 @@ public AgentConfig(@Nonnull HierarchicalConfiguration config) { // 3.1">com.intuit.tank.httpclient3.TankHttpClient3 // com.intuit.tank.httpclient4.TankHttpClient4 + // 6">com.intuit.tank.httpclient6.TankHttpClient6 // List tankClients = config.configurationsAt(KEY_TANK_HTTP_CLIENTS); if (tankClients != null) { @@ -112,6 +113,7 @@ public AgentConfig(@Nonnull HierarchicalConfiguration config) { tankClientMap.put("Apache HttpClient 3.1", "com.intuit.tank.httpclient3.TankHttpClient3"); tankClientMap.put("Apache HttpClient 4.5", "com.intuit.tank.httpclient4.TankHttpClient4"); tankClientMap.put("Apache HttpClient 5", "com.intuit.tank.httpclient5.TankHttpClient5"); + tankClientMap.put("Async HttpClient", "com.intuit.tank.httpclient6.TankHttpClient6"); } resultsProviderMap = new HashMap(); resultsTypeMap = new HashMap(); diff --git a/api/src/main/resources/settings.xml b/api/src/main/resources/settings.xml index 33baad811..bac9f10b8 100644 --- a/api/src/main/resources/settings.xml +++ b/api/src/main/resources/settings.xml @@ -141,6 +141,8 @@ com.intuit.tank.httpclient5.TankHttpClient5 + com.intuit.tank.httpclient6.TankHttpClient6 + Apache HttpClient 5 diff --git a/doc/tank_installation_guide/en-US/configuration.xml b/doc/tank_installation_guide/en-US/configuration.xml index 553b2418d..8fb438d37 100755 --- a/doc/tank_installation_guide/en-US/configuration.xml +++ b/doc/tank_installation_guide/en-US/configuration.xml @@ -159,6 +159,7 @@ com.intuit.tank.httpclient3.TankHttpClient3 com.intuit.tank.httpclient4.TankHttpClient4 com.intuit.tank.okhttpclient.TankOkHttpClient + com.intuit.tank.httpclient6.TankHttpClient6 Apache HttpClient 4.5