Category:HTTP
More information about HTTP or Hypertext Transfer Protocol can be found at Wikipedia:Hypertext Transfer Protocol.
Business Rules! 4.20 introduces HTTP support.
See also:
- BR Web Scripting Bridge
- cURL
- BR Forum > Advanced Concepts > BR 4.2 HTTP - CLIENT
- http.zip from [[1]] contains a required ca-bundle.crt for HTTPS connections along with samples.
- Connecting to browsers online Tutorial
The OPEN string for XML and DISPLAY files will support a new optional parameter called HTTP=CLIENT or HTTP=SERVER. The CLIENT or SERVER designation will denote processing in the following sequence:
CONFIG HTTP PORT 5555 LOG file-pathname CONFIG HTTPS PORT 7777 LOG file-pathname
HTTP SERVER
NAME=served-pathname-mask
For example:
NAME=Index.html
or
NAME=MyApp/*
- Only one HTTP server file may be open in each BR session.
- Only one HTTP server file may occupy any one port.
LINPUT (listen)
- WAIT=nnn awaits browser inquiry
- Inquiry filename string with GET parameters -> file$(channel,”Client-Inquiry”)
- Any data input would be POST data
PRINT (accumulate response data) PRINT …
- When a LINPUT or a CLOSE is issued, the buffered response data is sent.
HTTP Server carries a separate licensing fee.
HTTP Client is available as a standard BR feature.
HTTP CLIENT
OPEN
NAME=Full URL (web page reference) CONTROL=display-filename
PRINT (accumulate post data)
- when the first LINPUT is issued POSTing of all print lines occurs; and
- all responses are buffered before the LINPUT returns data.
LINPUT
- until EOF is reached or until another PRINT is issued
- a PRINT clears the LINPUT buffer
Processing must be performed in the above sequence or an error is generated.
FILE$(fileno,”HTTPINFO”) returns LOG info for the latest action.
New Error Code- 4340 An HTTP error has occurred. See SYSERR and SYSERR$.
CONTROL Statements
These are case insensitive.
USER-AGENT string
Specify the User-Agent string to send to the HTTP server. Some badly done CGIs fail if its not set to "Mozilla/4.0". To encode blanks in the string, surround the string with single quote marks.
REFERER the linked-from URL
COOKIE “NAME=data”
e. g. “NAME1=value1; NAME2=value2"
If no '=' letter is used in the line, it is treated as a filename used to read previously stored cookie lines from, which should be used in this session if they match. Using this method also activates the "cookie parser" which will record incoming cookies too, which may be handy if you're using this in combination with the -L/--location option. The file format of the file to read cookies from should be plain HTTP headers or the Netscape/Mozilla cookie file format.
NOTE that the file specified with COOKIE is only used as input. No cookies will be stored in the file. To store cookies, save the HTTP headers to a file using DUMP-HEADER.
COOKIE-JAR filename
The name of a file that is to contain a copy of all cookies encountered either inbound or outbound.
DATA filename
Sends the specified data in a POST request to the HTTP server, in a way that can emulate as if a user has filled in a HTML form and pressed the submit button. The data is sent exactly as specified with all newlines cut off. It is expected to be "url-encoded". This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded. If more than one DATA option is used on the same command line, the data pieces specified will be merged together with a separating semicolon. Thus, using 'DATA name=daniel skill=great' would generate a post chunk that looks like 'name=daniel&skill=great'.
If you start the data with the letter @, the rest should be a file name to read the data from. The contents of the file must already be url-encoded. Multiple files can also be specified. Posting data from a file named 'footbar' would thus be done with "DATA @footbar".
HEADER additional header parameters
Extra header to use when getting a web page. You may specify any number of extra headers.
DUMP-HEADERS filename
Write the HTTP headers to this file.
HEAD – retrieve headers only
SSLV2 - force SSL version 2
SSLV3 - force SSL version 3
WRITE-OUT string
Used with the following optional substitution values:
url_effective The URL that was fetched last.
http_code The numerical code that was found in the last retrieved HTTP(S) page.
time_total The total time, in seconds, that the full operation lasted. The time will be displayed with millisecond resolution.
time_namelookup The time, in seconds, it took from the start until the name resolving was completed.
time_connect The time, in seconds, it took from the start until the connect to the remote host (or proxy) was completed.
time_pretransfer The time, in seconds, it took from the start until the file transfer is just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved.
time_starttransfer The time, in seconds, it took from the start until the first byte is just about to be transferred. This includes time_pretransfer and also the time the server needs to calculate the result.
size_download The total amount of bytes that were downloaded.
size_upload The total amount of bytes that were uploaded.
size_header The total amount of bytes of the downloaded headers.
size_request The total amount of bytes that were sent in the HTTP request.
speed_download The average download speed that BR measured for the complete download.
speed_upload The average upload speed that BR measured for the complete upload.
content_type The Content-Type of the requested document, if there was any.