pike.git / src / modules / _Roxen / roxen.c

version» Context lines:

pike.git/src/modules/_Roxen/roxen.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: roxen.c,v 1.41 2005/01/20 10:46:34 nilsson Exp $ + || $Id: roxen.c,v 1.42 2005/04/08 17:23:46 grubba Exp $   */      #define NO_PIKE_SHORTHAND      #include "global.h"   #include "config.h"         #include "machine.h"   
pike.git/src/modules/_Roxen/roxen.c:40:      /*! @module _Roxen    */      /*! @class HeaderParser    */      #define THP ((struct header_buf *)Pike_fp->current_storage)   struct header_buf   { -  char *headers; -  char *pnt; +  unsigned char *headers; +  unsigned char *pnt;    ptrdiff_t hsize, left;    int slash_n, spc;   };      static void f_hp_init( struct object *o )   {    THP->headers = NULL;    THP->pnt = NULL;    THP->hsize = 0;    THP->left = 0;
pike.git/src/modules/_Roxen/roxen.c:72:   }      static void f_hp_feed( INT32 args )   /*! @decl array(string|mapping) feed(string data)    */   {    struct pike_string *str = Pike_sp[-1].u.string;    struct header_buf *hp = THP;    int str_len;    int tot_slash_n=hp->slash_n, slash_n = 0, spc = hp->spc; -  char *pp,*ep; +  unsigned char *pp,*ep;    struct svalue *tmp;    struct mapping *headers;    ptrdiff_t os=0, i, j, l;    unsigned char *in;       if( Pike_sp[-1].type != PIKE_T_STRING )    Pike_error("Wrong type of argument to feed()\n");    if( str->size_shift )    Pike_error("Wide string headers not supported\n");    str_len = str->len;    while( str_len >= hp->left )    { -  char *buf; +  unsigned char *buf;    if( THP->hsize > 512 * 1024 )    Pike_error("Too many headers\n");    THP->hsize += 8192;    buf = THP->headers;    THP->headers = realloc( THP->headers, THP->hsize );    if( !THP->headers )    {    free(buf);    THP->hsize = 0;    THP->left = 0;
pike.git/src/modules/_Roxen/roxen.c:244:      /*! @endclass    */      static void f_make_http_headers( INT32 args )   /*! @decl string @    *! make_http_headers(mapping(string:string|array(string)) headers)    */   {    int total_len = 0, e; -  char *pnt; +  unsigned char *pnt;    struct mapping *m;    struct keypair *k;    struct pike_string *res;    if( Pike_sp[-1].type != PIKE_T_MAPPING )    Pike_error("Wrong argument type to make_http_headers(mapping heads)\n");       m = Pike_sp[-1].u.mapping;    /* loop to check len */    NEW_MAPPING_LOOP( m->data )    {
pike.git/src/modules/_Roxen/roxen.c:279:    else    total_len += kl + a->item[i].u.string->len + 2;    } else    Pike_error("Wrong argument type to make_http_headers("    "mapping(string(8bit):string(8bit)|"    "array(string(8bit))) heads)\n");    }    total_len += 2;       res = begin_shared_string( total_len ); -  pnt = (char *)res->str; +  pnt = STR0(res);   #define STRADD(X)\    for( l=X.u.string->len,s=X.u.string->str,c=0; c<l; c++ )\    *(pnt++)=*(s++);       NEW_MAPPING_LOOP( m->data )    { -  char *s; +  unsigned char *s;    ptrdiff_t l, c;    if( k->val.type == PIKE_T_STRING )    {    STRADD( k->ind ); *(pnt++) = ':'; *(pnt++) = ' ';    STRADD( k->val ); *(pnt++) = '\r'; *(pnt++) = '\n';    }    else    {    struct array *a = k->val.u.array;    ptrdiff_t i, kl = k->ind.u.string->len + 2;