Custom libURL API

This documentat contains the additional commands and functions available in the customized version of libURL that comes with the framework. Note that there are no API calls for working with cookies. Sending/receiving of cookies is handled transparently by libURL.

Commands

libURLSetBypassCertificateCallback pMessage, pObject

This handler registers a callback that will be sent if your application attempts to connect via SSL to a server that has an invalid SSL certificate. In your callback you can alert the user of the situation and return true if the url should be loaded regardless or false if the operation should be cancelled.

libURLSetBypassCertificateCallback "PromptToIgnoreInvalidCertificateCallback", the long id of me

on PromptToIgnoreInvalidCertificateCallback pURL

## prompt in dialog

set the uURL of stack "Bad SSL Cert Alert" to pURL

modal stack "Bad SSL Cert Alert"

return the dialogData is "OK"

end PromptToIgnoreInvalidCertificateCallback

libURLSetFollowRedirectCallback pMessage, pObject

When a redirect request (301, 302 and 307) is received for anything other than GET/HEAD requests (i.e. POST, PUT and DELETE) the user should be asked for permission in order for the redirect to occur. This handler registers a callback that will be sent in such a circumstance. The callback returns "redirect" to allow the redirect and "get" to retrieve the new url using GET. Any other value will cause the operation to be cancelled.

libURLSetFollowRedirectCallback "FollowRedirects", the long id of me

on FollowRedirects pMethod, pURL, pStatusCode, pRedirectURL

## Prompt in dialog

set the uURL of stack "FollowRedirect" to pURL

set the uStatusCode of stack "FollowRedirect" to pStatusCode

set the uRedirectURL of stack "FollowRedirect" to pRedirectURL

modal stack "Bad SSL Cert Alert"

return the dialogdata ## redirect, get, or cancel

end FollowRedirects

libURLSetProxyBypassList pList

Sets the list of hosts that bypass proxy servers. You can use wildcards in the list. Calling glxapp_initializeProxy will set this list for you automatically. pList is a return delimited list.

libURLSetServersThatBypassCertificateVerification pServers

Sets the list of servers that have invalid SSL certificates but which have been cleared for used by the user. Generally you will update this list when an invalid SSL certificate is encountered and the user says it is okay to keep loading it. You can store this list in a preference and then call libURLSetServersThatBypassCertificateVerification each time your application launches. pServers is a return delimited list.

libURLUseHEADForNextHTTPGetRequest pBoolean

Passing true to this command instructs libURL to make a HEAD request, rather than the normal GET request, the next time you download a url using put URL theURL into theVar or get URL theURL. The setting is only valid for the very next request.

libURLUseHttpProxyForURL pBoolean

Set to true if you would like libURL to use httpProxyForURL (unsupported engine feature) to determine the proxy server for each url that is loaded. You just initialize httpProxyForURL ahead of time using a PAC file in order for this to work. Calling glxapp_initializeProxy will handle this for you automatically in most cases.

Functions

libURLGetFollowRedirectCallback()

Returns an array representing the registered callback for following redirects (see libURLSetFollowRedirectCallback). The keys of the array are "message" and "object".

libURLGetServersThatBypassCertificateVerification()

Returns the list of servers that have invalid SSL certificates but have been cleared for use anyway.

libURLInternetTimeStampInGMT()

Returns an internet time stamp in GMT. This may be useful when talking with an internet service.

"Tue, 11-Aug-2009 03:28:13 GMT"

libURLTimeStampInGMT()

Returns a time stamp in GMT. This may be useful when talking with an internet service.

"2009-08-11 03:28:13 GMT"

libURLGMTTimeStampToInternetDate(pTimestamp)

Converts an internet time stamp or time stamp to an internet date. Values returned by libURLTimeStampInGMT() and libURLInternetTimeStampInGMT() are both valid time stamps that can be passed in.

put libURLGMTTimeStampToInternetDate( libURLInternetTimeStampInGMT() )

"Mon, 10 Aug 2009 23:29:29 -0400"

libURLLoadingURLs()

Returns a list of urls that are being downloaded asynchronously (using load url).

libURLURLBypassesProxy(pURL)

Returns the list of servers that bypass the proxy server. This is primarily used internally by libURL. The list of servers is set automatically if you call glxapp_initializeProxy.

0 Comments

Add your comment

E-Mail me when someone replies to this comment