HTTP: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
No edit summary
Line 77: Line 77:


===Additional Header Parameters===
===Additional Header Parameters===
HEADER refers to an extra header to use when getting a web page. Any number of extra headers may be specified.
'''HEADER''' refers to an extra header to use when getting a web page. Any number of extra headers may be specified.


;DUMP-HEADERS filename
'''DUMP-HEADERS filename''' - HTTP headers are written to this file.
HTTP headers are written to this file.


'''HEAD''' – retrieve headers only
'''HEAD''' – retrieve headers only

Revision as of 21:52, 7 February 2013

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:

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

e.g Index.html or 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.

LINPUT (listen)

HTTP Server carries a separate licensing fee.

HTTP Client is available as a standard BR feature.

HTTP CLIENT

Processing must be performed in the following sequence or an error is generated.

OPEN 
    NAME=Full URL -	web page reference -
    CONTROL=display-filename
PRINT (accumulate post data)
PRINT  …
*	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

Further Comments

FILE$(fileno,”HTTPINFO") returns LOG info for the latest action.

Relevant error code

4340 An HTTP error has occurred – see SYSERR and SYSERR$.

CONTROL Statements 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 is the linked-from URL.

COOKIE “NAME=data”, for example: “NAME1=value1; NAME2=value2".

If no '=' letter is used in the line, it is treated as a filename to use to read previously stored cookie lines from, which should be used in the current session if they match. Using this method also activates the "cookie parser" which will record incoming cookies too. This may be handy if you're using it 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: 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".

Additional Header Parameters

HEADER refers to an extra header to use when getting a web page. Any number of extra headers may be specified.

DUMP-HEADERS filename - HTTP headers are written to this file.

HEAD – retrieve headers only

SSLV2 - force SSL version 2 SSLV3 - force SSL version 3

WRITE-OUT string

-use 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 transfered. 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.