×

Discussion Board

Results 1 to 3 of 3

Hybrid View

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    25

    How to send customized(none-standard) HTTP request headers?

    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
    Join Date
    Jul 2005
    Posts
    190

    Exclamation Re: How to send customized(none-standard) HTTP request headers?

    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
    Join Date
    Jan 2007
    Posts
    135

    Re: How to send customized(none-standard) HTTP request headers?

    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
  •  
×