What's with the ; at the end of the HTTP::Cookie insert?

So if I put in a cookie using:

http::cookie insert name “newadmin” value “3” path “/”

I see a bunch of semicolons when doing a curl:

< Set-Cookie: newadmin=3;path=/;domain=.bob.com;

The semicolons seem to be breaking some automatic scripts we have running. Any way to get rid of the last semicolon?

Guess I am only concerned with the last ‘;’. Is this the standard way a cookie is set? If I do a curl on yahoo or google or any other site I don’t see a ‘;’ at the end of the string. Only with my f5.

Hi Greg,

RFC2109 doesn’t seem to suggest there should be a trailing ; at the end of the Set-Cookie attributes list. I’d guess that LTM shouldn’t be including it. You could open a case with F5 Support to check this.

In the meantime, you could try removing the trailing semi-colon using an iRule. I imagine this would eat up some CPU and memory though as it saves the Set-Cookie header values, removes the headers and then re-inserts them.

when HTTP_RESPONSE {

    Insert some test headers with trailing semi-colons
   HTTP::header insert "Set-Cookie" "cookie1=value1; path=/1; domain=.1.example.com;"
   HTTP::header insert "Set-Cookie" "cookie2=value2; path=/2; domain=.2.example.com;"

    Save the Set-Cookie headers to a TCL list
   set cookie_headers [HTTP::header values "Set-Cookie"]

    Remove all of the Set-Cookie headers
   HTTP::header remove Set-Cookie

    Loop through the list of Set-Cookie headers
   foreach cookie_header $cookie_headers {

       Check if the last character is a semi-colon
      if {[string range $cookie_header end end] eq ";"}{

          Insert the header without the semi-colon
         HTTP::header insert Set-Cookie [string range $cookie_header 0 end-1]

      } else {

          Insert the original header
         HTTP::header insert Set-Cookie $cookie_header
      }
   }
}

curl -v 7.7.7.25

* About to connect() to 7.7.7.25 port 80

* Trying 7.7.7.25… connected

* Connected to 7.7.7.25 (7.7.7.25) port 80

> GET / HTTP/1.1

> User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

> Host: 7.7.7.25

> Accept: */*

>

< HTTP/1.1 200 OK

< Content-Length: 436

< Content-Type: text/html

< Date: Tue, 10 Aug 2010 11:21:43 GMT

< Set-Cookie: cookie1=value1; path=/1; domain=.1.example.com

< Set-Cookie: cookie2=value2; path=/2; domain=.2.example.com

Aaron