Roxen.git
/
server
/
etc
/
modules
/
Roxen.pmod
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/etc/modules/Roxen.pmod:1:
// This is a roxen pike module. Copyright © 1999 - 2004, Roxen IS. //
-
// $Id: Roxen.pmod,v 1.
197
2005/
11
/
29
16
:
39
:
16
grubba Exp $
+
// $Id: Roxen.pmod,v 1.
198
2005/
12
/
05
14
:
29
:
44
grubba Exp $
#include <roxen.h> #include <config.h> #include <version.h> #include <module.h> #include <variables.h> #include <stat.h> #define roxen roxenp() #ifdef HTTP_DEBUG
Roxen.git/server/etc/modules/Roxen.pmod:123:
return "RoxenConfig="+http_encode_cookie(from) +"; expires=" + http_date (3600*24*365*2 + time (1)) + "; path=/"; } string http_roxen_id_cookie() { return "RoxenUserID=" + roxen->create_unique_id() + "; expires=" + http_date (3600*24*365*2 + time (1)) + "; path=/"; }
+
static mapping(string:function(strimg, RequestID:string)) cookie_callbacks =
+
set_weak_flag(([]), Pike.WEAK_VALUES);
+
function(strimg, RequestID:string) get_cookie_callback(string cookie)
+
{
+
function(strimg, RequestID:string) cb = cookie_callbacks[cookie];
+
if (cb) return cb;
+
cb = lambda(string path, RequestID id) {
+
return id->cookies[cookie];
+
};
+
return cookie_callbacks[cookie] = cb;
+
}
// These five functions are questionable, but rather widely used. string msectos(int t) { if(t<1000) // One sec. { return sprintf("0.%02d sec", t/10); } else if(t<6000) { // One minute return sprintf("%d.%02d sec", t/1000, (t%1000 + 5) / 10); } else if(t<3600000) { // One hour