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

net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK) #55

Closed
garbast opened this issue Dec 28, 2023 · 5 comments
Closed

net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK) #55

garbast opened this issue Dec 28, 2023 · 5 comments

Comments

@garbast
Copy link

garbast commented Dec 28, 2023

When opening a form with an included captcha the captcha is shown at first and after a few seconds it gets replace with an broken image icon and the error

net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)

Which leads to not being able to solve the captcha.

image

@maikschneider
Copy link
Owner

maikschneider commented Dec 28, 2023

Hey, please tell me the versions you are using.
Additionally, which browser are you using, do you have the same issue when using another?
I see that you are logged into the Backend: Does this happen when you are not logged in as well?

@garbast
Copy link
Author

garbast commented Dec 28, 2023

bw_captcha v3.1.0, TYPO3 12.4.9, PHP 8.2.7 with Chrome Version 120.0.6099.129 (Offizieller Build) (64-Bit).

Firefox 103.0.1 (64-Bit) does not complain about the content length.

Whats quirky is, that the error does not appear on refreshing the captcha image. It's wierd.

If the image would not vanish i wouldn't care to much, but currently the captcha is not usable as it is.

@garbast
Copy link
Author

garbast commented Dec 28, 2023

The problem only occures on the initial load because the Catcha Middleware only sets the Content-Length if the now parameter isn't set. Now only gets set in the refresh of the captcha. So this behaviour is correct.

I changed from:

            $contentLength = floor((strlen($binaryImage) + 2) / 3) * 4;
            $response = $response->withHeader('Content-Length', (string)$contentLength);

to:

$response = $response->withHeader('Content-Length', (string)strlen($binaryImage));

and the error is gone.

I quite do not get the calculation. The Content-Length should always match the binary values of the response body. So why doing math on the string length at all?

@maikschneider
Copy link
Owner

Ah, okay you're using an old version. This problem looks like #38 (the fix there introduced the problem). In #46 this should have been resolved. Could you please try to update to 4.0.2 and test again?

@garbast
Copy link
Author

garbast commented Dec 29, 2023

Sorry for not checking this first. My composer.json was missing ext-gd which resulted in an older version with composer req. I should have checked this first.

@garbast garbast closed this as completed Dec 29, 2023
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

2 participants