browserup / browserup-proxy

BrowserUp Proxy is a free utility to watch, test, and manipulate web application network traffic and performance.
https://browserup.com
Apache License 2.0
163 stars 42 forks source link

logspam when reponse has no content #384

Open jtnord opened 2 years ago

jtnord commented 2 years ago

Describe the bug

When a response to a request comes back from a server without any content type header the proxy creates a log entry

https://github.com/browserup/browserup-proxy/blob/26714e26fae728733a13a0f332bd0c6dcaa78de5/browserup-proxy-core/src/main/java/com/browserup/bup/filters/HarCaptureFilter.java#L484-L488

This is all fine and dandy - but the log is a warning and is logged even when the response should not have any content, or may not have content and does not (and hence it would not have any content type either).

Various HTTP responses like some of the 3xx or even the 201/202 are not expected to contain content.

This can be seen with the Jenkins ATH https://github.com/jenkinsci/acceptance-test-harness.

To Reproduce Steps to reproduce the behavior:

  1. Create a Proxy with HAR captruing like the following:
            proxy = new BrowserUpProxyServer();
            // enable more detailed HAR capture, if desired (see CaptureType for the complete list)
            proxy.enableHarCaptureTypes(
                    CaptureType.REQUEST_HEADERS,
                    CaptureType.REQUEST_CONTENT,
                    CaptureType.RESPONSE_HEADERS,
                    CaptureType.RESPONSE_CONTENT
            );
            proxy.setTrustAllServers(true);
            proxy.start();
  2. go to any page that returns no content (like a redirect)
  3. See error

Expected behavior

The error is only logged if the page also has content.

there is no log (info / warning etc) if the response legitimately has no content. (this could be if the response is a set of specific codes)

Screenshots

If applicable, add screenshots to help explain your problem.

image

The response to the above request is

Please complete the following information:

Additional context Add any other context about the problem here.

jtnord commented 2 years ago

one of the offending response as seen by firefox : image