Branch: Tag:

2002-01-29

2002-01-29 21:48:11 by Martin Stjernholm <mast@lysator.liu.se>

Added two functions add_response_header and set_response_header to the
request object, which does the right thing with the rxml p-code cache if
an rxml parse is running. These two should be used instead of
Roxen.add_http_header.

Rev: server/base_server/prototypes.pike:1.47
Rev: server/protocols/http.pike:1.354

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2001, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.353 2002/01/16 15:38:01 grubba Exp $"; + constant cvs_version = "$Id: http.pike,v 1.354 2002/01/29 21:43:37 mast Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR   
1907:   static string cached_url_base;      string url_base() + // See the RequestID class for doc.   {    // Note: Code duplication in base_server/prototypes.pike.   
1949:    return cached_url_base;   }    + // The following two ought to be in RequestID, but we get resolve + // order problems with the RXML module then. +  + void add_response_header (string name, string value) + // See the RequestID class for doc. + { +  if (misc->defines && misc->defines[" _extra_heads"]) { +  Roxen.add_http_header (misc->defines[" _extra_heads"], name, value); +  if (RXML.Context ctx = RXML_CONTEXT) +  ctx->set_var (name, misc->defines[" _extra_heads"][name], "headers"); +  } +  else { +  if (!misc->moreheads) misc->moreheads = ([]); +  Roxen.add_http_header (misc->moreheads, name, value); +  } + } +  + void set_response_header (string name, string value) + // See the RequestID class for doc. + { +  if (misc->defines && misc->defines[" _extra_heads"]) { +  if (RXML.Context ctx = RXML_CONTEXT) +  ctx->set_var (name, value, "headers"); +  else +  misc->defines[" _extra_heads"][name] = value; +  } +  else { +  if (!misc->moreheads) misc->moreheads = ([]); +  misc->moreheads[name] = value; +  } + } +    /* We got some data on a socket.    * =================================================    */