pike.git/
src/
modules/
_Roxen/
roxen.c
Branch:
Tag:
Non-build tags
All tags
No tags
2001-02-01
2001-02-01 07:49:35 by Per Hedbor <ph@opera.com>
40ca337daf65c061bb74a2fa8fcea59768ac2c09 (
39
lines) (+
24
/-
15
)
[
Show
|
Annotate
]
Branch:
7.2
Support HTTP/0.9
Rev: src/modules/_Roxen/roxen.c:1.8
46:
static void f_hp_feed( INT32 args ) { struct pike_string *str = Pike_sp[-1].u.string;
-
int slash_n = 0, cnt, num;
+
int
tot_
slash_n
=0,
slash_n
= 0,
spc = 0,
cnt, num;
char *pp,*ep; struct svalue *tmp; struct mapping *headers;
60:
Pike_error("Too many headers\n"); MEMCPY( THP->pnt, str->str, str->len );
+
pop_n_elems( args );
-
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' )
-
slash_n=0;
+
for( ep=(THP->pnt+str->len),pp=MAXIMUM(THP->headers,THP->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;
-
pop_n_elems( args );
+
if( slash_n != 2 ) {
-
/*
check
for
HTTP/0.9
?
*/
+
/*
one
newline,
but less than 2 space,
+
* -->
HTTP/0.9
or broken request
+
*/
+
if( (spc < 2) && tot_slash_n )
+
{
+
push_text( "" );
+
/* This includes (all eventual) \r\n etc. */
+
push_text( THP->headers );
+
f_aggregate_mapping( 0 );
+
f_aggregate( 3 );
+
return;
+
}
push_int( 0 ); return; }
109:
while(in[os]==' ') os++; for(j=os;j<l;j++) if( in[j] == '\n' || in[j]=='\r')
-
{
+
break;
-
}
+
push_string(make_shared_binary_string((char*)in+os,j-os)); if((tmp = low_mapping_lookup(headers, Pike_sp-2)))
139:
} } push_mapping( headers );
-
f_aggregate( 3 ); /* data, headers */
+
f_aggregate( 3 ); /* data,
firstline,
headers */
} static void f_hp_create( INT32 args )