Forum Discussion

3 Replies

  • Hi,

     

     

    I can't seem to find the correct syntax to get the cookie expiration on a request. It seems like the following should work but it doesn't. The cookie name is stick2. I know for a fact (using http watch) the expiration is set on the incoming request. I've looked through DevCentral but can't find examples for extracting cookie expiration. I can only find the syntax...

     

     

    when HTTP_REQUEST {

     

     

    if { [HTTP::cookie exists "stick2"] } {

     

    log local0. "CookieB value is: [HTTP::cookie value "stick2"] expires on: [HTTP::cookie stick2 expires]"

     

    }

     

    }

     

     

    The cookie exists and I get the cookie value OK but no expiration.

     

     

     

    Here is how I set the cookie:

     

     

    when HTTP_RESPONSE {

     

    HTTP::cookie insert name stick2 value %7cb%7c

     

    HTTP::cookie expires stick2 36000

     

    HTTP::cookie domain stick2 abc.com

     

    }

     

     

     

    What am I doing wrong?

     

     

    Thank You.
  • Hi,

     

     

    I don't believe that the client ever sends the expiration or max-age in a request. I think the server will send it in the set-cookie header in the response to the client. The server is telling the client how long the cookie is valid for. The client wouldn't need to tell the server how long it's going to continue presenting the cookie for by including the expiration time in the request.

     

     

    Are you sure you're seeing the expiration time in the request? To be certain, I'd try capturing a tcpdump.

     

     

    Out of curiosity, why are trying to log the expiration time?

     

     

    Aaron

     

  • I was seeing the cookie expiration using HTTP Watch. Here is an example where I'm seeing the expiration in the request (a line from http watch):

     

     

    name direction value path domain expires

     

     

    ipsnfSentv.3|US|1||/abc.com Sat, 22-Sep-2007 00:00:01 GMT

     

     

    As you say this may not actually be included in the request but may be shown by HTTP Watch, so I would need to check the actual header with tcpdump.

     

     

    I was working on this as part of an iRule I'm developing to replace some server based programs that are currently in use. The web developers mentioned something related to doing calculations based on cookie expiration - so I was basically just checking to see if I could pull the expiration date. I will check with them on this since it looks like I may not be on the right track...

     

     

    In any case thank you for clarifying.