Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

logspam when reponse has no content #384

Open
jtnord opened this issue Oct 11, 2021 · 1 comment
Open

logspam when reponse has no content #384

jtnord opened this issue Oct 11, 2021 · 1 comment

Comments

@jtnord
Copy link

jtnord commented Oct 11, 2021

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

String contentType = HttpHeaders.getHeader(httpResponse, HttpHeaderNames.CONTENT_TYPE);
if (contentType == null) {
log.warn("No content type specified in response from {}. Content will be treated as {}", originalRequest.getUri(), BrowserUpHttpUtil.UNKNOWN_CONTENT_TYPE);
contentType = BrowserUpHttpUtil.UNKNOWN_CONTENT_TYPE;
}

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();
  1. go to any page that returns no content (like a redirect)
  2. 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:

  • OS: windows.
  • Browser firefox from selenium/standalone-firefox-debug:3.141.59
  • Version
  • version of browseup 2.1.2

Additional context
Add any other context about the problem here.

@jtnord
Copy link
Author

jtnord commented Oct 11, 2021

one of the offending response as seen by firefox :
image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant