Branch: Tag:

2000-11-22

2000-11-22 07:11:26 by Per Hedbor <ph@opera.com>

Fix [Bug 571 (#571)] by including content-length on zero-length requests that are not code 200. Including it on code 200 replies crashes netscape.

Rev: server/protocols/http.pike:1.288

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2000, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.287 2000/11/16 11:51:48 per Exp $"; + constant cvs_version = "$Id: http.pike,v 1.288 2000/11/22 07:11:26 per Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR   
1635:    array fstat;    if(arrayp(fstat = file->stat))    { -  if(file->file && !file->len) +  if( !file->len )    file->len = fstat[1];       if (fstat[ST_MTIME] > misc->last_modified) {
1750:    }    }    if(file->rettext || !errors[file->error]) -  head_string = sprintf("%s %d %s\r\n", prot, file->error, file->rettext || -  (errors[file->error] ? errors[file->error][4..] : "")); +  head_string = sprintf("%s %d %s\r\n", +  prot, file->error, file->rettext || +  (errors[file->error]? +  errors[file->error][4..] : ""));    else    head_string = sprintf("%s %s\r\n", prot, errors[file->error]); -  if( file->len > 0 ) +  if( file->len > 0 || (file->error != 200) )    heads["Content-Length"] = (string)file->len;       // Some browsers, e.g. Netscape 4.7, doesn't trust a zero