Skip to content

Commit 57b1851

Browse files
committed
Fix and more tests
1 parent 0f27643 commit 57b1851

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

dd-java-agent/appsec/src/main/java/com/datadog/appsec/gateway/AppSecRequestContext.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public class AppSecRequestContext implements DataBundle, Closeable {
163163

164164
private volatile boolean wafBlocked;
165165
private volatile String blockingResponseContentType;
166-
private volatile int blockingResponseContentLength = -1;
166+
private volatile Integer blockingResponseContentLength;
167167
private volatile boolean wafErrors;
168168
private volatile boolean wafTruncated;
169169
private volatile boolean wafRequestBlockFailure;
@@ -247,11 +247,11 @@ public String getBlockingResponseContentType() {
247247
return blockingResponseContentType;
248248
}
249249

250-
public void setBlockingResponseContentLength(int contentLength) {
250+
public void setBlockingResponseContentLength(Integer contentLength) {
251251
this.blockingResponseContentLength = contentLength;
252252
}
253253

254-
public int getBlockingResponseContentLength() {
254+
public Integer getBlockingResponseContentLength() {
255255
return blockingResponseContentLength;
256256
}
257257

dd-java-agent/appsec/src/main/java/com/datadog/appsec/gateway/GatewayBridge.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -936,8 +936,8 @@ private NoopFlow onRequestEnded(RequestContext ctx_, IGSpanInfo spanInfo) {
936936
String blockingContentType = ctx.getBlockingResponseContentType();
937937
if (blockingContentType != null) {
938938
traceSeg.setTagTop("http.response.headers.content-type", blockingContentType);
939-
int blockingContentLength = ctx.getBlockingResponseContentLength();
940-
if (blockingContentLength >= 0) {
939+
Integer blockingContentLength = ctx.getBlockingResponseContentLength();
940+
if (blockingContentLength != null) {
941941
traceSeg.setTagTop(
942942
"http.response.headers.content-length", String.valueOf(blockingContentLength));
943943
}

0 commit comments

Comments
 (0)