$Web Num Hdr: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Web_Num_Hdr}}
{{DISPLAYTITLE:$Web_Num_Hdr}}
<span class="pageSubtitle"><section begin="desc" />Number of fields in request header<section end="desc" /></span>
<span class="pageSubtitle">Number of fields in request header</span>


<var>$Web_Num_Hdr</var> retrieves the number of fields in a request header.


<var>$Web_Num_Hdr</var> takes a single optional argument and returns a number.


$Web_Num_Hdr retrieves the number of fields in a request header.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %COUNT = $Web_Num_Hdr( fieldname )
<p class="syntax"><span class="term">%count</span> = <span class="literal">$Web_Num_Hdr</span>( [<span class="term">fieldname</span>] )
<section end="syntax" /></p>
</p>


 
===Syntax terms===
$Web_Num_Hdr takes a single optional argument and returns a number.
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>fieldname</th>
<tr><th>fieldname</th>
Line 16: Line 16:
</td></tr></table>
</td></tr></table>


 
==Examples==
While many header fields are handled "under the covers" by ''[[Janus Web Server]]'', there might be useful application level information in some header fields. The following code shows how an application might use the $Web_Num_Hdr function to send the contents of all header fields to the audit trail. While this could be done with JANUS TRACE settings, it might be useful to do this on an application level.
While many header fields are handled "under the covers" by <var class="product">[[Janus Web Server]]</var>, there might be useful application level information in some header fields. The following code shows how an application might use the <var>$Web_Num_Hdr</var> function to send the contents of all header fields to the audit trail. While this could be done with <var>[[JANUS TRACE]]</var> settings, it might be useful to do this on an application level.
<p class="code"> IF %BAD_REQUEST THEN
<p class="code">IF %BAD_REQUEST THEN
  %H_COUNT = $Web_Num_Hdr
%H_COUNT = $Web_Num_Hdr
  FOR %X FROM 1 TO %H_COUNT
FOR %X FROM 1 TO %H_COUNT
    AUDIT $Web_Hdr_Parm(, %X)
AUDIT $Web_Hdr_Parm(, %X)
  END FOR
END FOR
  %rc = $Web_Done(500, 'Bad header data received')
%RC = $Web_Done(500, -
  STOP
'Bad header data received')
END IF
STOP
END IF
</p>
</p>


==See also==
==See also==
<ul>
<ul>
<li><var>[[$Web_Hdr_Len]]</var>  
<li><var>[[$Web_Hdr_Len]]</var>  
<li><var>[[$Web_Hdr_Name]]</var>  
<li><var>[[$Web_Hdr_Name]]</var>  
<li><var>[[$Web_Hdr_Parm]]</var>
<li><var>[[$Web_Hdr_Parm]]</var>
</ul>
</ul>


[[Category:Janus Web Server $functions|$Web_Num_Hdr]]
[[Category:Janus Web Server $functions|$Web_Num_Hdr]]

Latest revision as of 00:59, 16 April 2013

Number of fields in request header

$Web_Num_Hdr retrieves the number of fields in a request header.

$Web_Num_Hdr takes a single optional argument and returns a number.

Syntax

%count = $Web_Num_Hdr( [fieldname] )

Syntax terms

fieldname Specifies to count only the header fields that match fieldname. If omitted, returns the count of all header fields.

Examples

While many header fields are handled "under the covers" by Janus Web Server, there might be useful application level information in some header fields. The following code shows how an application might use the $Web_Num_Hdr function to send the contents of all header fields to the audit trail. While this could be done with JANUS TRACE settings, it might be useful to do this on an application level.

IF %BAD_REQUEST THEN %H_COUNT = $Web_Num_Hdr FOR %X FROM 1 TO %H_COUNT AUDIT $Web_Hdr_Parm(, %X) END FOR %rc = $Web_Done(500, 'Bad header data received') STOP END IF

See also