Forum Discussion

Stephan_Manthe1's avatar
Stephan_Manthe1
Icon for Nimbostratus rankNimbostratus
Jun 07, 2006

inserting multiple variables into a single http header

hi,

 

we needed to add a single http-header including multiple variables (and some blanks!) like this:

 

 

SSLClientCipher: RC4-MD5, version=TLSv1/SSLv3, bits=128

 

 

it can be done in multiple ways:

 

 

when HTTP_REQUEST {

 

set sslinfo [SSL::cipher name]

 

set sslvers [SSL::cipher version]

 

set sslbits [SSL::cipher bits]

 

append sslinfo ", version=" $sslvers

 

append sslinfo ", bits=" $sslbits

 

HTTP::header insert SSLClientCipher $sslinfo

 

}

 

 

the following alternative might save some cpu-cycles:

 

 

when HTTP_REQUEST {

 

HTTP::header insert SSLClientCipher [SSL::cipher name],\x20version=[SSL::cipher version],\x20bits=[SSL::cipher bits]

 

}

 

 

the \x20 is used to create the required blanks between the different values.

 

ciao

 

stephan

4 Replies

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Doesn't simply quoting it work?

    EG:
    HTTP::header insert SSLClientCipher "[SSL::cipher name], version=[SSL::cipher version], bits=[SSL::cipher bits]"

  • this was our first try. but it results in an additional header:

     

     

    SSLClientCipher: DES-CBC3-SHA,

     

    version=TLSv1,: bits=192
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    I'm wondering if you need to add the "lws" argument to the command to get it to treat the spaces appropriately.
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    I've been able to insert header values containing both spaces and double quotes by enclosing the value portion in curly braces:
    HTTP::header insert Header1 {CP="IDC DSP OTR IND OTC"}
    inserts the following header: Header1: CP="IDC DSP OTR IND OTC"

    HTH

    /deb