Branch: Tag:

2004-04-13

2004-04-13 18:34:02 by Martin Stjernholm <mast@lysator.liu.se>

Fixes in ETag calculation.

Rev: server/base_server/prototypes.pike:1.81

6:   #include <module.h>   #include <variables.h>   #include <module_constants.h> - constant cvs_version="$Id: prototypes.pike,v 1.80 2004/04/13 16:51:02 mast Exp $"; + constant cvs_version="$Id: prototypes.pike,v 1.81 2004/04/13 18:34:02 mast Exp $";      #ifdef DAV_DEBUG   #define DAV_WERROR(X...) werror(X)
975:    return f;    }    -  // The returned response header mapping is incomplete wrt the -  // Content-Range header for range requests. +     mapping(string:string) make_response_headers (mapping(string:mixed) file) -  +  //! Make the response headers from a response mapping for this +  //! request. The headers associated with transfer modifications of +  //! the response, e.g. 206 Partial Content and 304 Not Modified, are +  //! not calculated here. +  //! +  //! @note +  //! Is destructive on @[file] and on various data in the request; +  //! should only be called once for a @[RequestID] instance.    {    mapping(string:string) heads = ([]);   
1033:    if(file->expires)    heads->Expires = Roxen->http_date(file->expires);    -  if(mappingp(file->extra_heads)) -  heads |= file->extra_heads; -  -  if(mappingp(misc->moreheads)) -  heads |= misc->moreheads; -  +     //if( file->len > 0 || (file->error != 200) )    heads["Content-Length"] = (string)file->len;      #ifdef RAM_CACHE -  if (!(misc->etag = heads->ETag) && file->len && +  if (!(heads->ETag = misc->etag) && file->len &&    (file->data || file->file) && -  +  file->error == 200 && (<"HEAD", "GET">)[method] &&    (file->len < conf->datacache->max_file_size)) {    string data = "";    if (file->file) {
1052: Inside #if defined(RAM_CACHE)
   if (file->data && (sizeof(data) < file->len)) {    data += file->data[..file->len - (sizeof(data)+1)];    } -  m_delete(file, file); +  m_delete(file, "file");    } else if (file->data) {    data = file->data[..file->len - 1];    }
1063:    }   #endif /* RAM_CACHE */    +  if(mappingp(file->extra_heads)) +  heads |= file->extra_heads; +  +  if(mappingp(misc->moreheads)) +  heads |= misc->moreheads; +     return heads;    }