-
Notifications
You must be signed in to change notification settings - Fork 158
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
Document collectData() #14
Comments
OK, so I found the documentation for it, and it was great :) But really hard to find being on the abstract class for server and all. Also I found a bug: void collectData(int atMost) { In declaration it is stated taht atMost can be set to -1 to mean "unlimited" however this generates sigsegv crash because reserve(-1) is not valid. |
@mrdeveloperdude sorry to be so late! thank you for reporting the |
Handling of reserve(-1) fixes the sigsegv crashes but POST body still isn't collected. |
Same here! What Knobtviker says... |
Well, it is possible to connect to the signal
Currently, I connect to |
Thanks @hoensr after I patched it in my implementation, I was able to gather POST body data. |
I'm trying to refactor the thanks @hoensr and others, i will be happy if you dudes bring up more suggestions. |
@mrdeveloperdude @hoensr @knobtviker please check the it would be great if you can find some time and test this branch.
|
Hi all, Maybe i should open a new bug but i'm now in trouble still working on this topic (form data upload) since the headers of a request appear to be case lowered and this is making impossibile to accept a form-data request since in some cases (as chrome does but not Firefox) the data boundary pattern is given with both lower and uppercase letters making impossible to decode correctly the request (since the value i'm looking for it's different from what i can read into the body request!). Imho Chrome is absolutely right since the pattern should be any acceptable combinations of letters/numbers that is not present in any part of the binary data the browser will send, so limiting the browser to lower case combinations for the boundary is wrong since may interefere with its actual needs to fulfill the request. Firefox seems to work fine just because it's sending just numbers... no effect on it! Thanks |
@gianks and for http header please have a look at: HTTP/1.1 - sec 4.2 as defined by HTTP standards:
by the way I'm interested to know why some tools rely on case-sensitive HTTP header. |
Hi and thanks for tour quick reply! |
yupp, that's right. but the header values are not required to be case sensitive by standard, it's really confusing, for example the value of but in general it's good idea to update |
I agree 100%. Just when surely well known headers should be lowered even in values otherwise provided as they are. Thanks |
yes i will. don't have any schedule for this issue, try to update asap. |
Hi, thanks for all the good work. I'm also facing some troubles with collectData. The code I'm using is adapted from version-2.1 with the remarks from this thread. I can't use the latest branch as it requires c++14 as minimum, which I can't use in my project. It seems that there is a timing issue when the data is read. Let me illustrate that with an example. Let's say my server will simply answer a PUT request with a 200 code if it can read the body, and will throw a 400 error code if it can't. The result is: sometimes it works, sometimes it doesn't... While sniffing the network during an unsuccessful attempt, the following packets were exchanged (in that order):
The server gave its 400 answer before the body arrived. That shows that the server doesn't wait until the message is complete to answer. The only workaround I could find to make it sort of work temporarily is to delay a little bit the parsing (usleep in HttpParser constructor in qhttpbase...). But that's not viable. Does anyone have a patch/idea to fix this? |
Hi 7hibault, I have switched to the dev branch although I use VS2013 without complete c++14 support. But there are only a few places which use c++14 features and I had to change. See this comment. Maybe that would help with your problem? |
Hi!
I'm struggling with implementing a server. I started out with keep-alive example but for some reason the json body received always appears to be 0 bytes long (it is in fact not, I tested with other non-qhttp servers (php and netcat) and they receive the 84 bytes of json data just fine).
I think the bug in my software is caused by my lack of understasnding of the collectData() call. What is the integer parameter it accepts? Can I omit the call to collectData() and still get request body? What are other possible causes of receiving empty body in request? How should I go about debugging this?
Thanks!
PS: Big fan of your work!
The text was updated successfully, but these errors were encountered: