pike.git
/
src
/
modules
/
_Roxen
/
roxen.c
version
»
Context lines:
10
20
40
80
file
none
3
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.
33
2003/
03
/14
15
:
57
:
49
grubba
Exp $
+
|| $Id: roxen.c,v 1.
34
2003/
04
/14
14
:
24
:
03
mast
Exp $
*/ #define NO_PIKE_SHORTHAND #include "global.h" #include "config.h" #include "machine.h"
pike.git/src/modules/_Roxen/roxen.c:68:
THP->pnt = NULL; THP->hsize = 0; } 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; 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");
-
while(
str->len >= hp->left )
+
str_len
=
str->len
;
+
while( str_len
>= hp->left )
{ 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_error("Running out of memory in header parser\n"); } THP->left += 8192; THP->pnt = (THP->headers + THP->hsize - THP->left); }
-
MEMCPY( hp->pnt, str->str, str
->
len );
+
MEMCPY( hp->pnt, str->str, str
_
len );
pop_n_elems( args ); /* FIXME: The below does not support lines terminated with just \r. */
-
for( ep=(hp->pnt+str
->
len),pp=MAXIMUM(hp->headers,hp->pnt-3);
+
for( ep=(hp->pnt+str
_
len),pp=MAXIMUM(hp->headers,hp->pnt-3);
pp<ep && slash_n<2; pp++ ) if( *pp == ' ' ) spc++; else if( *pp == '\n' ) slash_n++, tot_slash_n++; else if( *pp != '\r' ) slash_n=0; hp->slash_n = tot_slash_n; hp->spc = spc;
-
hp->left -= str
->
len;
-
hp->pnt += str
->
len;
+
hp->left -= str
_
len;
+
hp->pnt += str
_
len;
hp->pnt[0] = 0; if( slash_n != 2 ) { /* one newline, but less than 2 space, * --> HTTP/0.9 or broken request */ if( (spc < 2) && tot_slash_n ) { push_text( "" );