buger / goreplay

GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.
https://goreplay.org
Other
18.53k stars 13 forks source link

can't catch response with --input-raw-track-response #1127

Open tianxiao1988 opened 1 year ago

tianxiao1988 commented 1 year ago

I'm using goreplay to capture request and response. My command is: gor --input-raw :8080 --output-stdout --input-raw-track-response. On Mac os, I can capture the request and response, but the response is strange, it's not a valid response, looks like:

2 d78522b57f000001012812a1 1663669556688042000 246000 HTTP/1.1 200 Vary: Origin Vary: Access-Control-Request-Method Vary: Access-Control-Request-Headers Content-Type: application/json Transfer-Encoding: chunked Date: Tue, 20 Sep 2022 10:25:56 GMT Keep-Alive: timeout=60 Connection: keep-alive

2ca {"code":200, "msg":"abcd"} 0

🐵🙈🙉

On Linux, the same api and same gor command, I can't capture response, only request.

I don't know why. gor version is 1.3.3

buger commented 1 year ago

Hi! It is not stange, it is standard looking HTTP message, for chunked encoding. 2ca indicates how much bytes to read next, and 0 means message is finished. So thats exactly how your server received the data. If you want more human optimised version you can add --prettify-http flag.

As for linux try adding --input-raw-override-snaplen argument.

tianxiao1988 commented 1 year ago

Thanks replay~~

but add --input-raw-override-snaplen still not work, any other suggestion ?

tianxiao1988 commented 1 year ago

also try to add input-raw-buffer-size 10485760, add --prettify-http, but not work either @buger need your help~~~