Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Length not deleted on HTML rewrite if HTML Only #56

Open
mmartinsky opened this issue Oct 12, 2021 · 2 comments
Open

Content Length not deleted on HTML rewrite if HTML Only #56

mmartinsky opened this issue Oct 12, 2021 · 2 comments

Comments

@mmartinsky
Copy link

      /* Sniff out the content-type header.
       * If the response is HTML, we're safe to modify it.
       */
      if (!_htmlOnly && res.isHtml()) {
        res.removeHeader('Content-Length');
        delete headers['content-length'];
      }

If I have an HTML response, but I'm targeted to HTML only, the content length won't get overwritten, which leads to
"Error: Transferred a partial file" errors on the response.

Why is this guarded by !_htmlOnly?

@kilobyte2007
Copy link

This looks like a mistake and breaks some sites. Shouldn't it just be? @No9 can you please take a look?

 /* Sniff out the content-type header.
 * If the response is HTML, we're safe to modify it.
 */
if (res.isHtml()) {
  res.removeHeader('Content-Length');
  delete headers['content-length'];
}

@evantobin
Copy link

@kilobyte2007 I can confirm that change works

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

No branches or pull requests

3 participants