pike.git/
src/
modules/
_Roxen/
roxen.c
Branch:
Tag:
Non-build tags
All tags
No tags
2001-02-20
2001-02-20 04:18:02 by Per Hedbor <ph@opera.com>
3c64ee581febc020b2cb8092fc4c65950d5e557a (
29
lines) (+
18
/-
11
)
[
Show
|
Annotate
]
Branch:
7.9
Fixed a bug in the parsing of the request
Rev: src/modules/_Roxen/roxen.c:1.17
45:
char headers[8192]; char *pnt; ptrdiff_t left;
+
int slash_n, spc;
}; /*! @decl array(string|mapping) feed(string data)
52:
static void f_hp_feed( INT32 args ) { struct pike_string *str = Pike_sp[-1].u.string;
-
int tot_slash_n=
0
, slash_n = 0, spc =
0
, cnt, num;
+
struct header_buf *hp = THP;
+
int tot_slash_n=
hp->slash_n
, slash_n = 0, spc =
hp->spc
, cnt, num;
char *pp,*ep; struct svalue *tmp; struct mapping *headers;
62:
if( Pike_sp[-1].type != PIKE_T_STRING ) Pike_error("Wrong type of argument to feed()\n");
-
if( str->len >=
THP
->left )
+
if( str->len >=
hp
->left )
Pike_error("Too many headers\n");
-
MEMCPY(
THP
->pnt, str->str, str->len );
+
MEMCPY(
hp
->pnt, str->str, str->len );
pop_n_elems( args );
-
for( ep=(
THP
->pnt+str->len),pp=MAXIMUM(
THP
->headers,
THP
->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;
-
THP
->
left
-
=
str->len
;
-
THP
->
pnt
+
=
str->len
;
-
THP->pnt[0] = 0;
+
hp
->
slash_n
=
tot_slash_n
;
+
hp
->
spc
=
spc
;
-
+
hp->left -= str->len;
+
hp->pnt += str->len;
+
hp->pnt[0] = 0;
+
if( slash_n != 2 ) { /* one newline, but less than 2 space,
87:
{ push_text( "" ); /* This includes (all eventual) \r\n etc. */
-
push_text(
THP
->headers );
+
push_text(
hp
->headers );
f_aggregate_mapping( 0 ); f_aggregate( 3 ); return;
96:
return; }
-
push_string( make_shared_binary_string( pp,
THP
->pnt - pp ) ); /*leftovers*/
+
push_string( make_shared_binary_string( pp,
hp
->pnt - pp ) ); /*leftovers*/
headers = allocate_mapping( 5 );
-
in =
THP
->headers;
-
l = pp -
THP
->headers;
+
in =
hp
->headers;
+
l = pp -
hp
->headers;
/* find first line here */ for( i = 0; i < l; i++ )
162:
{ THP->pnt = THP->headers; THP->left = 8192;
+
THP->spc = THP->slash_n = 0;
pop_n_elems(args); push_int(0); }