-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
cowboy multi frame http request handling #868
Comments
I did not fully understand this. There should be no issue with data arriving in separate packets, Cowboy does the reassembly itself. Can you show what the code you've written to handle the body looks like, and also give me what Cowboy version you're using? |
I used the following code to catch the body and i am using the master branch for my developments. {_, Body, _} = cowboy_req:body(Req), |
You have to keep track of the third element of the returned tuples for one, and you may need to call body more than once if it doesn't return 'ok' in the first element of the returned tuple. |
Hope that helped. Closing, thanks! |
Hi All,
Recently we made REST calls using android application. When the connection is on LTE the system worked fine and when the connection is slow it appeared that cowboy did not receive the body of the POST request. Investigations shows us that when the connection is slow android it self sends the http packets by multiple frames.
When it comes to the cowboy it did not process the body part even thought the data received to the ranch_tcp module. But after putting few logs in to "recv(Socket, Length, Timeout)" function in ranch_tcp we got the data but in separate function calls. Please refer the attachment for tcpdump image.
ranch_tcp recv :- {ok,<<"POST /rest/subscribers HTTP/1.1\r\nContent-Type: application/json\r\nContent-Length: 336\r\nHost: xxx.xx.xx.xxx:80\r\nConnection: Keep-Alive\r\n\r\n">>}
ranch_tcp recv :- {ok,<<"{"email":"xxxxxxxxxxxxxxxxx@xxxxxxxxxxxxx.com","password":"google pwd","imsi":"xxxxxxxxxxxxxxx","imei":"xxxxxxxxxxxxxxx","oauth_type":"google","nickname":"rsfggvg","image_url":"aHR0cHM6Ly9saDUuZ29vZ2xldXNlcmNvbnRlbyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy/c3o9NTA=","mobile":"xx@xxxxxxxxx"}">>}
Any idea how to solve this.
Thanks & Best Regards,
Nuwan
The text was updated successfully, but these errors were encountered: