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

data() signal also sends HTML data from multipart/form-data #31

Open
HappySeaFox opened this issue Jan 9, 2017 · 1 comment
Open

data() signal also sends HTML data from multipart/form-data #31

HappySeaFox opened this issue Jan 9, 2017 · 1 comment

Comments

@HappySeaFox
Copy link

Hi. I use QHTTP to implement an HTTP server supporting POST requests with multipart/form-data MIME. I've noticed that the QHttpRequest::data() signal transmits extra HTML headers plus the posted file itself.

I post a video file like that:

> curl.exe "http://127.0.0.1:5000/video.mp4" -F "file=@H:\video.mp4"
* About to connect() to 127.0.0.1 port 5000 (#0)
*   Trying 127.0.0.1...
* Adding handle: conn: 0x68a8d0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x68a8d0) send_pipe: 1, recv_pipe: 0
* Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0)
> POST /video.mp4 HTTP/1.1
> User-Agent: curl/7.32.0
> Host: 127.0.0.1:5000
> Accept: */*
> Content-Length: 129241953
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------39033ffa6ae3f23f
>
* Done waiting for 100-continue
< HTTP/1.1 200 OK
< connection: close
< date: Mon, 09 Jan 2017 20:27:44 GMT
<
* Closing connection 0

In data() signal I write all the incoming data into a file. After that in the file I see

--------------------------39033ffa6ae3f23f
Content-Disposition: form-data; name="file"; filename="video.mp4"
Content-Type: application/octet-stream

binary video data....
@demiantres
Copy link

This is normal behavior with multi-part forms. You have to parse the body.

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

2 participants