HttpResponse C Library Reference
HttpResponse
Represents a complete HTTP response.
Create/Dispose
HCkHttpResponse CkHttpResponse_Create(void);
Creates an instance of the CkHttpResponse object and returns a handle (i.e. a "void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.
void CkHttpResponse_Dispose(HCkHttpResponse handle);
Objects created by calling CkHttpResponse_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.
C "Properties"
void CkHttpResponse_getBody(HCkHttpResponse cHandle, HCkByteData retval);
The response body returned as a byte array.
void CkHttpResponse_getBodyQP(HCkHttpResponse cHandle, HCkString retval);
To be documented soon...
void CkHttpResponse_getBodyStr(HCkHttpResponse cHandle, HCkString retval);
The response body returned as a string.
void CkHttpResponse_getCharset(HCkHttpResponse cHandle, HCkString retval);
The response charset, such as "iso-8859-1", if applicable. Obviously, responses for GIF and JPG files will not have a charset.
unsigned long CkHttpResponse_getContentLength(HCkHttpResponse cHandle);
The content length of the response, in bytes.
void CkHttpResponse_getDate(HCkHttpResponse cHandle, SYSTEMTIME *retval);
The Date response header field, returned in an easy-to-use date/time data type.
void CkHttpResponse_getDomain(HCkHttpResponse cHandle, HCkString retval);
The domain of the HTTP server that created this response.
void CkHttpResponse_getHeader(HCkHttpResponse cHandle, HCkString retval);
The full text of the response header.
void CkHttpResponse_getLastErrorHtml(HCkHttpResponse cHandle, HCkString retval);
Error information in HTML format for the last method called.
void CkHttpResponse_getLastErrorText(HCkHttpResponse cHandle, HCkString retval);
Error information in plain-text format for the last method called.
void CkHttpResponse_getLastErrorXml(HCkHttpResponse cHandle, HCkString retval);
Error information in XML format for the last method called.
int CkHttpResponse_getNumCookies(HCkHttpResponse cHandle);
The number of cookies included in the response.
int CkHttpResponse_getNumHeaderFields(HCkHttpResponse cHandle);
The number of response header fields.
int CkHttpResponse_getStatusCode(HCkHttpResponse cHandle);
The status code (as an integer) from the first line of an HTTP response. If the StatusLine = "HTTP/1.0 200 OK", the response status code returned is 200.
void CkHttpResponse_getStatusLine(HCkHttpResponse cHandle, HCkString retval);
The first line of an HTTP response, such as "HTTP/1.0 200 OK".
BOOL CkHttpResponse_getUtf8(HCkHttpResponse cHandle); void CkHttpResponse_putUtf8(HCkHttpResponse cHandle, BOOL newVal);
When set to true, all "const char *" arguments are expected to be utf-8 strings. If set to false, the "const char *" arguments are expected to be ANSI strings.
C "Methods"
BOOL CkHttpResponse_GetCookieDomain(HCkHttpResponse cHandle, int index, HCkString outStr);
Returns the domain of the Nth cookie in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.
BOOL CkHttpResponse_GetCookieExpires(HCkHttpResponse cHandle, int index, SYSTEMTIME *outSysTime);
Returns the expiration date/time of the Nth cookie in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.
BOOL CkHttpResponse_GetCookieExpiresStr(HCkHttpResponse cHandle, int index, HCkString outStr);
Returns the expiration date/time of the Nth cookie in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.
BOOL CkHttpResponse_GetCookieName(HCkHttpResponse cHandle, int index, HCkString outStr);
Returns the name of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.
BOOL CkHttpResponse_GetCookiePath(HCkHttpResponse cHandle, int index, HCkString outStr);
Returns the path of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.
BOOL CkHttpResponse_GetCookieValue(HCkHttpResponse cHandle, int index, HCkString outStr);
Returns the value of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.
BOOL CkHttpResponse_GetHeaderField(HCkHttpResponse cHandle, const char *fieldName, HCkString outStr);
Returns the value of a response header field accessed by field name.
BOOL CkHttpResponse_GetHeaderFieldAttr(HCkHttpResponse cHandle, const char *fieldName, const char *attrName, HCkString outStr);
Returns a response header field attribute. As an example, the response charset is simply the GetHeaderFieldAttr("content-type","charset")
BOOL CkHttpResponse_GetHeaderName(HCkHttpResponse cHandle, int index, HCkString outStr);
Gets the name of the Nth response header field. Indexing begins at 0. The number of response headers is specified by the NumHeaderFields property.
BOOL CkHttpResponse_GetHeaderValue(HCkHttpResponse cHandle, int index, HCkString outStr);
Gets the value of the Nth response header field. Indexing begins at 0. The number of response headers is specified by the NumHeaderFields property.
BOOL CkHttpResponse_SaveLastError(HCkHttpResponse cHandle, const char *filename);
Saves the last error information to an XML formatted file.
const char *CkHttpResponse_bodyQP(HCkHttpResponse cHandle);
To be documented soon...
const char *CkHttpResponse_bodyStr(HCkHttpResponse cHandle);
The response body returned as a string. Returns a null on failure
const char *CkHttpResponse_charset(HCkHttpResponse cHandle);
The response charset, such as "iso-8859-1", if applicable. Obviously, responses for GIF and JPG files will not have a charset. Returns a null on failure
const char *CkHttpResponse_domain(HCkHttpResponse cHandle);
The domain of the HTTP server that created this response. Returns a null on failure
const char *CkHttpResponse_getCookieDomain(HCkHttpResponse cHandle, int index);
Returns the domain of the Nth cookie in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property. Returns a null on failure
const char *CkHttpResponse_getCookieExpiresStr(HCkHttpResponse cHandle, int index);
Returns the expiration date/time of the Nth cookie in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property. Returns a null on failure
const char *CkHttpResponse_getCookieName(HCkHttpResponse cHandle, int index);
Returns the name of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property. Returns a null on failure
const char *CkHttpResponse_getCookiePath(HCkHttpResponse cHandle, int index);
Returns the path of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property. Returns a null on failure
const char *CkHttpResponse_getCookieValue(HCkHttpResponse cHandle, int index);
Returns the value of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property. Returns a null on failure
const char *CkHttpResponse_getHeaderField(HCkHttpResponse cHandle, const char *fieldName);
Returns the value of a response header field accessed by field name. Returns a null on failure
const char *CkHttpResponse_getHeaderFieldAttr(HCkHttpResponse cHandle, const char *fieldName, const char *attrName);
Returns a response header field attribute. As an example, the response charset is simply the GetHeaderFieldAttr("content-type","charset") Returns a null on failure
const char *CkHttpResponse_getHeaderName(HCkHttpResponse cHandle, int index);
Gets the name of the Nth response header field. Indexing begins at 0. The number of response headers is specified by the NumHeaderFields property. Returns a null on failure
const char *CkHttpResponse_getHeaderValue(HCkHttpResponse cHandle, int index);
Gets the value of the Nth response header field. Indexing begins at 0. The number of response headers is specified by the NumHeaderFields property. Returns a null on failure
const char *CkHttpResponse_header(HCkHttpResponse cHandle);
The full text of the response header. Returns a null on failure
const char *CkHttpResponse_lastErrorHtml(HCkHttpResponse cHandle);
Error information in HTML format for the last method called.Returns a null on failure
const char *CkHttpResponse_lastErrorText(HCkHttpResponse cHandle);
Error information in plain-text format for the last method called.Returns a null on failure
const char *CkHttpResponse_lastErrorXml(HCkHttpResponse cHandle);
Error information in XML format for the last method called.Returns a null on failure
const char *CkHttpResponse_statusLine(HCkHttpResponse cHandle);
The first line of an HTTP response, such as "HTTP/1.0 200 OK". Returns a null on failure
|