<!--
 -  
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2018 OpenLink Software
 -  
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -  
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -  
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  
-->

<?xml version="1.0" encoding="ISO-8859-1"?>
<refentry id="VS-B-9">
  <refmeta>
    <refentrytitle>Basic VSP Programming</refentrytitle>
    <refmiscinfo>tutorial</refmiscinfo>
  </refmeta>
  <refnamediv>
    <refname>Header Parsing Functions</refname>
    <refpurpose>Header Parsing Functions (Cookie Example)</refpurpose>
  </refnamediv>

<refsect1 id="VS-B-9a">
<title>Preliminaries</title>
<itemizedlist mark="bullet">
  <listitem>The HTTP request header contains lines of request information.</listitem>
  <listitem>Every user-agent (browser) sends at least one request line to the Web server.</listitem>
  <listitem>The "lines" argument in VSPs is an array of the user-agent request lines.</listitem>
</itemizedlist>
</refsect1>

<refsect1 id="VS-B-9b">
<title>Methods for accessing the request parameters</title>
<itemizedlist mark="bullet">
  <listitem>A specific attribute can be accessed with the http_request_header() function.</listitem>
  <listitem>The header lines can be accessed with aref() function.</listitem>
  <listitem>Parsing the header line can be done with the split_and_decode() function.</listitem>
</itemizedlist>
</refsect1>

<refsect1 id="VS-B-9c">
<title>Cookie Demo</title>
<para>This example shows how to set a cookie in the user-agent, and displaying a cookie string when retrieved.</para> 
<itemizedlist mark="bullet">
  <listitem>Setting the cookie is done with the http_header() function. (see also:VS-B-5)</listitem>
  <listitem>Retrieving the cookie string is done with http_request_header() function.</listitem>
</itemizedlist>
</refsect1>
</refentry>