Roxen.git / server / plugins / protocols / http.pike

version» Context lines:

Roxen.git/server/plugins/protocols/http.pike:1:   // This is a ChiliMoon protocol module.   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2001, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.385 2002/10/23 20:58:21 nilsson Exp $"; + constant cvs_version = "$Id: http.pike,v 1.386 2002/10/24 00:16:39 nilsson Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR      // HTTP protocol module.   #include <config.h>   #define TIMER_PREFIX "http:"   #include <timers.h>      inherit RequestID;   
Roxen.git/server/plugins/protocols/http.pike:1556:    }    }       if( Stat fstat = file->stat )    {    if( !file->len )    file->len = fstat[1];       if ( fstat[ST_MTIME] > misc->last_modified )    misc->last_modified = fstat[ST_MTIME]; +  }    -  if( misc->cacheable < INITIAL_CACHEABLE ) +  if( misc->cacheable < INITIAL_CACHEABLE ) {    heads["Expires"] = Roxen.http_date( predef::time(1)+misc->cacheable );    -  +  if (!misc->cacheable && !misc->last_modified) { +  // Data with immediate expiry is assumed to have been generated +  // at the same instant. +  misc->last_modified = predef::time(1); +  } +  } +  +  if (misc->last_modified)    heads["Last-Modified"] = Roxen.http_date(misc->last_modified);    -  + // werror("lm: %O\n" + // "cacheable: %O\n", + // misc->last_modified, + // misc->cacheable); +     if(since)    {    /* ({ time, len }) */    array(int) since_info = Roxen.parse_since( since ); - // werror("since: %{%O, %}\n" - // "lm: %O\n" - // "cacheable: %O\n", - // since_info, - // misc->last_modified, - // misc->cacheable); + // werror("since: %{%O, %}\n" + // "lm: %O\n" + // "cacheable: %O\n", + // since_info, + // misc->last_modified, + // misc->cacheable);    if ( ((since_info[0] >= misc->last_modified) &&    ((since_info[1] == -1) || (since_info[1] == file->len)))    // never say 'not modified' if not cacheable at all.    && (misc->cacheable != 0)    // actually ok, or... - // || ((misc->cacheable>0) - // && (since_info[0] + misc->cacheable<= predef::time(1)) - // // cacheable, and not enough time has passed. + // || ((misc->cacheable>0) + // && (since_info[0] + misc->cacheable<= predef::time(1)) + // // cacheable, and not enough time has passed.    )    {    file->error = 304;    file->file = 0;    file->data="";    }    } -  } +        if(prot != "HTTP/0.9")    {    string h, charset="";       if( stringp(file->data) )    {    if (file["type"][0..4] == "text/")    {    [charset,file->data] = output_encode( file->data, 1 );
Roxen.git/server/plugins/protocols/http.pike:2155:    c->client_var = client_var;       c->remoteaddr = remoteaddr;    c->host = host;       c->client = client;    c->referer = referer;    c->pragma = pragma;       c->cookies = cookies; +  c->request_headers = request_headers;    c->my_fd = 0;    c->prot = prot;    c->clientprot = clientprot;    c->method = method;      // realfile virtfile // Should not be copied.    c->rest_query = rest_query;    c->raw = raw;    c->query = query;    c->not_query = not_query;