#line 1198 "/home/ubuntu/felix/src/packages/web.fdoc" include "web/low_res_time"; class Cookie { open LowResTime; open WebUtil; struct cookie { name:string; value:string; domain:string; path:string; expires:string; secure:bool; http_only:bool; } fun _ctor_cookie (n:string,v:string) = { var c:cookie;c&.name<-n;c&.value<-v;return c;} instance Str[cookie] { fun str (c:cookie) => c.name+"="+c.value+"; "+match c.domain with |'' => ' ' | d => "Domain="+d+"; " endmatch+ match c.path with |'' => ' ' |p => "Path="+p+"; " endmatch+ match c.expires with |'' => ' ' |e => " Expires="+e+"; " endmatch+ (if c.secure then "Secure; " else " " endif)+ (if c.http_only then "HttpOnly;" else "" endif); } fun set_cookie (c:cookie):string*string => ("Set-Cookie",str(c)); fun set_cookies (c:list[cookie]):string*string => ("Set-Cookie", fold_left (fun(x:string) (y:string):string => y +"\r"+ x) "" (map (fun(z:cookie):string => str(z)) c)); }