Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User trendin's Avatar
    Join Date
    Dec 2003
    Posts
    25
    How can I send user customized http request headers by symbian http stack?
    e.g:
    ---------------------------------
    GET ... HTTP/1.1
    Host: ...
    User-Agent: ...
    Accept: */*
    Pragma: No-Cache
    Cache-Control: no-store, no-cache
    Connection: Close
    X-Product-Version: 6.0.2800.1006
    ---------------------------------
    See the above example, the last header(X-Product-Version) is user-customized one, how can i send it?

    I found HttpExampleClient sample code use
    "void CHttpClient::SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField, const TDesC8& aHdrValue)"
    to set http request headers. However, the "aHdrField" and "aHdrValue" both correspond to the value in a pre-defined StringPool, which only contains standard http elements. I dont know how to send the none-standard one. Can you help me?

    Thank you!

  2. #2
    Registered User say2paul's Avatar
    Join Date
    Jul 2005
    Posts
    190
    This is a very sensible question and i am surprised that no one had ever replied to this. Even i am looking for the answer of the same..!

  3. #3
    Regular Contributor jcaradec's Avatar
    Join Date
    Jan 2007
    Posts
    135
    Here is an answer

    SetCustomHeaderL(RHTTPHeaders aHeaders,
    const TDesC8& aHdrField,
    const TDesC8& aHdrValue)
    {
    RStringF valStr = iSession.StringPool().OpenFStringL(aHdrValue);
    CleanupClosePushL(valStr);
    RStringF HdrStr = iSession.StringPool().OpenFStringL(aHdrField);
    CleanupClosePushL(HdrStr);
    THTTPHdrVal val(valStr);
    aHeaders.SetFieldL(HdrStr, val);
    CleanupStack::PopAndDestroy(); // HdrStr
    CleanupStack::PopAndDestroy(); // valStr
    }

    Jean-philippe
    jean-philippe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved