S/Web Objects

Home S/Web Description S/Web Overview S/Web Installation S/Web Features S/Web Functions S/Web Objects S/Web Settings S/Web Troubleshoot S/Web FAQ S/Web Appendices

Cache Client Document LH Repository Request Response Server Session

Links on this page:
 

Properties

Methods

Request

This object handles information relating to the HTTP request. This is perhaps the most important object existing in S/Web. This handles all information related to the actual request.

Properties:

Property Get/Set Description
ACCEPTGetThe Accept request-header field can be used to specify certain media types which are acceptable for the response. Accept headers can be used to indicate that the request is specifically limited to a small set of desired types, as in the case of a request for an in-line image.
AUTHTYPEGetThe type of authentication expected. Will normally be null or "BASIC". If Basic S/Web will invoke Basic Authentication rather than standard S/Web security.
BROWSERGet/SetThis property identifies the browser and version reported by the browser. Note: This might not be the actual browser. See WWW_REQUEST_EQUATES for browser types.
CONTENTEXTGetThis property returns the file extension of request content files. This is normally ".ipc".
CONTENTLENGTHGetThe Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
CONTENTTYPEGetThe Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent had the request been a GET.
COOKIESGetThis property returns the entire cookie string as passed back from the browser to the client.  If EncryptCookies is set, the cookies are decrypted before returning the value.
ENCRYPTCOOKIESGet/SetThis property tells S/Web whether to encrypt cookies before passing them back to the browser.
FROMGetThe From request-header field, if given, SHOULD contain an Internet e-mail address for the human user who controls the requesting user agent.
GATEWAYGetNot used - always returns blank as this is an ISAPI implementation not a CGI implementation.
HEADERGetThis property returns the entire HTTP header.
HEADEREXTGetThis subroutine returns the file extension of request header files (which is normally ".iph".
HIDEUICONTENTGet/SetIf TRUE$ then no CONTENT details are displayed in the UI. (Useful for security purposes)
HTTPSGetThis value returns TRUE$ if the request is sent by HTTPS
PATHINFOGetContains the name of the routine the client is executing.
PATHTRANSLATEDGetContains where the requested directory really exists on the server, as opposed to the share name.
PROCNAMEGet/SetThis property holds the name of the S/Web procedure to execute.
QUERYARGS
QUERYKEYS
GetA dynamic array of Query Keys extracted from the request content
QUERYCHECKGet/SetIf TRUE$ then normal query key/value checking and parsing will take place. If FALSE$ then no checking takes place which also means that the GETQUERYARG and GETQUERYVAL methods will
NOT return a value! To extract values you MUST use the GETCONTENT method and process the raw content yourself!
This is useful if sending XML strings.
REFERERGetThe Referer[sic] request-header field allows the client to specify, for the server's benefit, the address (URI) of the resource from which the Request-URI was obtained (the "referrer", although the header field is misspelled.) The Referer request-header allows a server to generate lists of back-links to resources for interest, logging, optimized caching, etc. It also allows obsolete or mistyped links to be traced for maintenance. The Referer field MUST NOT be sent if the Request-URI was obtained from a source that does not have its own URI, such as input from the user keyboard.
REMOTEADDRGetThe IP address of the agent sending the request to the server. This is not necessarily that of the client.
REMOTEHOSTGetThe fully qualified domain name of the agent sending the request to the server, if available, otherwise NULL. Not necessarily that of the client
REMOTEIDENTGetIf the HTTP server supports RFC 931 identification, then this variable will be set to the remote user name retrieved from the server. Usage of this variable should be limited to logging only
REMOTEUSERGetIf the server supports user authentication, and the script is protected, this is the username they have authenticated as
REMOTEPWGetIf the server supports user authentication, and the script is protected, this is the username they have authenticated as
REQUESTDIRGetthe location that S/Web drops request files into.
REQUESTMETHODGetThe method with which the request was made. For HTTP, this is "GET", "HEAD", "POST", etc
SCRIPTNAMEGetA virtual path to the script being executed, used for self-referencing URLs.
SERVEREXTENSIONGetDefines the type of SWEB (ISAPI, Perl, etc.) you are using
SERVERNAMEGetThe name of the current server, or its IP address
SERVERPORTGetThis is the port number the request was received from. This is normally 80 for HTTP and 443 for SSL (HTTPS)
SERVERPROTOCOLGetThe version of HTTP used for the request. This is normally 1.0 or 1.1.
SERVERSOFTWAREGetIdentifies the server software. This function is not supported by all web servers and may be blank on your system.
SERVERURLGetThe path of the procedure executing, usually /scripts/sweb.dll
USERAGENTGetThe User-Agent request-header field contains information about the user agent originating the request. This is for statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations. User agents SHOULD include this field with requests. The field can contain multiple product tokens (section 3.8) and comments identifying the agent and any sub-products which form a significant part of the user agent. By convention, the product tokens are listed in order of their significance for identifying the application.
XVERSIONGetthe version of S/Web

Methods:

call www_Exec_Method( "REQUEST", method, param1, param2, param3, param4, param5, errorText)

MethodDescription
This method saves the request header, it's content and any associated client data to the WWW_REQUEST and WWW_CONTENT tables
This function creates a new request object from the header file name passed in object.
This function destroys the existing request object.
This method retrieves properties of the request object
This method returns the raw HTTP request query string as sent from the client.
This subroutine attempts to extract a named cookie from the HTTP Request object.
This method looks in the query string to see if a given instance of an ARGUMENT is present, regardless of whether or not it has been assigned a value.
This method returns a query value to the caller based on the key of the data passed.
This method sets properties of the response object
This method allows for the wholesale replacement of the current request's content.

[top]

ARCHIVE

This method saves the request header, it's content and any associated client data to the WWW_REQUEST and WWW_CONTENT tables. (NB this method only works if the SESSION objects TRACKREQUESTS property is set )

ArgumentDescription
param1  Not used. 
param2  Not used. 
param3  Not used. 
param4  Not used. 
param5  Not used. 

Example:

declare function www_Exec_Method, www_Get_Status, www_Set_Status
$insert www_Status_Equates
$insert logical
......

Properties  =   "NAME"
Properties  :=  @RM : "DATA"
if www_Exec_Method( "REQUEST", "GET", Properties, RetVals, "", "", "", "", errorText ) then
   UserName  =  Field( RetVals, @RM, 1 )
   UserData  =  Field( RetVals, @RM, 2 )
end else
   abort = TRUE$
end
If Abort Else
   * Archive all guest users who are searching the tech support archives
   * We can use this to see why people come to visit and what makes them want to register to the site.
   If ( UserName = "GUEST" ) And ( UserData = "TECHSUPT" ) Then
      if www_Exec_Method( "REQUEST", "ARCHIVE", "", "", "", "", "", "", errorText ) then
         null
      end else
         abort = TRUE$
      end
   End
End

[top]

CREATE

This function creates a new request object from the header file name passed in object.
This function is never called by the end user and is just documented for completion

ArgumentDescription
param1  Not used. 
param2  Not used. 
param3  Not used. 
param4  Not used. 
param5  Not used. 

[top]

DESTROY

This function destroys the existing request object.
Use of this function is optional, as the system will perform the necessary actions before creating a new object.

ArgumentDescription
param1  Not used. 
param2  Not used. 
param3  Not used. 
param4  Not used. 
param5  Not used. 

Example

declare function www_Exec_Method, www_Get_Status, www_Set_Status
$insert www_Status_Equates
$insert logical
if www_Exec_Method( "RESPONSE", "SEND", "", "", "", "", "", "", errorText ) then
   * The request is now back on it's way to the client.
   * We can continue processing information, if we wish, however,
   * there is no direct way to return it to the client.
   * Continue processing...
end else
   abort = TRUE$
end
...........
...........
* After sending back the request, we might want to destroy the current request...
if www_Exec_Method( "REQUEST", "DESTROY", "", "", "", "", "", "", errorText ) then
    null
end else
    abort = TRUE$
end

[top]

GET

This method retrieves properties of the request object

ArgumentDescription
param1  Property to retrieve. Can be @Rm delimited to retrieve multiple properties.  
param2  Returned properties.
param3  Not used. 
param4  Not used. 
param5  Not used. 

Example: 

declare function www_Exec_Method, www_Get_Status, www_Set_Status
$insert www_Status_Equates
$insert logical

Properties   =   "BROWSER"
Values       =   ""

if www_Exec_Method( "REQUEST", "GET", Properties, Values, "", "", "", errorText ) then
   * continue on
end else
   abort = TRUE$
end

[top]

GETCONTENT

This method returns the raw HTTP request query string as sent from the client

ArgumentDescription
param1  Buffer number to retrieve (defaults to 1)
param2  Returned data
param3  Number of next buffer - zero if no more
param4  Not used. 
param5  Not used. 

Example:

declare function www_Exec_Method, www_Get_Status, www_Set_Status
$insert www_Status_Equates
$insert logical

if www_Exec_Method( "REQUEST", "GETCONTENT", 1, QueryString, NextBuffer, "", "", errorText ) then
   * continue
end else
   abort = TRUE$
end

[top]

GETCOOKIE

This subroutine attempts to extract a named cookie from the HTTP Request object.

ArgumentDescription
param1  Name of the cookie to retrieve
param2  Cookie information returned
param3  Not used. 
param4  Not used. 
param5  Not used. 

Example:

declare function www_Exec_Method, www_Get_Status, www_Set_Status
$insert www_Status_Equates
$insert logical

CookieName   =   "LASTVISIT"
Value        =   ""

if www_Exec_Method( "REQUEST", "GETCOOKIE", CookieName, Value, "", "", "", errorText ) then
   * continue
end else
   abort = TRUE$
end

[top]

GETQUERYARG
GETQUERYKEY

This method looks in the query string to see if a given instance of an ARGUMENT is present, regardless of whether or not it has been assigned a value.

Note that this method is used to see if an argument exists and the fact that it returns the first frame is a bonus. Use GETQUERYVALUE to retrieve the data.

ArgumentDescription
param1  Name of the argument to retrieve
param2  Instance number of the query to retrieve (used if there are more than one argument with the same name) - defaults to 1.
param3  Value exists flag - Boolean
param4  The first frame of the argument
param5  Boolean flag indicating there is more than on frame of data in the argument.

Example:

declare function www_Exec_Method, www_Get_Status, www_Set_Status
$insert www_Status_Equates
$insert logical

ArgumentName   =   "ADVISOR_NAME"
Instance       =   1
ValueThere     =   1

if www_Exec_Method( "REQUEST", "GETQUERYARG", ArgumentName, INstance, ValueThere, "", "", errorText ) then
   * If ValueThere is true then we know we're in the HTML page dealing with advisors so react accordingly
   * so we know the user is submitting information not requesting a page
end else
   abort = TRUE$
end

[top]

GETQUERYVAL
QUERYPARAM

This method returns a query value to the caller based on the key of the data passed.

ArgumentDescription
param1  Name of the argument to retrieve. 
param2  Instance number of the argument to retrieve (defaults to 1)
param3  Chunk to get (defaults to 1 - used if data is > 64K)
param4  Query value or param3th 64K chunk
param5  Next query value buffer number (0 if no more)

Example:

declare function www_Exec_Method, www_Get_Status, www_Set_Status
$insert www_Status_Equates
$insert logical

ArgumentName   =   "ADVISOR_NAME"
Instance       =   1
Chunk          =   1
Value          =   1
NextChunk      =   1

if www_Exec_Method( "REQUEST", "GETQUERYVAL", ArgumentName, Instance, Chunk, Value, NextChunk, errorText ) then
   * Process data
end else
   abort = TRUE$
end

[top]

SET

This method sets properties of the request object

ArgumentDescription
param1  Properties to set delimited by @Rm. 
param2  Values to use delimited by @Rm
param3  Returns previous values delimited by @Rm.
param4  Not used. 
param5  Not used. 

Example:

declare function www_Exec_Method, www_Get_Status, www_Set_Status
$insert www_Status_Equates
$insert logical

If UserName = "ADMIN" Then
   * Normal users get a query only window here - admin gets TCL so call different program
   Properties   =   "PROCNAME"
   Procedure    =   "SWEB_TCL"
   if www_Exec_Method( "REQUEST", "SET", Properties, Procedure, "", "", "", errorText ) then
      * continue on
   end else
      abort = TRUE$
   end
End

[top]

SETCONTENT

This method allows for the wholesale replacement of the current request's content.

Where this could be useful is if the developer wanted to redirect a client to another S/Web routine requiring different parameters in the query.

ArgumentDescription
param1  Any valid query string that will subsequently become the new request content.  Remember that if the request contains non alpha numeric characters it must be ESCAPEd using WWW_Utility first.
param2  Not used. 
param3  Not used. 
param4  Not used. 
param5  Not used. 

Example:

declare function www_Exec_Method, www_Get_Status, www_Set_Status
$insert www_Status_Equates
$insert logical

If UserName = "ADMIN" Then
   * Redirect the user to another routine
   Properties   =   "PROCNAME"
   Procedure    =   "SWEB_TCL"
   if www_Exec_Method( "REQUEST", "SET", Properties, Procedure, "", "", "", errorText ) then
      * continue on and write out a new request
      NewRequest = "USERNAME=ADMIN&SECLEVEL=1&SERVER=SERVERID"
      NewRequest = WWW_Utility("ESCAPE", NewRequest)
      if www_Exec_Method( "REQUEST", "SETCONTENT", NewRequest, Procedure, "", "", "", errorText ) then
         * continue on
      End  
   end else
      abort = TRUE$
   end
End

[top]

Copyright © 2005 The Sprezzatura Group. All rights reserved.