goreplay icon indicating copy to clipboard operation
goreplay copied to clipboard

response content is empty

Open niweicumt opened this issue 10 years ago • 11 comments

command is : ./gor --input-raw-track-response --input-raw :8091 --output-file gor-online-%Y-%m-%d-%H.log --output-file-append

The file content such as `1 aa68af31e867351db27f3c809cb71749c0a1c6ef 1469496083197538395 GET /v3/order/generate?activityGoodsInfos=1231630%3A1%2C1184858%3A1&address_id=1371798&ap p_version=IOS_2.5.0&area_id=720229&client=2&coupon_id=30640810&delivery_time=%E4%B8%80%E5 %B0%8F%E6%97%B6%E4%B9%8B%E5%86%85&freight_type=1&goodsInfos=1515256%3A5%2C2634241%3A1%2C2 634268%3A1%2C1275654%3A1%2C1365139%3A1%2C1184852%3A6%2C1184846%3A1%2C1184845%3A1%2C118484 7%3A1&isUseDDP=false&is_use_balance=true&order_type=0&org_id=615&pay_id=1&postscript=&pro mo_code=&token=228568ed877b41a2a20f820a11651793_150&userId=a822591dbd6b22d42f8217407a5266 05cbd30843&user_id=a822591dbd6b22d42f8217407a526605cbd30843&verifyCode=Toax0gq-65kg-2JWOE BHVXL3R5XSKOYYOOJ3MPQ-7r&verify_code=Toax0gq-65kg-2JWOEBHVXL3R5XSKOYYOOJ3MPQ-7r HTTP/1.0 RemoteIp: 117.136.67.167 Host: m.8dol.com X-Forwarded-For: 117.136.67.167 Connection: close Accept: / User-Agent: 8Dol/2.5.0 (iPhone; iOS 9.3.2; Scale/2.00) Accept-Language: zh-Hans-CN;q=1 Accept-Encoding: gzip, deflate

GorRequestId=aa68af31e867351db27f3c809cb71749c0a1c6ef&

2 aa68af31e867351db27f3c809cb71749c0a1c6ef 458922218 HTTP/1.1 200 OK Server: Apache-Coyote/1.1 X-Application-Context: application:produce:8091 Content-Type: application/json;charset=UTF-8 Content-Encoding: gzip Vary: Accept-Encoding Date: Tue, 26 Jul 2016 01:21:23 GMT Connection: close

1 bdbdb8758e6737bf43aeefca6a4ba3ee55a51cb4 1469496168823298173 GET /order/confirmOrder?order_type=0&activityGoodsInfos=&client=3&app_version=AD_2.2.8&ap pVersion=AD_2.2.8&user_id=cb9a6fb1a91bda86f7bb59721b651ae4a2339b14&userId=cb9a6fb1a91bda8 6f7bb59721b651ae4a2339b14&verify_code=Toax0pz-90cx-NDG26FPFBO5LVFH2OS6J7EIRUE-fg&verifyCo de=Toax0pz-90cx-NDG26FPFBO5LVFH2OS6J7EIRUE-fg&randomString=96CR8SBZ8WRT&org_id=364&goodsI nfos=733560:1&area_id=672806 HTTP/1.0 RemoteIp: 114.221.125.197 Host: m.8dol.com X-Forwarded-For: 114.221.125.197 Connection: close Accept-Encoding: gzip, deflate Accept: / User-Agent: python-requests/2.9.1

GorRequestId=bdbdb8758e6737bf43aeefca6a4ba3ee55a51cb4&

2 bdbdb8758e6737bf43aeefca6a4ba3ee55a51cb4 728173488 HTTP/1.1 200 OK Server: Apache-Coyote/1.1 X-Application-Context: application:produce:8091 Content-Type: application/json;charset=UTF-8 Content-Encoding: gzip Vary: Accept-Encoding Date: Tue, 26 Jul 2016 01:22:49 GMT Connection: close

`

In response entity is empty. Why?

niweicumt avatar Jul 26 '16 02:07 niweicumt

Does it happen consistently or from time to time?

HTTP request have body when it have non zero Content-Length header, or Transfer-Encoding: chunked. I do not see any of those.

It can be that it is expected that server returned empty body. If you think it is not expected and this situation can be replicated, can you install wireshark and send me traffic dump?

On Tuesday, 26 July 2016, niwei [email protected] wrote:

command is : ./gor --input-raw-track-response --input-raw :8091 --output-file gor-online-%Y-%m-%d-%H.log --output-file-append

The file content such as `1 aa68af31e867351db27f3c809cb71749c0a1c6ef 1469496083197538395 GET /v3/order/generate?activityGoodsInfos=1231630%3A1%2C1184858%3A1&address_id=1371798&ap

p_version=IOS_2.5.0&area_id=720229&client=2&coupon_id=30640810&delivery_time=%E4%B8%80%E5

%B0%8F%E6%97%B6%E4%B9%8B%E5%86%85&freight_type=1&goodsInfos=1515256%3A5%2C2634241%3A1%2C2

634268%3A1%2C1275654%3A1%2C1365139%3A1%2C1184852%3A6%2C1184846%3A1%2C1184845%3A1%2C118484

7%3A1&isUseDDP=false&is_use_balance=true&order_type=0&org_id=615&pay_id=1&postscript=&pro

mo_code=&token=228568ed877b41a2a20f820a11651793_150&userId=a822591dbd6b22d42f8217407a5266

05cbd30843&user_id=a822591dbd6b22d42f8217407a526605cbd30843&verifyCode=Toax0gq-65kg-2JWOE BHVXL3R5XSKOYYOOJ3MPQ-7r&verify_code=Toax0gq-65kg-2JWOEBHVXL3R5XSKOYYOOJ3MPQ-7r HTTP/1.0 RemoteIp: 117.136.67.167 Host: m.8dol.com X-Forwarded-For: 117.136.67.167 Connection: close Accept: / User-Agent: 8Dol/2.5.0 (iPhone; iOS 9.3.2; Scale/2.00) Accept-Language: zh-Hans-CN;q=1 Accept-Encoding: gzip, deflate

GorRequestId=aa68af31e867351db27f3c809cb71749c0a1c6ef&

2 aa68af31e867351db27f3c809cb71749c0a1c6ef 458922218 HTTP/1.1 200 OK Server: Apache-Coyote/1.1 X-Application-Context: application:produce:8091 Content-Type: application/json;charset=UTF-8 Content-Encoding: gzip Vary: Accept-Encoding Date: Tue, 26 Jul 2016 01:21:23 GMT Connection: close

1 bdbdb8758e6737bf43aeefca6a4ba3ee55a51cb4 1469496168823298173 GET /order/confirmOrder?order_type=0&activityGoodsInfos=&client=3&app_version=AD_2.2.8&ap

pVersion=AD_2.2.8&user_id=cb9a6fb1a91bda86f7bb59721b651ae4a2339b14&userId=cb9a6fb1a91bda8

6f7bb59721b651ae4a2339b14&verify_code=Toax0pz-90cx-NDG26FPFBO5LVFH2OS6J7EIRUE-fg&verifyCo

de=Toax0pz-90cx-NDG26FPFBO5LVFH2OS6J7EIRUE-fg&randomString=96CR8SBZ8WRT&org_id=364&goodsI nfos=733560:1&area_id=672806 HTTP/1.0 RemoteIp: 114.221.125.197 Host: m.8dol.com X-Forwarded-For: 114.221.125.197 Connection: close Accept-Encoding: gzip, deflate Accept: / User-Agent: python-requests/2.9.1

GorRequestId=bdbdb8758e6737bf43aeefca6a4ba3ee55a51cb4&

2 bdbdb8758e6737bf43aeefca6a4ba3ee55a51cb4 728173488 HTTP/1.1 200 OK Server: Apache-Coyote/1.1 X-Application-Context: application:produce:8091 Content-Type: application/json;charset=UTF-8 Content-Encoding: gzip Vary: Accept-Encoding Date: Tue, 26 Jul 2016 01:22:49 GMT Connection: close

`

In response entity is empty. Why?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/buger/gor/issues/346, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA2uV3VTD-o6jm_1YWlMtz5txCPcggGks5qZXONgaJpZM4JUu8z .


Sincerely yours Leonid Bugaev http://gortool.com - test your system with real data

buger avatar Jul 26 '16 05:07 buger

This is a good point! I will try to prepare patch in next few days.

On Tuesday, 26 July 2016, niwei [email protected] wrote:

yes.

I put gor to production environment, then get every response entity is empty.

Although the response have no Content-Length header, it's response header have Connection: close.So according HTTP RFC https://tools.ietf.org/html/rfc2616#section-4.4 if the message is terminated by closing the connection we could parse the response.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/buger/gor/issues/346#issuecomment-235170196, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA2uZwMMEx2gYmv1xgPbvRwFMlfbVbnks5qZaF2gaJpZM4JUu8z .


Sincerely yours Leonid Bugaev http://gortool.com - test your system with real data

buger avatar Jul 26 '16 05:07 buger

OK. Could i do parse response entity in middleware?

niweicumt avatar Jul 26 '16 06:07 niweicumt

I do not think so, it trims response body while intercepting traffic, and your middleware won't see it as well. Fix should be made in raw_listener package. Currently it does not check for connection close header, and immediately dispatch response without waiting for body.

PRO version also can handle such bodies when you intercept traffic in binary mode.

On Tuesday, 26 July 2016, niwei [email protected] wrote:

OK. Could i do parse in middleware to get response entity have content?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/buger/gor/issues/346#issuecomment-235172456, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA2uciTRZQga3fExBuNVvfs1JgXnKz1ks5qZaV9gaJpZM4JUu8z .


Sincerely yours Leonid Bugaev http://gortool.com - test your system with real data

buger avatar Jul 26 '16 06:07 buger

https://gortool.com

On Tuesday, 26 July 2016, niwei [email protected] wrote:

Where can I get PRO version ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/buger/gor/issues/346#issuecomment-235175099, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA2udqktP8hkRdfBjw2X-mAd1SrLFWHks5qZanKgaJpZM4JUu8z .


Sincerely yours Leonid Bugaev http://gortool.com - test your system with real data

buger avatar Jul 26 '16 06:07 buger

oh... seems we need to another solution.

niweicumt avatar Jul 27 '16 13:07 niweicumt

Well, I would say this bug should be fixed at start of the next week. Or you mean Gor does not fit you because another reason?

Thanks!

buger avatar Jul 27 '16 13:07 buger

This issue should be fixed in latest master, here are binaries:

gor_fix-connection-close-body_mac.tar.gz gor_fix-connection-close-body_x64.tar.gz

buger avatar Jul 31 '16 17:07 buger

ok,thank u very much. I've used this version in our production env.I suggest that you merge this into next release version.

niweicumt avatar Aug 02 '16 06:08 niweicumt

@niweicumt New version v0.15.0 include those fixes.

buger avatar Aug 11 '16 08:08 buger

well, great job

niweicumt avatar Aug 18 '16 10:08 niweicumt