PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Properties specific to the description of httpRequest variables
  • Remark
  • HTTP cookies
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
The httpRequest type is used to retrieve the advanced characteristics of an HTTP/HTTPS request. The characteristics of this HTTP/HTTPS request can be defined and modified using different WLanguage properties.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Versions 22 and later
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for Android applications.
WEBDEV - Browser code This type of variable is now available in browser code.
New in version 22
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for Android applications.
WEBDEV - Browser code This type of variable is now available in browser code.
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for Android applications.
WEBDEV - Browser code This type of variable is now available in browser code.
Example
cMyRequest is httpRequest
cMyRequest.URL = "https://www.windev.com"
cMyResponse is httpResponse = HTTPSend(cMyRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(cMyResponse.Content)
END
Remarks

Properties specific to the description of httpRequest variables

The following properties can be used to handle an HTTP/HTTPS request:
Property nameType usedEffect
UserAgentCharacter stringIdentifies the client. By default, the value corresponds to the application name.
The response content may depend on the user agent (for example, different pages are required by a request performed from a Palm Pilot and a request performed from a PC browser). In this case, for more details, see the documentation of user agent.
WEBDEV - Browser code Not available.
Versions 22 and later
AuthToken
New in version 22
AuthToken
AuthToken
AuthToken variableToken for accessing a Webservice that will be used in case of authentication via the OAuth 2.0 protocol. This access token is retrieved by AuthIdentify.
The access token is automatically passed to the access_token parameter on the URL. If the parameter must be different, the http URL to run must be built by yourself.
WEBDEV - Browser code Not available.
UploadProgresshttpProgress variableNotification of progress status when uploading POST data.
DownloadProgresshttpProgress variableNotification of progress status of download.
Versions 24 and later
ClientCertificate
New in version 24
ClientCertificate
ClientCertificate
String or bufferCorresponds to:
  • a character string with an access path to the .p12 file that contains the certificate to attach to the request. The certificate will be automatically loaded taking into account:
    • the certificate in the executable library (if it has been integrated into the application),
    • the certificate at the specified location on disk (if the certificate has not been integrated into the executable library).
  • a buffer with the certificate (fLoadBuffer).
If this property corresponds to an empty string (""), the default certificate is reset to "<None>".
ContentTypeCharacter stringType of the HTTP message content to be sent to the server. This property is taken into account only if the sending method (Method property) allows it.
By default, the message type corresponds to: "application/x-www-form-urlencoded".
However, you have the ability to use any value, for example: "text/xml", "application/javascript", "application/json", "application/xml", "image/jpeg", ...
To send rough data that will be read at once by the WEBDEV application server, use the following types:
  • "application/octet-stream".
  • "text/xml".
ContentBufferHTTP message that will be sent to the server. This property is taken into account only if the sending method (Method property) allows it.
The message to send must comply with the HTTP protocol used. By default, if this property is specified and if it is not empty, the method used is a POST request ; otherwise, it is a GET request.
Versions 26 and later
WEBDEV - Browser code ResponseRawContent
New in version 26
WEBDEV - Browser code ResponseRawContent
WEBDEV - Browser code ResponseRawContent
BooleanIndicates whether the Content property corresponds to the raw content:
  • True: the Content property corresponds to a buffer. No modification is performed.
  • False (Default value): the content is modified by the browser. In particular, UTF-8 text is automatically decoded. the Content property returns the result as a string.
Versions 25 and later
MaxUploadRate
New in version 25
MaxUploadRate
MaxUploadRate
IntegerMaximum data upload speed in kilobytes per second. This speed is given for information only.
0 (default value) means that this speed is not limited.
WEBDEV - Browser code Not available.
Versions 25 and later
MaxDownloadRate
New in version 25
MaxDownloadRate
MaxDownloadRate
IntegerMaximum data download speed in kilobytes per second. This speed is given for information only.
0 (default value) means that this speed is not limited.
WEBDEV - Browser code Not available.
Versions 24 and later
Destination
New in version 24
Destination
Destination
Character stringFull path of the backup file of the HTTP request result.
WEBDEV - Browser code Not available.
TimeoutInteger ou DurationMaximum response timeout (in milliseconds). This property can correspond to:
  • an integer corresponding to the number of milliseconds,
  • a Duration variable,
  • Versions 23 and later
    the duration in a readable format (e.g., '1s' ou '10ms').
    New in version 23
    the duration in a readable format (e.g., '1s' ou '10ms').
    the duration in a readable format (e.g., '1s' ou '10ms').
This property is set to 20 seconds by default.
Remark: The timeout defined by HTTPTimeOut has no influence on this property.
WEBDEV - Browser code Not available.
HeaderAssociative array of character stringsKey/Value set of headers to send.
Example for using this property:
cMyRequest.Header["Authorization"] = ...
" WSSE profile=""UsernameToken"""
cMyRequest.Header["X-WSSE"] = ...
"UsernameToken Username=blahblah "
cMyRequest.Header["Cache-Control"] = " no-cache"
IgnoreErrorInteger constantSpecifies the ignored errors. Corresponds to a constant or to a combination of constants:
  • httpIgnoreInvalidCertificate: The certificate is ignored.
  • httpIgnoreInvalidCertificateName: The site name specified in the certificate is ignored.
  • httpIgnoreExpiredCertificate: The certificate date is ignored.
  • Versions 21 and later
    httpIgnoreRedirection: The redirection to a page is ignored.
    New in version 21
    httpIgnoreRedirection: The redirection to a page is ignored.
    httpIgnoreRedirection: The redirection to a page is ignored.
  • httpIgnoreRedirectToHTTP: The redirection to a non-secure server is allowed.
  • httpIgnoreRedirectToHTTPS: The redirection to a secure server is allowed.
  • httpIgnoreRevocation: The check in the list of revoked certificates is ignored.
Versions 22 and later
AndroidAndroid Widget Only the following errors are supported: httpIgnoreExpiredCertificate, httpIgnoreInvalidCertificate, httpIgnoreInvalidCertificateName, httpIgnoreRevocation, httpIgnoreRedirection.
New in version 22
AndroidAndroid Widget Only the following errors are supported: httpIgnoreExpiredCertificate, httpIgnoreInvalidCertificate, httpIgnoreInvalidCertificateName, httpIgnoreRevocation, httpIgnoreRedirection.
AndroidAndroid Widget Only the following errors are supported: httpIgnoreExpiredCertificate, httpIgnoreInvalidCertificate, httpIgnoreInvalidCertificateName, httpIgnoreRevocation, httpIgnoreRedirection.
WEBDEV - Browser code Not available.
MethodInteger constantHTTP method used:
  • httpCopy: COPY method.
  • httpDelete: DELETE method.
  • httpGet: GET method.
  • httpHead: HEAD method.
  • Versions 25 and later
    httpLock: Lock method (WebDAV protocol).
    New in version 25
    httpLock: Lock method (WebDAV protocol).
    httpLock: Lock method (WebDAV protocol).
  • Versions 25 and later
    httpMkCol: MkCol method (WebDAV protocol).
    New in version 25
    httpMkCol: MkCol method (WebDAV protocol).
    httpMkCol: MkCol method (WebDAV protocol).
  • Versions 25 and later
    httpMove: Move method (WebDAV protocol).
    New in version 25
    httpMove: Move method (WebDAV protocol).
    httpMove: Move method (WebDAV protocol).
  • httpPatch: PATCH method.
  • httpPost: POST method.
  • Versions 25 and later
    httpPropFind: PROPFIND method (WebDAV protocol).
    New in version 25
    httpPropFind: PROPFIND method (WebDAV protocol).
    httpPropFind: PROPFIND method (WebDAV protocol).
  • Versions 25 and later
    httpPropPatch: PROPPATCH method (WebDAV protocol).
    New in version 25
    httpPropPatch: PROPPATCH method (WebDAV protocol).
    httpPropPatch: PROPPATCH method (WebDAV protocol).
  • httpPut: PUT method.
  • Versions 25 and later
    httpUnlock: Unlock method (WebDAV protocol).
    New in version 25
    httpUnlock: Unlock method (WebDAV protocol).
    httpUnlock: Unlock method (WebDAV protocol).
If the Content property is not empty, the httpPost method is used by default. Otherwise, the httpGet method is used.
PasswordCharacter stringPassword associated with the user name (empty string by default). Used to access a page with a protected URL. Caution: The password is not encrypted when it is sent over the Internet.
Remark: If the UserName and Password properties are specified, the corresponding "Authorization:Basic" header is automatically generated in the request header.
Versions 24 and later
ClientCertificatePassword
New in version 24
ClientCertificatePassword
ClientCertificatePassword
Character stringPassword associated with the client certificate (empty string by default)
Versions 24 and later
ProcedureTrace
New in version 24
ProcedureTrace
ProcedureTrace
ProcedureName of the WLanguage procedure used to identify the data and headers that have been sent and received. This procedure has the following format:
PROCEDURE <Procedure name>(<InfoType> is int,
<Data> is Buffer)
where:
  • <InfoType> is an integer constant that corresponds to the type of data being traced:
    • httpTraceDataSent: Data sent.
    • Versions 26 and later
      httpTraceDataReceived: Data received.
      New in version 26
      httpTraceDataReceived: Data received.
      httpTraceDataReceived: Data received.
    • httpTraceHeaderSent: Header sent.
    • Versions 26 and later
      httpTraceHeaderReceived: Header received.
      New in version 26
      httpTraceHeaderReceived: Header received.
      httpTraceHeaderReceived: Header received.
  • <Data> is a buffer that contains the information.
Example of procedure:
PROCEDURE ProcTrace(nInfoType is int, ...
bufByData is Buffer)
SWITCH nInfoType
CASE httpTraceHeaderSent
Trace("Header sent: ", ...
UTF8ToString(bufByData))
CASE httpTraceDataSent:
Trace("Data sent: ", ...
bufByData)
CASE httpTraceHeaderReceived:
Trace("Header received: ", ...
UTF8ToString(bufByData))
CASE httpTraceDataReceived:
Trace("Data received: ", ...
bufByData)
 
END
WEBDEV - Browser code Not available.
Versions 21 and later
ConnectionTimeout
New in version 21
ConnectionTimeout
ConnectionTimeout
Integer ou DurationMaximum timeout for the connection expressed in milliseconds (20 seconds by default, which means 20000 milliseconds). This property can correspond to:
  • an integer corresponding to the number of milliseconds,
  • a Duration variable,
  • Versions 23 and later
    the duration in a readable format (e.g., 20 s or 20000 ms).
    New in version 23
    the duration in a readable format (e.g., 20 s or 20000 ms).
    the duration in a readable format (e.g., 20 s or 20000 ms).
The connection fails if it cannot be established after this timeout (HTTPSend will return an error, in the httpResponse result variable).
WEBDEV - Browser code Not available.
URLCharacter stringAddress of server to contact (URL address).
This URL can contain:
  • the port number for connecting to the server.
    The default value is 80 in HTTP (corresponds to a server of Web pages) and 443 in HTTPS. To specify a port number, use the following format: "<Server URL>:<Port #>". For example: http://www.windev.com:80.
  • additional parameters. These parameters can be used to perform a search or to fill a form. For example, to find "windev" on "http://www.google.com", the URL to contact will be: "http://www.google.com/search?q=windev".
Remarks:
  • To specify both the port number and additional parameters, use the following format: "<Server URL>:<Port #>/<Additional parameters>".
  • To perform a secure transaction, the URL must start with "https://". In this case, the management mode of requests is always performed by Internet Explorer (for more details, see HTTPParameter).
UserCharacter stringName used to access a page with a protected URL (empty string by default). This name is used to identify the user.
Remark: If the User and Password properties are specified, the corresponding "Authorization:Basic" header is automatically generated in the request header.
Versions 26 and later
VersionHTTP
New in version 26
VersionHTTP
VersionHTTP
Integer constantHTTP version used by the server:
  • httpVersion2: HTTP version 2.0. If the server does not support this version, an older version is used.
  • httpVersion2Only: Forces HTTP version 2.0: if the server does not support this version, a fatal error is displayed.
  • httpVersion1_1: HTTP version 1.1.
  • httpVersion1_0: HTTP version 1.0.
  • httpVersionDefault: HTTP version 1.0.
Versions 22 and later
VersionSSL
New in version 22
VersionSSL
VersionSSL
Integer constantSSL version used:
  • ProtocolDefault: Default protocol (TLS 1.2).
  • ProtocolTLS1: TLS1 protocol.
  • ProtocolTLS1_1: TLS1.1 protocol.
  • ProtocolTLS1_2: TLS1.2 protocol.
WEBDEV - Browser code Not available.

Remark

Versions 21 and later
Redirections are supported by default. To ignore redirections, use the httpIgnoreRedirection constant in the IgnoreError property.
New in version 21
Redirections are supported by default. To ignore redirections, use the httpIgnoreRedirection constant in the IgnoreError property.
Redirections are supported by default. To ignore redirections, use the httpIgnoreRedirection constant in the IgnoreError property.
WINDEVWEBDEV - Server codeAndroidAndroid Widget iPhone/iPadAjax

HTTP cookies

The cookies received in response to a call to HTTPSend are stored while waiting for a future call to HTTPSend on the same domain: the httpRequest variable is updated.
For more details, see HTTPCookieManage.
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment