|
ofxHTTP
A collection of tools for HTTP.
|
Public Member Functions | |
| PutRequest (const std::string &uri, const std::string &httpVersion=Poco::Net::HTTPMessage::HTTP_1_1) | |
| Construct a PutRequest with a given uri and http version. More... | |
| void | setPutFile (const std::string &filename) |
| Set the file to include in the body of the PUT request. More... | |
| void | setPutBuffer (const ofBuffer &buffer) |
| Set the buffer to include in the body of the PUT request. More... | |
| void | setContentRange (std::size_t startByte) |
| Set the start byte to include in the header of the PUT request. More... | |
| void | setContentRange (std::size_t startByte, std::size_t endByte) |
| Set the start byte to include in the header of the PUT request. More... | |
| void | setContentType (const std::string &contentType) |
| Set the content type for the put request. More... | |
| virtual void | prepareRequest () override |
| Prepare the current request. | |
| virtual void | writeRequestBody (std::ostream &requestStream) override |
| Write the body of the request. More... | |
Public Member Functions inherited from ofx::HTTP::FormRequest | |
| virtual | ~FormRequest () |
| Destroy this BaseReuqest. | |
| void | addFormField (const std::string &name, const std::string &value) |
| Add a name value pair to upload with this request. More... | |
| void | setFormField (const std::string &name, const std::string &value) |
| Set a name value pair to upload with this request. More... | |
| void | addFormFields (const Poco::Net::NameValueCollection &formFields) |
| Add additional form fields. More... | |
| void | addFormFields (const std::multimap< std::string, std::string > &formFields) |
| Add additional form fields. More... | |
| void | clearFormFields () |
| Clear all form fields. | |
Public Member Functions inherited from ofx::HTTP::Request | |
| Request (const std::string &method, const std::string &uri, const std::string &httpVersion) | |
| Construct an Request. More... | |
| virtual | ~Request () |
| Destroy this Request. | |
| virtual void | write (std::ostream &ostr) const |
| Write the HTTPRequest to an output stream. More... | |
| void | setRequestId (const std::string &requestId) |
| Set the id of the request. More... | |
| const std::string & | getRequestId () const |
| Get the id of the request. More... | |
| const Poco::Net::HTMLForm & | form () const |
| Get a const reference to the raw form data. More... | |
| int64_t | estimatedContentLength () const |
| Get the estimated content length for progress estimation purposes. More... | |
Protected Attributes | |
| std::size_t | _startByte |
| std::size_t | _endByte |
| std::string | _contentType |
| ofBuffer | _buffer |
Protected Attributes inherited from ofx::HTTP::Request | |
| std::string | _requestId |
| The original URI passed in during construction. More... | |
| Poco::Net::HTMLForm | _form |
| A form with all query terms / form parameters. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from ofx::HTTP::Request | |
| static std::string | generateId () |
| Generate a UUID string. More... | |
Static Public Attributes inherited from ofx::HTTP::FormRequest | |
| static const std::string | DEFAULT_MEDIA_TYPE = "application/octet-stream" |
| The default MIME type. | |
| ofx::HTTP::PutRequest::PutRequest | ( | const std::string & | uri, |
| const std::string & | httpVersion = Poco::Net::HTTPMessage::HTTP_1_1 |
||
| ) |
Construct a PutRequest with a given uri and http version.
| uri | the Put endpoint uri. |
| httpVersion | Either HTTP/1.0 or HTTP/1.1. |
| void ofx::HTTP::PutRequest::setContentRange | ( | std::size_t | startByte | ) |
Set the start byte to include in the header of the PUT request.
| startByte | The byte number representing the offset of the data included in the body. End byte is assumed to be the end of the resource. |
| void ofx::HTTP::PutRequest::setContentRange | ( | std::size_t | startByte, |
| std::size_t | endByte | ||
| ) |
Set the start byte to include in the header of the PUT request.
| startByte | The byte number representing the offset of the data included in the body. |
| endByte | The byte number representing the end offset of the data included in the body. |
| InvalidArgumentException | if startByte is not less than or equal to endByte. |
| void ofx::HTTP::PutRequest::setContentType | ( | const std::string & | contentType | ) |
Set the content type for the put request.
The default content type is application/octet-stream.
The content type of the PUT request.
| void ofx::HTTP::PutRequest::setPutBuffer | ( | const ofBuffer & | buffer | ) |
Set the buffer to include in the body of the PUT request.
| buffer | The buffer to include in the body of the PUT request. |
| void ofx::HTTP::PutRequest::setPutFile | ( | const std::string & | filename | ) |
Set the file to include in the body of the PUT request.
| filename | The file to include in the body of the PUT request. |
|
overridevirtual |
Write the body of the request.
| requestStream | The stream to write to. |
Reimplemented from ofx::HTTP::Request.