Http C Library Reference

Http

Class for sending and receiving HTTP requests. Capable of doing GET, POST, and HEAD requests. Capable of persisting cookies to file-based storage. Includes substantial caching capability. Works seamlessly with HTTPS.

Create/Dispose

HCkHttp CkHttp_Create(void);

Creates an instance of the CkHttp 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 CkHttp_Dispose(HCkHttp handle);

Objects created by calling CkHttp_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 CkHttp_getAccept(HCkHttp handle, HCkString retval);
void CkHttp_putAccept(HCkHttp handle, const char *newVal);

The Accept header field to be automatically included with GET requests issued by QuickGet or QuickGetStr. The default value is "*/*".

void CkHttp_getAcceptCharset(HCkHttp handle, HCkString retval);
void CkHttp_putAcceptCharset(HCkHttp handle, const char *newVal);

The AcceptCharset header field to be automatically included with GET requests issued by QuickGet or QuickGetStr. The default value is "ISO-8859-1,utf-8;q=0.7,*;q=0.7".

void CkHttp_getAcceptLanguage(HCkHttp handle, HCkString retval);
void CkHttp_putAcceptLanguage(HCkHttp handle, const char *newVal);

The AcceptLanguage header field to be automatically included with GET requests issued by QuickGet or QuickGetStr. The default value is "en-us,en;q=0.5".

BOOL CkHttp_getAutoAddHostHeader(HCkHttp handle);
void CkHttp_putAutoAddHostHeader(HCkHttp handle, BOOL newVal);

If set to true, the "Host" header field will automatically be added to the request header for any QuickGet or QuickGetStr method calls. The value of the Host header field is taken from the hostname part of the URL passed to QuickGet/QuickGetStr.

long CkHttp_getConnectTimeout(HCkHttp handle);
void CkHttp_putConnectTimeout(HCkHttp handle, long newVal);

The amount of time in seconds to wait before timing out when connecting to an HTTP server.

void CkHttp_getConnection(HCkHttp handle, HCkString retval);
void CkHttp_putConnection(HCkHttp handle, const char *newVal);

The Connection header field to be automatically included with GET requests issued by QuickGet or QuickGetStr. The default value is "Keep-Alive". To prevent the Connection header from being added to the HTTP header, set this property to the empty string.

void CkHttp_getCookieDir(HCkHttp handle, HCkString retval);
void CkHttp_putCookieDir(HCkHttp handle, const char *newVal);

Specifies a directory where cookies are automatically persisted if the Http.SaveCookies property is turned on. Cookies are stored in XML formatted files, one per domain, to main it easy for other programs to understand and parse.

long CkHttp_getDefaultFreshPeriod(HCkHttp handle);
void CkHttp_putDefaultFreshPeriod(HCkHttp handle, long newVal);

The default freshness period (in minutes) for cached documents when the FreshnessAlgorithm property is set to 0. The default value is 10080 (1 week).

BOOL CkHttp_getFetchFromCache(HCkHttp handle);
void CkHttp_putFetchFromCache(HCkHttp handle, BOOL newVal);

Set to true if pages should be fetched from cache when possible. Only HTTP GET requests are cached. HTTP responses that include Set-Cookie headers are not cached. A page is fetched from the disk cache if it is present and it is "fresh" according to the FreshnessAlgorithm property. If a page exists in cache but is not fresh, the HTTP component will issue a revalidate request and update the cache appropriately according to the response.

void CkHttp_getFinalRedirectUrl(HCkHttp handle, HCkString retval);

If an HTTP GET was redirected (as indicated by the WasRedirected property), this property will contain the final redirect URL, assuming the FollowRedirects property is true.

BOOL CkHttp_getFollowRedirects(HCkHttp handle);
void CkHttp_putFollowRedirects(HCkHttp handle, BOOL newVal);

If true, then 301 and 302 redirects are automatically followed when calling QuickGet and QuickGetStr. FollowRedirects is true by default.

long CkHttp_getFreshnessAlgorithm(HCkHttp handle);
void CkHttp_putFreshnessAlgorithm(HCkHttp handle, long newVal);

The freshness algorithm to use when determining the freshness of a cached HTTP GET response. A value of 1 causes an LM-factor algorithm to be used. This is the default. The LMFactor property is a value between 1 and 100 indicating the percentage of time based on the last-modified date of the HTML page. For example, if the LMFactor is 50, and an HTML page was modified 10 days ago, then the page will expire (i.e. no longer be fresh) in 5 days (50% of 10 days). This only applies to HTTP responses that do not have page expiration information. If the FreshnessAlgorithm = 0, then a constant expire time period determined by the DefaultFreshPeriod property is used.

long CkHttp_getHeartbeatMs(HCkHttp handle);
void CkHttp_putHeartbeatMs(HCkHttp handle, long newVal);

When set to a non-zero value, it specifies the time interval in milliseconds between AbortCheck events. Any HTTP operation can be aborted via the AbortCheck event. Event callbacks are supported for ActiveX, .NET, and C++ implementations of this API.

BOOL CkHttp_getIgnoreMustRevalidate(HCkHttp handle);
void CkHttp_putIgnoreMustRevalidate(HCkHttp handle, BOOL newVal);

Some HTTP responses contain a "Cache-Control: must-revalidate" header. If this is present, the server is requesting that the client always issue a revalidate HTTP request instead of serving the page directly from cache. If IgnoreMustRevalidate is set to true, then Chilkat HTTP will serve the page directly from cache without revalidating until the page is no longer fresh.

The default value of this property is false.

BOOL CkHttp_getIgnoreNoCache(HCkHttp handle);
void CkHttp_putIgnoreNoCache(HCkHttp handle, BOOL newVal);

Some HTTP responses contain headers of various types that indicate that the page should not be cached. Chilkat HTTP will adhere to this unless this property is set to true.

The default value of this property is false.

long CkHttp_getLMFactor(HCkHttp handle);
void CkHttp_putLMFactor(HCkHttp handle, long newVal);

An integer between 1 and 100 that indicates the percentage of time from the HTTP page's last-modified date that will be used for the freshness period. The default value is 25. For example, if a page is fetched with a last-modified date of 4 weeks ago, and the LMFactor = 25, then the page will be considered fresh in the cache for 1 week (25% of 4 weeks).

void CkHttp_getLastContentType(HCkHttp handle, HCkString retval);

The content-type of the last HTTP response received by the HTTP component.

void CkHttp_getLastErrorHtml(HCkHttp handle, HCkString retval);

Error information in HTML format for the last method called.

void CkHttp_getLastErrorText(HCkHttp handle, HCkString retval);

Error information in plain-text format for the last method called.

void CkHttp_getLastErrorXml(HCkHttp handle, HCkString retval);

Error information in XML format for the last method called.

void CkHttp_getLastHeader(HCkHttp handle, HCkString retval);

The text of the last HTTP header sent by any of this class's methods. The purpose of this property is to allow the developer to examine the exact HTTP header for debugging purposes.

void CkHttp_getLastModDate(HCkHttp handle, HCkString retval);

The value of the Last-Modified header in the last HTTP response received by the HTTP component.

void CkHttp_getLastResponseHeader(HCkHttp handle, HCkString retval);

The entire last response header for the last HTTP response received by the HTTP component.

long CkHttp_getLastStatus(HCkHttp handle);

The last HTTP status value received by the HTTP component.

void CkHttp_getLogin(HCkHttp handle, HCkString retval);
void CkHttp_putLogin(HCkHttp handle, const char *newVal);

The HTTP login for pages requiring a login/password. Chilkat HTTP can do both Basic and NTLM HTTP authentication. (NTLM is also known as SPA (or Windows Integrated Authentication). To use NTLM, set the NtlmAuth property = true.

long CkHttp_getMaxConnections(HCkHttp handle);
void CkHttp_putMaxConnections(HCkHttp handle, long newVal);

The maximum number of simultaneous open HTTP connections managed by the HTTP component. The Chilkat HTTP component automatically manages HTTP connections. If the number of open HTTP connections is about to be exceeded, the connection with the least recent activity is automatically closed.

long CkHttp_getMaxFreshPeriod(HCkHttp handle);
void CkHttp_putMaxFreshPeriod(HCkHttp handle, long newVal);

Limits the amount of time a document can be kept "fresh" in the cache. The MaxFreshPeriod is specified in minutes, and the default value is 525600 which is equal to 1 year.

unsigned long CkHttp_getMaxResponseSize(HCkHttp handle);
void CkHttp_putMaxResponseSize(HCkHttp handle, unsigned long newVal);

The maximum HTTP response size to be accepted by the calling program. A value of 0 (the default) indicates that there is no maximum value.

long CkHttp_getMaxUrlLen(HCkHttp handle);
void CkHttp_putMaxUrlLen(HCkHttp handle, long newVal);

The Http class will automatically fail any URL longer than this length. The default MaxUrlLen is 800 characters.

BOOL CkHttp_getMimicFireFox(HCkHttp handle);
void CkHttp_putMimicFireFox(HCkHttp handle, BOOL newVal);

If set to true, then the appropriate headers to mimic Mozilla/FireFox are automatically added to requests sent via the QuickGet and QuickGetStr methods.

BOOL CkHttp_getMimicIE(HCkHttp handle);
void CkHttp_putMimicIE(HCkHttp handle, BOOL newVal);

If set to true, then the appropriate headers to mimic Internet Explorer are automatically added to requests sent via the QuickGet and QuickGetStr methods.

long CkHttp_getMinFreshPeriod(HCkHttp handle);
void CkHttp_putMinFreshPeriod(HCkHttp handle, long newVal);

The freshness period for a document in cache will not be less than this value (in minutes). The default value is 30.

BOOL CkHttp_getNtlmAuth(HCkHttp handle);
void CkHttp_putNtlmAuth(HCkHttp handle, BOOL newVal);

Setting this property to true causes the HTTP component to use NTLM authentication (also known as IWA -- or Integrated Windows Authentication) when authentication with an HTTP server.

long CkHttp_getNumCacheLevels(HCkHttp handle);
void CkHttp_putNumCacheLevels(HCkHttp handle, long newVal);

The number of directory levels to be used under each cache root. The default is 0, meaning that each cached HTML page is stored in a cache root directory. A value of 1 causes each cached page to be stored in one of 255 subdirectories named "0","1", "2", ..."255" under a cache root. A value of 2 causes two levels of subdirectories ("0..255/0..255") under each cache root. The HTTP control automatically creates subdirectories as needed. The reason for mutliple levels is to alleviate problems that may arise with unrelated software when huge numbers of files are stored in a single directory. For example, Windows Explorer does not behave well when trying to display the contents of directories with thousands of files.

long CkHttp_getNumCacheRoots(HCkHttp handle);

The number of cache roots to be used for the HTTP cache. This allows the disk cache spread out over multiple disk drives. Each cache root is a string indicating the drive letter and directory path. For example, "E:\Cache". An example of a very large low-cost cache might be four USB external drives. To create a cache with four roots, call AddCacheRoot once for each directory root.

void CkHttp_getPassword(HCkHttp handle, HCkString retval);
void CkHttp_putPassword(HCkHttp handle, const char *newVal);

The HTTP password for pages requiring a login/password. Chilkat HTTP can do both Basic and NTLM HTTP authentication. (NTLM is also known as SPA (or Windows Integrated Authentication). To use NTLM, set the NtlmAuth property = true.

void CkHttp_getProxyDomain(HCkHttp handle, HCkString retval);
void CkHttp_putProxyDomain(HCkHttp handle, const char *newVal);

The domain name of a proxy host if an HTTP proxy is used.

void CkHttp_getProxyLogin(HCkHttp handle, HCkString retval);
void CkHttp_putProxyLogin(HCkHttp handle, const char *newVal);

If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy login.

void CkHttp_getProxyPassword(HCkHttp handle, HCkString retval);
void CkHttp_putProxyPassword(HCkHttp handle, const char *newVal);

If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy password.

long CkHttp_getProxyPort(HCkHttp handle);
void CkHttp_putProxyPort(HCkHttp handle, long newVal);

The port number of a proxy server if an HTTP proxy is used.

long CkHttp_getReadTimeout(HCkHttp handle);
void CkHttp_putReadTimeout(HCkHttp handle, long newVal);

The amount of time in seconds to wait before timing out when reading from an HTTP server. The ReadTimeout is the amount of time that needs to elapse while no additional data is forthcoming. During a long download, if the data stream halts for more than this amount, it will timeout. Otherwise, there is no limit on the length of time for the entire download.

void CkHttp_getReferer(HCkHttp handle, HCkString retval);
void CkHttp_putReferer(HCkHttp handle, const char *newVal);

The Referer header field to be automatically included with GET requests issued by QuickGet or QuickGetStr. The default value is the empty string which causes the Referer field to be omitted from the request header.

void CkHttp_getRequiredContentType(HCkHttp handle, HCkString retval);
void CkHttp_putRequiredContentType(HCkHttp handle, const char *newVal);

If set, then any HTTP response to any POST or GET, including downloads, will be rejected if the content-type in the response header does not match this setting. If the content-type does not match, only the header of the HTTP response is read, the connection to the HTTP server is closed, and the remainder of the response is never read.

This property is empty (zero-length string) by default.

Some typical content-types are "text/html", "text/xml", "image/gif", "image/jpeg", "application/zip", "application/msword", "application/pdf", etc.

BOOL CkHttp_getSaveCookies(HCkHttp handle);
void CkHttp_putSaveCookies(HCkHttp handle, BOOL newVal);

If this property is true, cookies are automatically persisted to XML files in the directory specified by the CookiesDir property. Both CookiesDir and SaveCookies must be set for cookies to be persisted.

BOOL CkHttp_getSendCookies(HCkHttp handle);
void CkHttp_putSendCookies(HCkHttp handle, BOOL newVal);

If true, then cookies previously persisted to the CookiesDir are automatically added to all HTTP requests. Only cookies matching the domain and path are added.

void CkHttp_getSslProtocol(HCkHttp handle, HCkString retval);
void CkHttp_putSslProtocol(HCkHttp handle, const char *newVal);

Selects the secure protocol to be used for secure (SSL) connections. Possible values are:

default
TLS 1.0
SSL 3.0
SSL 2.0
PCT 1.0
The default value is "default", which allows for the protocol to be selected dynamically at runtime based on the requirements of the server.

BOOL CkHttp_getUpdateCache(HCkHttp handle);
void CkHttp_putUpdateCache(HCkHttp handle, BOOL newVal);

Controls whether the cache is automatically updated with the responses from HTTP GET requests.

BOOL CkHttp_getUseIEProxy(HCkHttp handle);
void CkHttp_putUseIEProxy(HCkHttp handle, BOOL newVal);

If true, the proxy host/port used by Internet Explorer will also be used by Chilkat HTTP.

void CkHttp_getUserAgent(HCkHttp handle, HCkString retval);
void CkHttp_putUserAgent(HCkHttp handle, const char *newVal);

The UserAgent header field to be automatically included with GET requests issued by QuickGet or QuickGetStr. The default value is "Chilkat/1.0.0 (+http://www.chilkatsoft.com/ChilkatHttpUA.asp)" which indicates that the software used to issue the HTTP request was the Chilkat HTTP component.

BOOL CkHttp_getUtf8(HCkHttp handle);
void CkHttp_putUtf8(HCkHttp 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.

void CkHttp_getVersion(HCkHttp handle, HCkString retval);

Returns a string such as "1.0.0" indicating the version of the HTTP component.

BOOL CkHttp_getWasRedirected(HCkHttp handle);

Indicates whether the last HTTP GET was redirected.

C "Methods"

void CkHttp_AddCacheRoot(HCkHttp handle, const char *dir);

This method must be called at least once if disk caching is to be used. The file path (including drive letter) such as "E:\MyHttpCache\" is passed to AddCacheRoot to specify the root directory. The cache can be spread across multiple disk drives by calling AddCacheRoot multiple times, each with a directory path on a separate disk drive.

BOOL CkHttp_Download(HCkHttp handle, const char *url, const char *filename);

HTTP downloads a file at a URL. The file can be any size and any type. Large files are downloaded in streaming mode such that the memory footprint is small and steady. HTTPS is fully supported, as it is with all the methods of this class.

Returns TRUE for success, FALSE for failure.

BOOL CkHttp_DownloadAppend(HCkHttp handle, const char *url, const char *filename);

Same as the Download method, but the output file is open for append.

Returns TRUE for success, FALSE for failure.

void CkHttp_GenTimeStamp(HCkHttp handle, HCkString outStr);

(PreRelease) Returns the current GMT (also known as UTC) date/time in a string that is compliant with RFC 2616 format.

BOOL CkHttp_GetCacheRoot(HCkHttp handle, int index, HCkString str);

Returns the Nth cache root (indexing begins at 0). Cache roots are set by calling AddCacheRoot one or more times.

BOOL CkHttp_GetCookieXml(HCkHttp handle, const char *domain, HCkString outStr);

To be documented soon.

void CkHttp_GetDomain(HCkHttp handle, const char *url, HCkString str);

Utility method for extracting the domain name from a full URL. For example, if "http://www.chilkatsoft.com/default.asp" is the URL passed in, then "www.chilkatsoft.com" is returned.

HCkHttpResponse CkHttp_GetHead(HCkHttp handle, const char *url);

Sends an HTTP HEAD request for a URL and returns a response object.

BOOL CkHttp_GetRequestHeader(HCkHttp handle, const char *name, HCkString str);

Returns the value of a header field that has been pre-defined to be sent with all HTTP GET requests issued by the QuickGet and QuickGetStr methods. By default, this includes header fields such as Accept, AcceptCharset, AcceptLanguage, Connection, UserAgent, etc.

void CkHttp_GetUrlPath(HCkHttp handle, const char *url, HCkString str);

Returns the path part of a URL. The syntax of a URL is ://:@:/;?#. This method returns the "path" part.

BOOL CkHttp_HasRequestHeader(HCkHttp handle, const char *name);

Returns true if the specified header field is defined such that it will be sent with all GET requests issued by the QuickGet and QuickGetStr methods.

BOOL CkHttp_IsUnlocked(HCkHttp handle);

Returns true if the Http class has been unlocked. It is necessary to call Http.UnlockComponent before calling any other methods. Passing any string to UnlockComponent will automatically activate a 30-day trial period.

HCkHttpResponse CkHttp_PostMime(HCkHttp handle, const char *url, const char *mime);

To be documented soon...

BOOL CkHttp_PutBinary(HCkHttp handle, const char *url, HCkByteData byteData, const char *contentType, BOOL md5, BOOL gzip, HCkString outStr);

(PreRelease) Sends an HTTP PUT request to the url. The body of the HTTP request is byteData. The contentType is a content type such as "image/gif", "application/pdf", etc. If md5 is true, then a Content-MD5 header is added with the base64 MD5 hash of the byteData. Servers aware of the Content-MD5 header will perform a message integrity check to ensure that the data has not been corrupted. If gzip is true, the byteData is compressed using the gzip algorithm. The HTTP request body will contain the GZIP compressed data, and a "Content-Encoding: gzip" header is automatically added to indicate that the request data needs to be ungzipped when received (at the server).

BOOL CkHttp_PutText(HCkHttp handle, const char *url, const char *textData, const char *charset, const char *contentType, BOOL md5, BOOL gzip, HCkString outStr);

(PreRelease) Sends an HTTP PUT request to the url. The body of the HTTP request is textData. The charset should be set to a charset name such as "iso-8859-1", "windows-1252", "Shift_JIS", "utf-8", etc. The string "ansi" may also be used as a charset name. The contentType is a content type such as "text/plain", "text/xml", etc. If md5 is true, then a Content-MD5 header is added with the base64 MD5 hash of the textData. Servers aware of the Content-MD5 header will perform a message integrity check to ensure that the data has not been corrupted. If gzip is true, the textData is compressed using the gzip algorithm. The HTTP request body will contain the GZIP compressed data, and a "Content-Encoding: gzip" header is automatically added to indicate that the request data needs to be ungzipped when received (at the server).

BOOL CkHttp_QuickDeleteStr(HCkHttp handle, const char *url, HCkString outStr);

Same as QuickGetStr, but uses the HTTP DELETE method instead of the GET method.

BOOL CkHttp_QuickGet(HCkHttp handle, const char *url, HCkByteData data);

Sends an HTTP GET request for a URL and returns the response body as a byte array. The URL may contain query parameters. If the SendCookies property is true, matching cookies previously persisted to the CookiesDir are automatically included in the request. If the FetchFromCache property is true, the page may be fetched directly from cache. Because the URL can specify any type of resource (HTML page, GIF image, etc.) the return value is a byte array. If the resource is known to be a string, such as with an HTML page, you may call QuickGetStr instead. If the HTTP request fails, a zero-length byte array is returned and error information can be found in the LastErrorText, LastErrorXml, or LastErrorHtml properties.

BOOL CkHttp_QuickGetStr(HCkHttp handle, const char *url, HCkString str);

Sends an HTTP GET request for a URL and returns the response body as a string. The URL may contain query parameters. If the SendCookies property is true, matching cookies previously persisted to the CookiesDir are automatically included in the request. If the FetchFromCache property is true, the page could be fetched directly from cache. If the HTTP request fails, a NULL value is returned and error information can be found in the LastErrorText, LastErrorXml, or LastErrorHtml properties.

BOOL CkHttp_QuickPutStr(HCkHttp handle, const char *url, HCkString outStr);

(PreRelease) Same as QuickGetStr, but uses the HTTP PUT method instead of the GET method.

void CkHttp_RemoveRequestHeader(HCkHttp handle, const char *name);

Eliminates a header field from being included in HTTP GET requests issued by the QuickGet and QuickGetStr methods.

BOOL CkHttp_RenderGet(HCkHttp handle, const char *url, HCkString outStr);

Same as QuickGet, but does not send the HTTP GET. Instead, it builds the HTTP request that would've been sent and returns it.

BOOL CkHttp_ResumeDownload(HCkHttp handle, const char *url, const char *filename);

Same as the Download method, except a failed download may be resumed. The targetFilename is automatically checked and if it exists, the download will resume at the point where it previously failed. ResumeDownload may be called any number of times until the full download is complete.

Returns TRUE for success, FALSE for failure.

BOOL CkHttp_SaveLastError(HCkHttp handle, const char *filename);

Saves the last error information to an XML formatted file.

void CkHttp_SetRequestHeader(HCkHttp handle, const char *name, const char *value);

Adds or replaces a custom HTTP request header to be sent with all GET requests issued by the QuickGet and QuickGetStr methods.

void CkHttp_SetSslClientCert(HCkHttp handle, HCkCert cert);

Allows for a client-side certificate to be used for an SSL connection.

HCkHttpResponse CkHttp_SynchronousRequest(HCkHttp handle, const char *domain, long port, BOOL ssl, HCkHttpRequest req);

Sends an explicit HttpRequest to an HTTP server and returns an HttpResponse object. The HttpResponse object provides full access to the response including all headers and the response body. This method may be used to send POST requests, as well as GET, HEAD, file uploads, and XMLHTTP.

BOOL CkHttp_UnlockComponent(HCkHttp handle, const char *unlockCode);

Unlocks the Http class/component. It is necessary to call Http.UnlockComponent before calling any other methods. Passing any string to UnlockComponent will automatically activate a 30-day trial period.

Returns TRUE for success, FALSE for failure.

BOOL CkHttp_UrlDecode(HCkHttp handle, const char *str, HCkString outStr);

URL decodes a string.

BOOL CkHttp_UrlEncode(HCkHttp handle, const char *str, HCkString outStr);

URL encodes a string.

BOOL CkHttp_XmlRpc(HCkHttp handle, const char *urlEndpoint, const char *xmlIn, HCkString outStr);

(PreRelease) Makes an XML RPC call to a URL endpoint. The XML string is passed in an HTTP POST, and the XML response is returned.

BOOL CkHttp_XmlRpcPut(HCkHttp handle, const char *urlEndpoint, const char *xmlIn, HCkString outStr);

(PreRelease) Same as XmlRpc, but uses the HTTP PUT method instead of the POST method.

const char *CkHttp_acceptCharset(HCkHttp handle);

The AcceptCharset header field to be automatically included with GET requests issued by QuickGet or QuickGetStr. The default value is "ISO-8859-1,utf-8;q=0.7,*;q=0.7".

const char *CkHttp_acceptLanguage(HCkHttp handle);

The AcceptLanguage header field to be automatically included with GET requests issued by QuickGet or QuickGetStr. The default value is "en-us,en;q=0.5".

const char *CkHttp_ck_accept(HCkHttp handle);

To be documented soon...

const char *CkHttp_connection(HCkHttp handle);

The Connection header field to be automatically included with GET requests issued by QuickGet or QuickGetStr. The default value is "Keep-Alive". To prevent the Connection header from being added to the HTTP header, set this property to the empty string.

const char *CkHttp_cookieDir(HCkHttp handle);

Specifies a directory where cookies are automatically persisted if the Http.SaveCookies property is turned on. Cookies are stored in XML formatted files, one per domain, to main it easy for other programs to understand and parse.

const char *CkHttp_finalRedirectUrl(HCkHttp handle);

If an HTTP GET was redirected (as indicated by the WasRedirected property), this property will contain the final redirect URL, assuming the FollowRedirects property is true.

const char *CkHttp_genTimeStamp(HCkHttp handle);

(PreRelease) Returns the current GMT (also known as UTC) date/time in a string that is compliant with RFC 2616 format.

const char *CkHttp_getCacheRoot(HCkHttp handle, int index);

Returns the Nth cache root (indexing begins at 0). Cache roots are set by calling AddCacheRoot one or more times.

const char *CkHttp_getCookieXml(HCkHttp handle, const char *domain);

To be documented soon.

const char *CkHttp_getDomain(HCkHttp handle, const char *url);

Utility method for extracting the domain name from a full URL. For example, if "http://www.chilkatsoft.com/default.asp" is the URL passed in, then "www.chilkatsoft.com" is returned.

const char *CkHttp_getRequestHeader(HCkHttp handle, const char *name);

Returns the value of a header field that has been pre-defined to be sent with all HTTP GET requests issued by the QuickGet and QuickGetStr methods. By default, this includes header fields such as Accept, AcceptCharset, AcceptLanguage, Connection, UserAgent, etc.

const char *CkHttp_getUrlPath(HCkHttp handle, const char *url);

Returns the path part of a URL. The syntax of a URL is ://:@:/;?#. This method returns the "path" part.

const char *CkHttp_lastContentType(HCkHttp handle);

The content-type of the last HTTP response received by the HTTP component.

const char *CkHttp_lastErrorHtml(HCkHttp handle);

Error information in HTML format for the last method called.

const char *CkHttp_lastErrorText(HCkHttp handle);

Error information in plain-text format for the last method called.

const char *CkHttp_lastErrorXml(HCkHttp handle);

Error information in XML format for the last method called.

const char *CkHttp_lastHeader(HCkHttp handle);

The text of the last HTTP header sent by any of this class's methods. The purpose of this property is to allow the developer to examine the exact HTTP header for debugging purposes.

const char *CkHttp_lastModDate(HCkHttp handle);

The value of the Last-Modified header in the last HTTP response received by the HTTP component.

const char *CkHttp_lastResponseHeader(HCkHttp handle);

The entire last response header for the last HTTP response received by the HTTP component.

const char *CkHttp_login(HCkHttp handle);

The HTTP login for pages requiring a login/password. Chilkat HTTP can do both Basic and NTLM HTTP authentication. (NTLM is also known as SPA (or Windows Integrated Authentication). To use NTLM, set the NtlmAuth property = true.

const char *CkHttp_password(HCkHttp handle);

The HTTP password for pages requiring a login/password. Chilkat HTTP can do both Basic and NTLM HTTP authentication. (NTLM is also known as SPA (or Windows Integrated Authentication). To use NTLM, set the NtlmAuth property = true.

const char *CkHttp_proxyDomain(HCkHttp handle);

The domain name of a proxy host if an HTTP proxy is used.

const char *CkHttp_proxyLogin(HCkHttp handle);

If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy login.

const char *CkHttp_proxyPassword(HCkHttp handle);

If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy password.

const char *CkHttp_putBinary(HCkHttp handle, const char *url, HCkByteData byteData, const char *contentType, BOOL md5, BOOL gzip);

(PreRelease) Sends an HTTP PUT request to the url. The body of the HTTP request is byteData. The contentType is a content type such as "image/gif", "application/pdf", etc. If md5 is true, then a Content-MD5 header is added with the base64 MD5 hash of the byteData. Servers aware of the Content-MD5 header will perform a message integrity check to ensure that the data has not been corrupted. If gzip is true, the byteData is compressed using the gzip algorithm. The HTTP request body will contain the GZIP compressed data, and a "Content-Encoding: gzip" header is automatically added to indicate that the request data needs to be ungzipped when received (at the server).

const char *CkHttp_putText(HCkHttp handle, const char *url, const char *textData, const char *charset, const char *contentType, BOOL md5, BOOL gzip);

(PreRelease) Sends an HTTP PUT request to the url. The body of the HTTP request is textData. The charset should be set to a charset name such as "iso-8859-1", "windows-1252", "Shift_JIS", "utf-8", etc. The string "ansi" may also be used as a charset name. The contentType is a content type such as "text/plain", "text/xml", etc. If md5 is true, then a Content-MD5 header is added with the base64 MD5 hash of the textData. Servers aware of the Content-MD5 header will perform a message integrity check to ensure that the data has not been corrupted. If gzip is true, the textData is compressed using the gzip algorithm. The HTTP request body will contain the GZIP compressed data, and a "Content-Encoding: gzip" header is automatically added to indicate that the request data needs to be ungzipped when received (at the server).

const char *CkHttp_quickDeleteStr(HCkHttp handle, const char *url);

Same as QuickGetStr, but uses the HTTP DELETE method instead of the GET method.

const char *CkHttp_quickGetStr(HCkHttp handle, const char *url);

Sends an HTTP GET request for a URL and returns the response body as a string. The URL may contain query parameters. If the SendCookies property is true, matching cookies previously persisted to the CookiesDir are automatically included in the request. If the FetchFromCache property is true, the page could be fetched directly from cache. If the HTTP request fails, a NULL value is returned and error information can be found in the LastErrorText, LastErrorXml, or LastErrorHtml properties.

const char *CkHttp_quickPutStr(HCkHttp handle, const char *url);

(PreRelease) Same as QuickGetStr, but uses the HTTP PUT method instead of the GET method.

const char *CkHttp_referer(HCkHttp handle);

The Referer header field to be automatically included with GET requests issued by QuickGet or QuickGetStr. The default value is the empty string which causes the Referer field to be omitted from the request header.

const char *CkHttp_renderGet(HCkHttp handle, const char *url);

Same as QuickGet, but does not send the HTTP GET. Instead, it builds the HTTP request that would've been sent and returns it.

const char *CkHttp_requiredContentType(HCkHttp handle);

If set, then any HTTP response to any POST or GET, including downloads, will be rejected if the content-type in the response header does not match this setting. If the content-type does not match, only the header of the HTTP response is read, the connection to the HTTP server is closed, and the remainder of the response is never read.

This property is empty (zero-length string) by default.

Some typical content-types are "text/html", "text/xml", "image/gif", "image/jpeg", "application/zip", "application/msword", "application/pdf", etc.

const char *CkHttp_sslProtocol(HCkHttp handle);

Selects the secure protocol to be used for secure (SSL) connections. Possible values are:

default
TLS 1.0
SSL 3.0
SSL 2.0
PCT 1.0
The default value is "default", which allows for the protocol to be selected dynamically at runtime based on the requirements of the server.

const char *CkHttp_urlDecode(HCkHttp handle, const char *str);

URL decodes a string.

const char *CkHttp_urlEncode(HCkHttp handle, const char *str);

URL encodes a string.

const char *CkHttp_userAgent(HCkHttp handle);

The UserAgent header field to be automatically included with GET requests issued by QuickGet or QuickGetStr. The default value is "Chilkat/1.0.0 (+http://www.chilkatsoft.com/ChilkatHttpUA.asp)" which indicates that the software used to issue the HTTP request was the Chilkat HTTP component.

const char *CkHttp_version(HCkHttp handle);

Returns a string such as "1.0.0" indicating the version of the HTTP component.

const char *CkHttp_xmlRpc(HCkHttp handle, const char *urlEndpoint, const char *xmlIn);

(PreRelease) Makes an XML RPC call to a URL endpoint. The XML string is passed in an HTTP POST, and the XML response is returned.

const char *CkHttp_xmlRpcPut(HCkHttp handle, const char *urlEndpoint, const char *xmlIn);

(PreRelease) Same as XmlRpc, but uses the HTTP PUT method instead of the POST method.