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

version» Context lines:

pike.git/src/modules/_Roxen/roxen.c:23:   #include "interpret.h"   #include "svalue.h"   #include "mapping.h"   #include "array.h"   #include "builtin_functions.h"   #include "module_support.h"   #include "backend.h"   #include "threads.h"   #include "operators.h"    + /* must be last include! */ + #include "module_magic.h"      /**** CLASS HeaderParser */      #define THP ((struct header_buf *)Pike_fp->current_object->storage)   struct header_buf   {    char headers[8192];    char *pnt;    ptrdiff_t left;   };
pike.git/src/modules/_Roxen/roxen.c:45:   {    struct pike_string *str = Pike_sp[-1].u.string;    int slash_n = 0, cnt, num;    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 ) -  error("Wrong type of argument to feed()\n"); +  Pike_error("Wrong type of argument to feed()\n");       if( str->len >= THP->left ) -  error("Too many headers\n"); +  Pike_error("Too many headers\n");       MEMCPY( THP->pnt, str->str, str->len );       for( ep=(THP->pnt+str->len),    pp=MAXIMUM(THP->headers,THP->pnt-3);    pp<ep && slash_n<2;    pp++ )    if( *pp == '\n' )    slash_n++;    else if( *pp != '\r' )
pike.git/src/modules/_Roxen/roxen.c:148:   /**** END CLASS HeaderParser */      static void f_make_http_headers( INT32 args )   {    int total_len = 0, e;    char *pnt;    struct mapping *m;    struct keypair *k;    struct pike_string *res;    if( Pike_sp[-1].type != PIKE_T_MAPPING ) -  error("Wrong argument type to make_http_headers(mapping heads)\n"); +  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 )    {    if( k->ind.type != PIKE_T_STRING || k->ind.u.string->size_shift ) -  error("Wrong argument type to make_http_headers(" +  Pike_error("Wrong argument type to make_http_headers("    "mapping(string(8bit):string(8bit)|array(string(8bit))) heads)\n");    if( k->val.type == PIKE_T_STRING )    total_len += k->val.u.string->len + 2 + k->ind.u.string->len + 2;    else if( k->val.type == PIKE_T_ARRAY )    {    struct array *a = k->val.u.array;    ptrdiff_t i, kl = k->ind.u.string->len + 2 ;    for( i = 0; i<a->size; i++ )    if( a->item[i].type != PIKE_T_STRING||a->item[i].u.string->size_shift ) -  error("Wrong argument type to make_http_headers(" +  Pike_error("Wrong argument type to make_http_headers("    "mapping(string(8bit):string(8bit)|"    "array(string(8bit))) heads)\n");    else    total_len += kl + a->item[i].u.string->len + 2;    } else -  error("Wrong argument type to make_http_headers(" +  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;   #define STRADD(X)\    for( l=X.u.string->len,s=X.u.string->str,c=0; c<l; c++ )\    *(pnt++)=*(s++);
pike.git/src/modules/_Roxen/roxen.c:217:    push_string( end_shared_string( res ) );   }      static void f_http_decode_string(INT32 args)   {    int proc;    char *foo,*bar,*end;    struct pike_string *newstr;       if (!args || Pike_sp[-args].type != PIKE_T_STRING) -  error("Invalid argument to http_decode_string(STRING);\n"); +  Pike_error("Invalid argument to http_decode_string(STRING);\n");       foo=bar=Pike_sp[-args].u.string->str;    end=foo+Pike_sp[-args].u.string->len;       /* count '%' characters */    for (proc=0; foo<end; ) if (*foo=='%') { proc++; foo+=3; } else foo++;       if (!proc) { pop_n_elems(args-1); return; }       /* new string len is (foo-bar)-proc*2 */