Public Member Functions |
| PHTTPClient (const PString &userAgentName=PString::Empty()) |
| Create a new HTTP client channel.
|
int | ExecuteCommand (Commands cmd, const PURL &url, PMIMEInfo &outMIME, const PString &dataBody, PMIMEInfo &replyMime) |
| Send a command and wait for the response header (including MIME fields).
|
int | ExecuteCommand (const PString &cmdName, const PURL &url, PMIMEInfo &outMIME, const PString &dataBody, PMIMEInfo &replyMime) |
bool | WriteCommand (Commands cmd, const PString &url, PMIMEInfo &outMIME, const PString &dataBody) |
| Write a HTTP command to server.
|
bool | WriteCommand (const PString &cmdName, const PString &url, PMIMEInfo &outMIME, const PString &dataBody) |
bool | ReadResponse (PMIMEInfo &replyMIME) |
| Read a response from the server.
|
bool | ReadContentBody (PMIMEInfo &replyMIME) |
| Read the body of the HTTP command, throwing it away.
|
bool | ReadContentBody (PMIMEInfo &replyMIME, PString &body) |
| Read the body of the HTTP command as a string.
|
bool | ReadContentBody (PMIMEInfo &replyMIME, PBYTEArray &body) |
| Read the body of the HTTP command as a binary block.
|
bool | GetDocument (const PURL &url, PMIMEInfo &outMIME, PMIMEInfo &replyMIME) |
| Start getting the document specified by the URL.
|
bool | GetDocument (const PURL &url, PMIMEInfo &replyMIME) |
bool | GetTextDocument (const PURL &url, PString &document, const PString &contentType=PString::Empty()) |
| Get the document specified by the URL.
|
bool | GetHeader (const PURL &url, PMIMEInfo &outMIME, PMIMEInfo &replyMIME) |
| Get the header for the document specified by the URL.
|
bool | PostData (const PURL &url, const PStringToString &data) |
| Post the "application/x-www-form-urlencoded" data specified to the URL.
|
bool | PostData (const PURL &url, PMIMEInfo &outMIME, const PString &data) |
| Post the data specified to the URL.
|
bool | PostData (const PURL &url, PMIMEInfo &outMIME, const PString &data, PMIMEInfo &replyMIME) |
| Start a post of the data specified to the URL.
|
bool | PostData (const PURL &url, PMIMEInfo &outMIME, const PString &data, PMIMEInfo &replyMIME, PString &replyBody) |
| Post the data specified to the URL.
|
bool | PutTextDocument (const PURL &url, const PString &document, const PString &contentType=PMIMEInfo::TextPlain()) |
| Put the document specified by the URL.
|
bool | PutDocument (const PURL &url, PMIMEInfo &outMIME, PMIMEInfo &replyMIME) |
| Put the document specified by the URL.
|
bool | DeleteDocument (const PURL &url) |
| Delete the document specified by the URL.
|
void | SetAuthenticationInfo (const PString &userName, const PString &password) |
| Set authentication paramaters to be use for retreiving documents.
|
void | SetPersistent (bool persist=true) |
| Set persistent connection mode.
|
bool | GetPersistent () const |
| Get persistent connection mode.
|
Protected Member Functions |
bool | AssureConnect (const PURL &url, PMIMEInfo &outMIME) |
bool | InternalReadContentBody (PMIMEInfo &replyMIME, PAbstractArray *body) |
| PHTTP () |
| Create a TCP/IP HTTP protocol channel.
|
virtual PINDEX | ParseResponse (const PString &line) |
| Parse a response line string into a response code and any extra info on the line.
|
| PInternetProtocol (const char *defaultServiceName, PINDEX cmdCount, char const *const *cmdNames) |
virtual PBoolean | OnOpen () |
| This callback is executed when the Open() function is called with open channels.
|
| PChannel (const PChannel &) |
PChannel & | operator= (const PChannel &) |
virtual PBoolean | ConvertOSError (int libcReturnValue, ErrorGroup group=LastGeneralError) |
| Convert an operating system error into platform independent error.
|
int | ReadCharWithTimeout (PTimeInterval &timeout) |
| Read a character with specified timeout.
|
PBoolean | ReceiveCommandString (int nextChar, const PString &reply, PINDEX &pos, PINDEX start) |
PBoolean | PXSetIOBlock (PXBlockType type, const PTimeInterval &timeout) |
int | PXClose () |
| PObject () |
| Constructor for PObject, made protected so cannot ever create one on its own.
|
Additional Inherited Members |
enum | Commands {
GET,
HEAD,
POST,
PUT,
DELETE,
TRACE,
OPTIONS,
CONNECT,
NumCommands
} |
enum | StatusCode {
Continue = 100,
SwitchingProtocols,
RequestOK = 200,
Created,
Accepted,
NonAuthoritativeInformation,
NoContent,
ResetContent,
PartialContent,
MultipleChoices = 300,
MovedPermanently,
MovedTemporarily,
SeeOther,
NotModified,
UseProxy,
BadRequest = 400,
UnAuthorised,
PaymentRequired,
Forbidden,
NotFound,
MethodNotAllowed,
NoneAcceptable,
ProxyAuthenticationRequired,
RequestTimeout,
Conflict,
Gone,
LengthRequired,
UnlessTrue,
InternalServerError = 500,
NotImplemented,
BadGateway,
ServiceUnavailable,
GatewayTimeout
} |
static const PCaselessString & | AllowTag () |
static const PCaselessString & | AuthorizationTag () |
static const PCaselessString & | ContentEncodingTag () |
static const PCaselessString & | ContentLengthTag () |
static const PCaselessString & | ContentTypeTag () |
static const PCaselessString & | DateTag () |
static const PCaselessString & | ExpiresTag () |
static const PCaselessString & | FromTag () |
static const PCaselessString & | IfModifiedSinceTag () |
static const PCaselessString & | LastModifiedTag () |
static const PCaselessString & | LocationTag () |
static const PCaselessString & | PragmaTag () |
static const PCaselessString & | PragmaNoCacheTag () |
static const PCaselessString & | RefererTag () |
static const PCaselessString & | ServerTag () |
static const PCaselessString & | UserAgentTag () |
static const PCaselessString & | WWWAuthenticateTag () |
static const PCaselessString & | MIMEVersionTag () |
static const PCaselessString & | ConnectionTag () |
static const PCaselessString & | KeepAliveTag () |
static const PCaselessString & | TransferEncodingTag () |
static const PCaselessString & | ChunkedTag () |
static const PCaselessString & | ProxyConnectionTag () |
static const PCaselessString & | ProxyAuthorizationTag () |
static const PCaselessString & | ProxyAuthenticateTag () |
static const PCaselessString & | ForwardedTag () |
static const PCaselessString & | SetCookieTag () |
static const PCaselessString & | CookieTag () |
enum | StuffState {
DontStuff,
StuffIdle,
StuffCR,
StuffCRLF,
StuffCRLFdot,
StuffCRLFdotCR
} |
A TCP/IP socket for the HyperText Transfer Protocol version 1.0.
When acting as a client, the procedure is to make the connection to a remote server, then to retrieve a document using the following procedure:
PHTTPSocket web("webserver");
if (web.IsOpen()) {
PINDEX len;
if (web.GetDocument("http://www.someone.com/somewhere/url", len)) {
PString html = web.ReadString(len);
if (!html.IsEmpty())
ProcessHTML(html);
}
else
PError << "Could not get page." << endl;
}
else
PError << "HTTP conection failed." << endl;