Branch: Tag:

2008-08-18

2008-08-18 13:18:40 by Erik Dahl <erikd@roxen.com>

The prefix added to the RoxenUserID cookie was not usefull for cookie stickiness in load balanced environment

Rev: server/etc/modules/Roxen.pmod:1.247
Rev: server/modules/tags/session_tag.pike:1.24
Rev: server/protocols/http.pike:1.562

1:   // This is a roxen pike module. Copyright © 1999 - 2004, Roxen IS.   // - // $Id: Roxen.pmod,v 1.246 2008/08/15 12:33:54 mast Exp $ + // $Id: Roxen.pmod,v 1.247 2008/08/18 13:18:40 erikd Exp $      #include <roxen.h>   #include <config.h>
123:    +"; expires=" + http_date (3600*24*365*2 + time (1)) + "; path=/";   }    - string http_roxen_id_cookie( void|object /* Protocol */ port_obj ) + string http_roxen_id_cookie()   { -  return "RoxenUserID=" + get_roxen_ip_prefix( port_obj ) + -  roxen->create_unique_id() + "; expires=" + +  return "RoxenUserID=" + roxen->create_unique_id() + "; expires=" +    http_date (3600*24*365*2 + time (1)) + "; path=/";   }    - // Returns a prefix based on the ip address (or not implemented other - // string that identifies this site or server). - string get_roxen_ip_prefix( void|object/* Protocol */ port_obj ) { -  string ip = port_obj && port_obj->ip; -  if( ip && sizeof(ip) ) { -  if( has_value( ip, ":" ) ) { -  // IP v6 -  ip = (ip / "/")[0]; -  return reverse( ip / ":") * ":"; -  } -  return reverse( ip / ".") * "."; -  } -  return "0.0.0.0"; - } -  +    protected mapping(string:function(string, RequestID:string)) cookie_callbacks =    ([]);   protected class CookieChecker(string cookie)