SpectoLabs / hoverfly

Lightweight service virtualization/ API simulation / API mocking tool for developers and testers
https://hoverfly.io
Apache License 2.0
2.35k stars 208 forks source link

Responses with status code 204 over HTTPS not working as expected #1122

Closed jonas-z-ericsson closed 2 months ago

jonas-z-ericsson commented 6 months ago

Description of the bug

https://datatracker.ietf.org/doc/html/rfc7230#section-3.3

All 1xx (Informational), 204 (No Content), and 304 (Not Modified) responses do not include a message body.

But when receiving e.g. a 204 when using HTTPS the receiving buffer contains '0\r\n'. This will break some http clients.

It is probably related to this bug: https://github.com/SpectoLabs/hoverfly/issues/865

But now it only has that behaviour for requests with method HEAD: https://github.com/SpectoLabs/hoverfly/blob/master/vendor/github.com/SpectoLabs/goproxy/https.go#L289

Steps to reproduce the issue

Same as https://github.com/SpectoLabs/hoverfly/issues/865

Observed result

Hoverfly error messages seen (If none, say none)

None

Some clients can't handle this behaviour properly, e.g. jetty-client 12.0.7 for Java.

image

If possible, add screenshots to help explain your problem

Expected result

Additional relevant information

  1. Hoverfly version: 1.8.0
  2. Anything that might help us to diagnose the problem
tommysitu commented 2 months ago

It's definitely a recursion, I can fix it in the coming release.

hjalle83 commented 3 weeks ago

I got it working with the new version! 👍