Branch: Tag:

2001-02-24

2001-02-24 21:27:35 by Per Hedbor <ph@opera.com>

Fixed a bug with regards to accept-language parsing

Rev: server/protocols/http.pike:1.305

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2000, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.304 2001/02/24 18:55:50 grubba Exp $"; + constant cvs_version = "$Id: http.pike,v 1.305 2001/02/24 21:27:35 per Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR   
562: Inside #if defined(OLD_RXML_CONFIG)
   array mod_config;    int config_in_url;   #endif -  string contents; +  array|string contents;    misc->pref_languages=PrefLanguages();       misc->cachekey = CacheKey();    misc->_cachecallbacks = ({}); -  if( contents = request_headers[ "accept-language"] ) +  if( contents = request_headers[ "accept-language" ] )    { -  array alang=(contents-" ") / ","; -  if(misc["accept-language"]) -  misc["accept-language"] += alang; +  if( !arrayp( contents ) ) +  contents = (contents-" ")/",";    else -  misc["accept-language"] = alang; -  misc->pref_languages->languages=misc["accept-language"]; +  contents = +  Array.flatten( map( map( contents, `-, " " ), `/, "," ))-({""}); +  misc->pref_languages->languages=contents; +  misc["accept-language"] = contents;    } -  +     if( contents = request_headers[ "cookie" ] )    { -  misc->cookies = 0; -  foreach( arrayp( request_headers[ "cookie" ] )? -  request_headers[ "cookie" ] : -  ({ request_headers[ "cookie" ] }), string contents ) +  misc->cookies = ({}); +  foreach( arrayp( contents )? contents : ({ contents }), contents )    {    string c; -  misc->cookies += contents; + // misc->cookies += ({contents});    foreach(((contents/";") - ({""})), c)    {    string name, value;