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 handle, HCkByteData retval);

The response body returned as a byte array.

void CkHttpResponse_getBodyStr(HCkHttpResponse handle, HCkString retval);

The response body returned as a string.

void CkHttpResponse_getCharset(HCkHttpResponse handle, 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 handle);

The content length of the response, in bytes.

void CkHttpResponse_getDate(HCkHttpResponse handle, SYSTEMTIME *retval);

The Date response header field, returned in an easy-to-use date/time data type.

void CkHttpResponse_getDomain(HCkHttpResponse handle, HCkString retval);

The domain of the HTTP server that created this response.

void CkHttpResponse_getHeader(HCkHttpResponse handle, HCkString retval);

The full text of the response header.

int CkHttpResponse_getNumCookies(HCkHttpResponse handle);

The number of cookies included in the response.

int CkHttpResponse_getNumHeaderFields(HCkHttpResponse handle);

The number of response header fields.

int CkHttpResponse_getStatusCode(HCkHttpResponse handle);

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 handle, HCkString retval);

The first line of an HTTP response, such as "HTTP/1.0 200 OK".

BOOL CkHttpResponse_getUtf8(HCkHttpResponse handle);
void CkHttpResponse_putUtf8(HCkHttpResponse handle, 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 handle, int index, HCkString str);

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 handle, int index, SYSTEMTIME *sysTime);

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 handle, int index, HCkString str);

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 handle, int index, HCkString str);

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 handle, int index, HCkString str);

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 handle, int index, HCkString str);

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 handle, const char *fieldName, HCkString str);

Returns the value of a response header field accessed by field name.

BOOL CkHttpResponse_GetHeaderFieldAttr(HCkHttpResponse handle, const char *fieldName, const char *attrName, HCkString str);

Returns a response header field attribute. As an example, the response charset is simply the GetHeaderFieldAttr("content-type","charset")

BOOL CkHttpResponse_GetHeaderName(HCkHttpResponse handle, int index, HCkString str);

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 handle, int index, HCkString str);

Gets the value of the Nth response header field. Indexing begins at 0. The number of response headers is specified by the NumHeaderFields property.

const char *CkHttpResponse_bodyStr(HCkHttpResponse handle);

The response body returned as a string.

const char *CkHttpResponse_charset(HCkHttpResponse handle);

The response charset, such as "iso-8859-1", if applicable. Obviously, responses for GIF and JPG files will not have a charset.

const char *CkHttpResponse_domain(HCkHttpResponse handle);

The domain of the HTTP server that created this response.

const char *CkHttpResponse_getCookieDomain(HCkHttpResponse handle, 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.

const char *CkHttpResponse_getCookieExpiresStr(HCkHttpResponse handle, 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.

const char *CkHttpResponse_getCookieName(HCkHttpResponse handle, 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.

const char *CkHttpResponse_getCookiePath(HCkHttpResponse handle, 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.

const char *CkHttpResponse_getCookieValue(HCkHttpResponse handle, 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.

const char *CkHttpResponse_getHeaderField(HCkHttpResponse handle, const char *fieldName);

Returns the value of a response header field accessed by field name.

const char *CkHttpResponse_getHeaderFieldAttr(HCkHttpResponse handle, 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")

const char *CkHttpResponse_getHeaderName(HCkHttpResponse handle, 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.

const char *CkHttpResponse_getHeaderValue(HCkHttpResponse handle, 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.

const char *CkHttpResponse_header(HCkHttpResponse handle);

The full text of the response header.

const char *CkHttpResponse_statusLine(HCkHttpResponse handle);

The first line of an HTTP response, such as "HTTP/1.0 200 OK".