- Inherits from:
- Object
- Declared in:
- DHTTPClient.h
Object
|
+---DHTTPClient
Class Description
The DHTTPClient class implements a HTTP client. The class does not support
the POST and PUT requests. Also the responses with a chunked transfer
encoding are not handled.
- Last modified:
- 31-Oct-2007 (DHTTPClient.h)
Instance Variables
- private DSocket *_client
- the client socket
- private BOOL _shouldOpen
- should the socket be opened?
- private int _state
- the state of the client
- private DText *_server
- the server host name (or proxy)
- private DInetSocketAddress *_address
- the address of the server (or proxy)
- private int _type
- the request type (DC_HEAD, DHC_GET, ..)
- private int _major
- the major version number (def. 1)
- private int _minor
- the minor version number (def. 1)
- private BOOL _shouldClose
- should the connection close after comm.?
- private DText *_request
- the request
- private DData *_response
- the respone
- private int _respIndex
- the index in the response string
- private DText *_line
- one line of the response
- private int _reason
- the received reply reason
- private DText *_reasonText
- the received reason text
- private DHashTable *_headers
- the received headers
- private DData *_body
- the received body in data
- private BOOL _useChunked
- is chunked used ?
- private int _length
- the length of the body
- private int _peerMajor
- the major version number of the peer
- private int _peerMinor
- the minor version number of the peer
- Constructors
- - (DHTTPClient *) init
- Initialise the HTTP Client
- Returns:
- the object
- - (DHTTPClient *) init :(int) major :(int) minor
- Initialise the HTTP Client with a client version
- Parameters:
- major - the major version number
minor - the minor version number
- Returns:
- the object
- Deconstructor
- - free
- Free the HTTP client object
- Returns:
- the object
- Copy related methods
- - shallowCopy
- Do a shallow copy of the object (not implemented)
- Member methods
- - (DSocket *) socket
- Return the local client object
- Returns:
- a reference to the client object
- Sending methods
- - (BOOL) sendAcceptLanguageHeader :(const char *) languages
- Send Accept-Language header
- Parameters:
- languages - a string containing the languages (en-us, en)
- Returns:
- success
- - (BOOL) sendConnectionHeader :(const char *) connection
- Send Connection header
- Parameters:
- connection - a c-string with "close" or "keep-alive"
- Returns:
- success
- - (BOOL) sendEndRequest
- Send the end of the request to the server/proxy
- Returns:
- success
- - (BOOL) sendHeader :(const char *) header :(const char *) argument
- Send a (general) header after the request
- Parameters:
- header - the header to send
argument - the argument for the header
- Returns:
- success
- - (BOOL) sendRefererHeader :(const char *) referer
- Send Referer header
- Parameters:
- referer - a c-string with the referer link
- Returns:
- success
- - (BOOL) sendStartRequest :(int) request :(DURL *) path
- Send the start of the request
- Parameters:
- request - the request (DHC_HEAD, DHC_GET ..)
path - the (absolute) url to get
- Returns:
- success
- - (BOOL) sendStartRequest :(int) request :(DURL *) path :(const char *) proxy :(int) proxyPort
- Send the start of the request via a proxy
- Parameters:
- request - the request (DHTTP_HEAD, DHTTP_GET, ..)
path - the (absolute) url to get
proxy - the host name of the proxy (or NULL for no proxy)
proxyPort - the proxy port number
- Returns:
- success
- - (BOOL) sendUserAgentHeader :(const char *) agent
- Send User-Agent header
- Parameters:
- agent - a c-string with the user agent
- Returns:
- success
- Receiving methods
- - (const unsigned char *) body
- Get the body of the received message (after receiveReply)
- Returns:
- a received data (or NULL for error)
- - (unsigned long) bodyLength
- Get the length of the body of the received message (after receiveReply)
- Returns:
- a received length
- - (DText *) header :(const char *) header
- Get the argument of a header (after receiveReply)
- Parameters:
- header - the header (all lower case)
- Returns:
- a (new) text object with the argument (or nil)
- - (DHashIterator *) headers
- Get all received headers (after receiveReply)
- Returns:
- a (new) iterator on the hash table with all the received headers (or nil)
- - (int) peerMajor
- Return the major version number of the peer (after receiveReply)
- Returns:
- the major version number
- - (int) peerMinor
- Return the minor version number of the peer (after receiveReply)
- Returns:
- the minor version number
- - (int) reason
- Get the reason (after receiveReply)
- Returns:
- the reason code (or -1)
- - (const char *) reasonText
- Get the reason text (after receiveReply)
- Returns:
- the reason text (or NULL for error)
- - (BOOL) receiveReply
- Receive a reply from the server
- Returns:
- success
generated 05-Nov-2007 by ObjcDoc 3.0.0