Branch: Tag:

1998-07-04

1998-07-04 21:57:38 by Per Hedbor <ph@opera.com>

Fixes in the url handling when '.gif' is enabled. More sanity checks.

Rev: server/modules/graphics/graphic_text.pike:1.132

1: - constant cvs_version="$Id: graphic_text.pike,v 1.131 1998/07/04 03:19:51 peter Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.132 1998/07/04 21:57:38 per Exp $";   constant thread_safe=1;      #include <module.h>
975:   mapping find_file(string f, object rid)   {    int id; -  if(rid->method != "GET") return 0; -  sscanf(f,"%d/%s", id, f); + #if constant(Gz) +  object g; + #endif    -  if( query("gif") ) //Remove .gif +  if((rid->method != "GET") +  || (sscanf(f,"%d/%s", id, f) != 2)) +  return 0; +  +  if( query("gif") && f[strlen(f)-4..]==".gif") // Remove .gif    f = f[..strlen(f)-5];    -  if (sizeof(f)) { -  object g; -  if (f[0] == '$') { // Illegal in BASE64 +  if(!sizeof(f)) // No string to write. +  return 0; +  +  if (f[0] == '$') // Illegal in BASE64    f = f[1..]; -  } else if (sizeof(indices(g=Gz))) { + #if constant(Gz) +  else if (sizeof(indices(g=Gz)))    catch(f = g->inflate()->inflate(MIME.decode_base64(f))); -  } else if (sizeof(f)) { + #endif +  else    catch(f = MIME.decode_base64(f)); -  } -  } +     -  +  // Generate the image.    return http_string_answer(write_text(id,f,0,rid), "image/gif");   }   mapping url_cache = ([]);