Branch: Tag:

2004-06-08

2004-06-08 12:50:07 by Fredrik Noring <noring@nocrew.org>

Implemented &request-header.*; scope.

Rev: server/etc/modules/Roxen.pmod:1.179

1:   // This is a roxen pike module. Copyright © 1999 - 2001, Roxen IS.   // - // $Id: Roxen.pmod,v 1.178 2004/05/17 17:46:10 mast Exp $ + // $Id: Roxen.pmod,v 1.179 2004/06/08 12:50:07 noring Exp $      #include <roxen.h>   #include <config.h>
3068:      // RXML complementary stuff shared between configurations.    + class ScopeRequestHeader { +  inherit RXML.Scope; +  +  mixed `[] (string var, void|RXML.Context c, void|string scope, void|RXML.Type type) { +  string|array(string) val = (c || RXML_CONTEXT)->id->request_headers[var]; +  if(!val) +  return RXML.nil; +  if(type) +  { +  if(arrayp(val) && type->subtype_of (RXML.t_any_text)) +  val *= "\0"; +  return type->encode(val); +  } +  return val; +  } +  +  array(string) _indices(void|RXML.Context c) { +  return indices((c || RXML_CONTEXT)->id->request_headers); +  } +  +  array(string) _values(void|RXML.Context c) { +  return values((c || RXML_CONTEXT)->id->request_headers); +  } +  +  string _sprintf() { return "RXML.Scope(request-header)"; } + } +    class ScopeRoxen {    inherit RXML.Scope;   
3340:    string _sprintf() { return "RXML.Scope(Cookie)"; }   }    + RXML.Scope scope_request_header=ScopeRequestHeader();   RXML.Scope scope_roxen=ScopeRoxen();   RXML.Scope scope_page=ScopePage();   RXML.Scope scope_cookie=ScopeCookie();
3511:    inherit RXML.TagSet;       void entities_prepare_context (RXML.Context c) { +  c->add_scope("request-header", scope_request_header);    c->misc->scope_roxen=([]);    c->add_scope("roxen",scope_roxen);    c->misc->scope_page=([]);