I created an HTTP listener that accepts POST requests for files. I followed this template almost exactly: https://github.com/cpp-netlib/cpp-netlib/blob/main/libs/network/example/http/echo_async_server.cpp
I start my listener like so: ./build/http_listener 0.0.0.0 8000
Then post file to the listener using curl: curl --form "[email protected]" -X POST http://127.0.0.1:8000/
I noticed that the variable body__
, which gets populated with the text of the file also gets populated with header data. I do not want this. How do I populate the variable body__
without any header data?
This is what it looks like:
body__
does not get populated with header data. What you see is multipart data that you submit with--form <name=content>
. If you want submit raw file data use another curl command:-X POST
can be omitted if is used with--data-binary
,--data
,--form
.Unfortunately curl does not send a file name. If a file name is required on a server side, specify the header
Content-Disposition
:KB