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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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 changed 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.
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
AuthTokenAuthToken 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.
ClientCertificateString 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>".
ClientCertificatePasswordCharacter stringPassword associated with the client certificate (empty string by default)
ConnectionTimeoutInteger 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,
  • 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).
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.
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".
DestinationCharacter stringFull path of the backup file of the HTTP request result.
DownloadProgresshttpProgress variableData reception progress notification.
HeaderAssociative array of character stringsKey/Value set of headers to send.
Usage example of 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.
  • 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.
MaxDownloadRateIntegerMaximum data download speed in kilobytes per second. This speed is given for information only.
0 (default value) means that this speed is not limited.
MaxUploadRateIntegerMaximum data upload speed in kilobytes per second. This speed is given for information only.
0 (default value) means that this speed is not limited.
MethodInteger constantHTTP method used:
  • httpCopy: COPY method.
  • httpDelete: DELETE method.
  • httpGet: GET method.
  • httpHead: HEAD method.
  • httpLock: Lock method (WebDAV protocol).
  • httpMkCol: MkCol method (WebDAV protocol).
  • httpMove: Move method (WebDAV protocol).
  • httpPatch: PATCH method.
  • httpPost: POST method.
  • httpPropFind: PROPFIND method (WebDAV protocol).
  • httpPropPatch: PROPPATCH method (WebDAV protocol).
  • httpPut: PUT method.
  • 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 username (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.
ProcedureTraceProcedureName 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.
    • httpTraceDataReceived: Data received.
    • httpTraceHeaderSent: Header sent.
    • 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
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.
TimeoutInteger ou DurationMaximum response timeout (in milliseconds). This property can correspond to:
  • an integer corresponding to the number of milliseconds,
  • a Duration variable,
  • the duration in a readable format (e.g., '1s' or '10ms').
This property is set to 20 seconds by default.
Remark: The timeout defined by HTTPTimeOut has no influence on this property.
UploadProgresshttpProgress variableNotification of the progress status when uploading POST data.
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.
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.
New in version 27
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.
VersionSSLInteger constantSSL version used:
  • ProtocolDefault: Default protocol (TLS 1.2).
  • ProtocolTLS1: TLS1 protocol.
  • ProtocolTLS1_1: TLS1.1 protocol.
  • ProtocolTLS1_2: TLS1.2 protocol.

Remark

Redirections are supported by default. To ignore redirections, use the httpIgnoreRedirection constant in the IgnoreError property.
WINDEV

HTTP cookies

Cookies received in response to a call to HTTPSend are stored while waiting for a subsequent 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