4D v15

WEB GET OPTION and WEB SET OPTION

Home

 
4D v15
WEB GET OPTION and WEB SET OPTION

WEB GET OPTION and WEB SET OPTION  


 

 

WEB GET OPTION ( selector ; value )
WEB SET OPTION ( selector ; value )

Originally introduced in 4D v14 R3

A new value is available for the selector parameter of the WEB GET OPTION and WEB SET OPTION commands:

ConstantTypeValue
Web Session enable IP address validationLongint83
  • Scope: Local Web server
  • Kept between two sessions: No
  • Description: Allows you to disable or enable IP address validation for session cookies. For security reasons, by default the 4D Web server checks the IP address of a request containing a session cookie and rejects it if it does not match the IP address used to create the cookie. In some specific applications, you may want to disable this validation and accept the session cookie, even if the IP addresses do not match. For example when mobile devices switch between Wifi and 3G/4G networks, their IP will change. In this case, you have to pass 0 in this option to allow clients to be able to keep on using their Web sessions even when they change IP addresses. Note that this setting will lower the security levels of your application.
    When defined, this setting is effective immediately (you do not need to restart the HTTP server).
  • Possible values: 0 (disabled) or 1 (enabled)
  • Default value: 1 (IP addresses are checked)

A new constant is available in 4D v15 for the selector parameter: Web debug log (84).

This selector allows you to get or set the status of the new HTTP request log file for the 4D Web server. When enabled, this file, named "HTTPDebugLog_nn.txt", is saved in the "Logs" folder of the application (nn is the file number). It is useful for debugging issues related to the Web server. It records each request and each response in raw mode. Whole requests, including headers, are logged; optionally, body parts can be logged as well.

When you pass Web debug log in selector, several value options can be get or set, corresponding to the information you want to log. The following new constants are available in the "Web Server" constant theme:

Constant (value)TypeDescription
wdl disable (0)LongintWeb HTTP debug log is disabled
wdl enable without body (1)LongintWeb HTTP debug log is enabled without body parts (body size is provided in this case)
wdl enable with response body (3)LongintWeb HTTP debug log is enabled with body part in response only
wdl enable with request body (5)LongintWeb HTTP debug log is enabled with body part in request only
wdl enable with all body parts (7)LongintWeb HTTP debug log is enabled with body parts in response and request

Note: The HTTP request log file can only be enabled or disabled using the WEB SET OPTION command.

  // Disabling IP Address validation
 WEB SET OPTION(Web session enable IP address validation;0)
 ... // specific code
  // Enabling IP Address Validation
 WEB SET OPTION(Web session enable IP address validation;1)

Enabling the HTTP debug log without body parts:

A log entry looks like this:

# REQUEST
# SocketID: 1592
# PeerIP: 127.0.0.1
# PeerPort: 54912
# TimeStamp: 39089388
GET /4DWEBTEST HTTP/1.1
Connection: Close
Host: 127.0.0.1
User-Agent: 4D_HTTP_Client/0.0.0.0

# RESPONSE
# SocketID: 1592
# PeerIP: 127.0.0.1
# PeerPort: 54912
# TimeStamp: 39089389 (elapsed time: 1 ms)
HTTP/1.1 200 OK
Accept-Ranges: bytes
Connection: close
Content-Length: 3555
Content-Type: text/plain; charset=UTF-8
Date: Tue, 20 Jan 2015 10:51:29 GMT
Expires: Tue, 20 Jan 2015 10:51:29 GMT
Pragma: no-cache
Server: 4D/14.6.0

[Body Size: 3555]

 
PROPERTIES 

Product: 4D
Theme: Language

 
HISTORY 

 
ARTICLE USAGE

4D v15 - Upgrade (standard edition) ( 4D v15)

Inherited from : WEB GET OPTION and WEB SET OPTION ( 4D v15)