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

request body with 'chunked' transfer-encoding being re-encoded when forwarded #136

Closed
james-valente-simplisafe opened this issue Feb 5, 2015 · 3 comments

Comments

@james-valente-simplisafe

When gor captures an incoming request which uses a transfer-encoding of 'chunked', it re-encodes the chunked body when forwarding it. In the example below, the original incoming chunked body (of 56 characters in length) is being re-encoded as a chunked body (of 61 characters in length).


# ./gor --verbose --input-raw ':80'  --output-http localhost:9999
Version: 0.9.2

2015/02/05 20:52:27 Sending RAW Socket input: :80 :  POST /xxxxxx/sessions/findOne HTTP/1.1
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
Content-Type: application/bson
Host: foo.example.com
Connection: keep-alive
Transfer-Encoding: chunked

56
Vquery<token,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXoptions
0

# nc -k -l 9999
POST /xxxxxx/sessions/findOne HTTP/1.1
Host: foo.example.com
User-Agent: Go 1.1 package http
Transfer-Encoding: chunked
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
Connection: keep-alive
Content-Type: application/bson
Accept-Encoding: gzip

61
56
Vquery<token,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXoptions
0


0
@MartinNowak
Copy link
Contributor

We need to omit this block for chunked-encoding POSTs.
https://github.com/buger/gor/blob/92ba32156935c97d4614baa1255b6750f07c9cf1/output_http.go#L41

@MartinNowak
Copy link
Contributor

Introduced by #133.

@buger
Copy link
Owner

buger commented Jun 26, 2015

Should be fixed in 0.9.4 version

@buger buger closed this as completed Jun 26, 2015
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