HTTP: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
No edit summary
(Redirected page to Category:HTTP)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
More information about '''HTTP''' or '''Hypertext Transfer Protocol''' can be found at [[Wikipedia:Hypertext Transfer Protocol]].
#REDIRECT[[:Category:HTTP]]
 
[[Business Rules!]] [[4.20]] introduces HTTP support.
 
See also:
*[[BR Web Scripting Bridge]]
*[[cURL]]
*[http://brforum.BRulesCorp.com/viewtopic.php?t=142|CLIENT on the BR forum]
*[[http.zip]] on the [[FTP]] Site contains a required [[ca-bundle.crt]] for HTTPS connections along with samples.
 
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-
 
<B>url_effective</B>  The URL that was fetched last. 
 
<B>http_code</B>  The numerical code that was found in the last retrieved HTTP(S) page.
 
<B>time_total</B>  The  total  time,  in  seconds, that the full operation lasted. The time will  be displayed with millisecond resolution.
 
<B>time_namelookup</B>  The  time,  in seconds, it took from the start until the name resolving was completed.
 
<B>time_connect</B>  The  time,  in seconds, it took from the start until the connect  to  the  remote host (or proxy) was completed.
 
<B>time_pretransfer</B>  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.
 
<B>time_starttransfer</B>  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.
<B>size_download</B>  The total amount of bytes that were downloaded.
 
<B>size_upload</B>  The total amount of bytes that were uploaded.
 
<B>size_header</B>  The total amount of bytes of  the downloaded headers.
 
<B>size_request</B>  The total amount of bytes that were sent in the HTTP request.
 
<B>speed_download</B> The average download speed that BR measured for the complete download.
 
<B>speed_upload</B>  The average upload speed that BR measured for the complete upload.
 
<B>content_type</B>  The Content-Type of the requested  document, if there was any.
 
<noinclude>
[[Category:Needs Help]]
</noinclude>

Latest revision as of 19:17, 7 May 2013

Redirect to: