Handling inbound multipart HTTP POST messages
Added by George McFie almost 3 years ago
Any assistance with this would be appreciated.
I’ve created a Wt::WResource object to handle inbound messages from a third party application that issues multipart HTTP POST messages, and I’m able to successfully use the ‘handleRequest’ method’s Wt::Http::Request parameter to access the request headers and parameters of a regular non-multipart message.
However my difficulty is with multipart messages. It seems that although I can get access to the ‘Content Type’ header, I cannot access the headers associated with the various multipart parts of the message (such as ‘Content-Disposition’), and the ‘request.uploadedFiles()’ method returns an empty map – even though I can confirm (using Wireshark) that attachment files do exist.
In the Request.h header file I found the following code fragment and comment …
/*! \brief Returns the input stream for parsing the body.
*
- If the request was a POST with as contentType()
- "application/x-www-form-urlencoded" or "multipart/form-data", the
- input stream will already have been consumed by Wt's CGI parser,
- and made available as parameters in the request. */
std::istream& in() const;
… which seems to suggest that these parameters should be accessible, but I’m not sure how?