Symbian3/PDK/Source/GUID-B432A48B-46CE-4FD4-880E-DA15AA304CAA.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-B432A48B-46CE-4FD4-880E-DA15AA304CAA" xml:lang="en"><title>Adding,
       
    13 removing, and accessing header field parameters</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <section id="GUID-D96EA794-4D54-4F15-B839-EBA42687751F"> <p>Parameters can be associated with header field parts at the time
       
    15 of adding the part. There are two variants of <xref href="GUID-54F9A87B-FE2F-3429-9793-0A24B83466B9.dita#GUID-54F9A87B-FE2F-3429-9793-0A24B83466B9/GUID-A8708AE6-8EAE-37C9-BAD2-87E4A7DCE266"><apiname>RHTTPHeaders::SetFieldL()</apiname></xref>:
       
    16 the first is described previously. The second variant takes four parameters,
       
    17 of which two specify the part name/value and two specify the parameter name/value. </p> <p>To
       
    18 associate more than one parameter with the part, the function must be invoked
       
    19 repeatedly. This does not create duplicate parts; rather it locates the part
       
    20 with the specified value, and then adds additional parameters. </p> <p>To
       
    21 remove parameters from header parts, the entire part must be removed using <xref href="GUID-54F9A87B-FE2F-3429-9793-0A24B83466B9.dita#GUID-54F9A87B-FE2F-3429-9793-0A24B83466B9/GUID-656EF7AC-479E-3408-B00C-9FAE3022A37B"><apiname>RHTTPHeaders::RemoveFieldPart()</apiname></xref>,
       
    22 and then added again. </p> <p>To access parameter values, the header name
       
    23 and parameter name must be specified. <xref href="GUID-54F9A87B-FE2F-3429-9793-0A24B83466B9.dita#GUID-54F9A87B-FE2F-3429-9793-0A24B83466B9/GUID-AAEA368C-D8E6-365E-8B05-31CC812F0469"><apiname>RHTTPHeaders::GetParam()</apiname></xref> is
       
    24 used, and has an optional fourth parameter in which the part index can be
       
    25 provided. If not, the API assumes that the first header part contains the
       
    26 parameter. </p> <p>The following code from <filepath>HTTPEXAMPLECLIENT</filepath> illustrates
       
    27 the use of header parameters with the <codeph>WWW-Authenticate</codeph> header: </p> <codeblock id="GUID-DAD45847-DD81-54D3-AD90-C40A5F7ABC45" xml:space="preserve">// Display realm for WWW-Authenticate header
       
    28             RStringF wwwAuth = strP.StringF(HTTP::EWWWAuthenticate,RHTTPSession::GetTable());
       
    29             if (fieldNameStr == wwwAuth)
       
    30                 {
       
    31                 // check the auth scheme is 'basic'
       
    32                 RStringF basic = strP.StringF(HTTP::EBasic,RHTTPSession::GetTable());
       
    33                 RStringF realm = strP.StringF(HTTP::ERealm,RHTTPSession::GetTable());
       
    34                 THTTPHdrVal realmVal;
       
    35                 if ((fieldVal.StrF() == basic) &amp;&amp; 
       
    36                     (!hdr.GetParam(wwwAuth, realm, realmVal)))
       
    37                     {
       
    38                     RStringF realmValStr = strP.StringF(realmVal.StrF());
       
    39                     fieldVal16.Copy(realmValStr.DesC());
       
    40                     iUtils.Test().Printf(_L("Realm is: %S\n"), &amp;fieldVal16);
       
    41                     realmValStr.Close();
       
    42                     }
       
    43                 basic.Close();
       
    44                 realm.Close();
       
    45                 }
       
    46             wwwAuth.Close();</codeblock> </section>
       
    47 </conbody></concept>