Skip to content
This repository was archived by the owner on Sep 6, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ When you build the latest code from source, you'll have access to the latest sna
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-core</artifactId>
<version>2.1.28-SNAPSHOT</version>
<version>2.1.29-SNAPSHOT</version>
<scope>test</scope>
</dependency>
```
2 changes: 1 addition & 1 deletion browsermob-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>browsermob-proxy</artifactId>
<groupId>net.lightbody.bmp</groupId>
<version>2.1.28-SNAPSHOT</version>
<version>2.1.29-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,22 @@ public HarCaptureFilter(HttpRequest originalRequest, ChannelHandlerContext ctx,
this.harEntry = new HarEntry(currentPageRef);
}

@Override
public HttpObject proxyToClientResponse(HttpObject httpObject) {
if (httpObject instanceof LastHttpContent) {
if (harEntry.getResponse().getStatus() == 0) {
HarCaptureFilter.logFailedRequestIfRequired(harEntry.getRequest(), harEntry.getResponse());
createStatsDClient();
statsDClient.get().increment(getProxyPrefix().concat(prepareMetric(harEntry.getRequest().getUrl()))
.concat("." + harEntry.getResponse().getStatus()).concat(".request_timeout"));
stopStatsDClient();

}
}

return super.proxyToClientResponse(httpObject);
}

@Override
public HttpResponse clientToProxyRequest(HttpObject httpObject) {
// if a ServerResponseCaptureFilter is configured, delegate to it to collect the client request. if it is not
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
package net.lightbody.bmp.filters;

import com.google.common.cache.CacheBuilder;
import com.timgroup.statsd.NonBlockingStatsDClient;
import com.timgroup.statsd.StatsDClient;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.HttpObject;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import net.lightbody.bmp.core.har.Har;
import net.lightbody.bmp.core.har.HarEntry;
import net.lightbody.bmp.core.har.HarRequest;
import net.lightbody.bmp.core.har.HarResponse;
import net.lightbody.bmp.core.har.HarTimings;
import net.lightbody.bmp.core.har.*;
import net.lightbody.bmp.filters.support.HttpConnectTiming;
import net.lightbody.bmp.filters.util.HarCaptureUtil;
import net.lightbody.bmp.util.HttpUtil;
Expand All @@ -25,8 +19,6 @@
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;

import static net.lightbody.bmp.filters.StatsDMetricsFilter.*;

/**
* This filter captures HAR data for HTTP CONNECT requests. CONNECTs are "meta" requests that must be made before HTTPS
* requests, but are not populated as separate requests in the HAR. Most information from HTTP CONNECTs (such as SSL
Expand All @@ -38,7 +30,6 @@
*/
public class HttpConnectHarCaptureFilter extends HttpsAwareFiltersAdapter implements ModifiedRequestAwareFilter {
private static final Logger log = LoggerFactory.getLogger(HttpConnectHarCaptureFilter.class);
private static final StatsDClient statsDClient = new NonBlockingStatsDClient("automated_tests", getStatsDHost(), getStatsDPort());

/**
* The currently active HAR at the time the current request is received.
Expand Down Expand Up @@ -336,8 +327,6 @@ private HarEntry createHarEntryForFailedCONNECT(String errorMessage) {

HarResponse response = HarCaptureUtil.createHarResponseForFailure();
harEntry.setResponse(response);
statsDClient.increment(getProxyPrefix().concat(prepareMetric(harEntry.getRequest().getUrl()))
.concat("." + harEntry.getResponse().getStatus()).concat(".failed_connect_request"));

response.setError(errorMessage);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class WhitelistTest extends MockServerTest {
@Test
void testWhitelistCannotShortCircuitCONNECT() {
HttpRequest request = mock(HttpRequest.class)
when(request.getMethod()).thenReturn(HttpMethod.CONNECT)
when(request.method()).thenReturn(HttpMethod.CONNECT)
when(request.uri()).thenReturn('somedomain.com:443')
when(request.protocolVersion()).thenReturn(HttpVersion.HTTP_1_1)

Expand Down
2 changes: 1 addition & 1 deletion browsermob-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>browsermob-proxy</artifactId>
<groupId>net.lightbody.bmp</groupId>
<version>2.1.28-SNAPSHOT</version>
<version>2.1.29-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion browsermob-legacy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>browsermob-proxy</artifactId>
<groupId>net.lightbody.bmp</groupId>
<version>2.1.28-SNAPSHOT</version>
<version>2.1.29-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion browsermob-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>browsermob-proxy</artifactId>
<groupId>net.lightbody.bmp</groupId>
<version>2.1.28-SNAPSHOT</version>
<version>2.1.29-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion mitm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>browsermob-proxy</artifactId>
<groupId>net.lightbody.bmp</groupId>
<version>2.1.28-SNAPSHOT</version>
<version>2.1.29-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-proxy</artifactId>
<version>2.1.28-SNAPSHOT</version>
<version>2.1.29-SNAPSHOT</version>
<modules>
<module>browsermob-core</module>
<module>browsermob-legacy</module>
Expand Down Expand Up @@ -176,11 +176,11 @@
<inherited>false</inherited>
<phase>install</phase>
<configuration>
<file>${basedir}/resources/jar/littleproxy-1.1.4.jar</file>
<file>${basedir}/resources/jar/littleproxy-1.1.5.jar</file>
<repositoryLayout>default</repositoryLayout>
<groupId>org.littleshoot</groupId>
<artifactId>littleproxy</artifactId>
<version>1.1.4</version>
<version>1.1.5</version>
<packaging>jar</packaging>
</configuration>
<goals>
Expand Down Expand Up @@ -308,7 +308,7 @@
<dependency>
<groupId>org.littleshoot</groupId>
<artifactId>littleproxy</artifactId>
<version>1.1.4</version>
<version>1.1.5</version>
</dependency>


Expand Down
Binary file removed resources/jar/littleproxy-1.1.4.jar
Binary file not shown.
Binary file added resources/jar/littleproxy-1.1.5.jar
Binary file not shown.