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

HttpRequest::getBody() is empty for IE XMLHttpRequest #124

Open
tius2000 opened this issue Jun 4, 2016 · 6 comments
Open

HttpRequest::getBody() is empty for IE XMLHttpRequest #124

tius2000 opened this issue Jun 4, 2016 · 6 comments
Labels

Comments

@tius2000
Copy link

tius2000 commented Jun 4, 2016

IE seems to sends XMLHttpRequest as two TCP packets (see https://josephscott.org/archives/2009/08/xmlhttprequest-xhr-uses-multiple-packets-for-http-post). I could verify this for a simple request with IE11 on a win7 box using wireshark.

However, this seems to confuse Sming, it will report an empty request body. The webserver seems to handle fragmented packets not correctly.

A possible workaround might be to use GET instead of POST.

@hreintke
Copy link
Collaborator

hreintke commented Jun 4, 2016

@tius2000 :
I think the issue you are describing will be taken care of in the update @patrickjahns is preparing which adds http_upload functionality.

@tius2000
Copy link
Author

tius2000 commented Jun 4, 2016

Great! Thank you for the super-fast feedback @hreintke :-)

@avr39-ripe
Copy link
Contributor

@tius2000 try my ported fix by @patrickjahns
avr39-ripe@5b46bbe

@tius2000
Copy link
Author

tius2000 commented Jun 5, 2016

@avr39-ripe:
Sorry, I'm new to git - how can I apply your fix to my cloned local SmingRTOS files?

@avr39-ripe
Copy link
Contributor

https://github.com/avr39-ripe/SmingRTOS/commit/5b46bbe335f36098d1d22ee5a7ca8fd83ccd8e2e.patch

here is patch. download it into SmingRTOS dir, then patch < patch_nam.patch and viola :)

@tius2000
Copy link
Author

Thank you very much @avr39-ripe!
I applied the patch and XMLHttpRequest works with IE now, too 👍

However, there is a small side effect. The return value of getBody has changed from const char * to String. This means that an additional copy of the data needs to be allocated for parsing the posted data with JsonBuffer::parseObject(). While this no problem for my application, it might be inefficient for larger strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants