Advanced Topics
The following sections describe advanced HTTP requests, and how they can be performed using the
RWHttpClient and
RWHttpAgent classes.
Additional HTTP Methods
The
RWHttpRequest object includes the following identifiers for some HTTP methods:
Identifier | HTTP Method |
RWHttpRequest::Connect | CONNECT |
RWHttpRequest::Delete | DELETE |
RWHttpRequest::Get | GET |
RWHttpRequest::Head | HEAD |
RWHttpRequest::Options | OPTIONS |
RWHttpRequest::Post | POST |
RWHttpRequest::Put | PUT |
RWHttpRequest::Trace | TRACE |
The HTTP specification and the
RWHttpRequest class enable you to create custom HTTP methods.
Example 11 shows a custom
RWHttpRequest based on the custom
M-POST HTTP method.
NOTE >> Servers and files shown in the code might not exist and are included as examples only.
Example 11 – Creating a custom HTTP method
RWHttpRequestStringBody body("user=roguewave"); // 1
RWHttpHeaderList headerlist; // 2
RWHttpRequest request("M-POST", "/script.cgi", headerlist,
body); // 3
When submitted to an HTTP server through an
RWHttpClient connected to
www.roguewave.com, the request sends the following data:
M-POST /script.cgi HTTP/1.1
Host: www.roguewave.com
Content-Length: 14
user=roguewave