This commit is contained in:
bolvan 2017-02-20 11:50:31 +03:00
parent 529cf07c03
commit 2e3855c1d4
7 changed files with 14 additions and 16 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -77,3 +77,8 @@ added --hostspell option to nfqws and tpws
ISP support : beeline now catches "host" but other spellings still work ISP support : beeline now catches "host" but other spellings still work
openwrt/LEDE : changed init script to work with procd openwrt/LEDE : changed init script to work with procd
tpws, nfqws : minor cosmetic fixes tpws, nfqws : minor cosmetic fixes
v16
tpws: split-http-req=method : split inside method name, not after
ISP support : mns.ru changed split pos to 3 (got redirect page with HEAD req : curl -I ej.ru)

View File

@ -1,4 +1,4 @@
zapret v.15 zapret v.16
Для чего это надо Для чего это надо
----------------- -----------------

View File

@ -109,8 +109,8 @@ bool handle_epollin(tproxy_conn_t *conn,int *data_transferred){
if (bOutgoing) if (bOutgoing)
{ {
char buf[RD_BLOCK_SIZE+2],*p,*phost=NULL; char buf[RD_BLOCK_SIZE+2],*p,*phost=NULL;
ssize_t l,split_pos=0,method_split_pos=0,host_split_pos=0,pos; ssize_t l,split_pos=0,method_split_pos=0,host_split_pos=0,split_array_pos_offset=1,pos;
const char **split_array,**split_item,**item; const char **split_array=NULL, **split_item, **item;
rd = recv(fd_in,buf,RD_BLOCK_SIZE,MSG_DONTWAIT); rd = recv(fd_in,buf,RD_BLOCK_SIZE,MSG_DONTWAIT);
if (rd>0) if (rd>0)
@ -130,7 +130,7 @@ bool handle_epollin(tproxy_conn_t *conn,int *data_transferred){
memmove(p+1,p,bs-pos); memmove(p+1,p,bs-pos);
*p = ' '; // insert extra space *p = ' '; // insert extra space
bs++; // block will grow by 1 byte bs++; // block will grow by 1 byte
method_split_pos = pos; // remember split position and use it if required method_split_pos = pos-2; // remember split position and use it if required
break; break;
} }
} }
@ -154,7 +154,6 @@ bool handle_epollin(tproxy_conn_t *conn,int *data_transferred){
} }
if (params.split_pos) if (params.split_pos)
{ {
split_array = NULL;
split_pos = params.split_pos<bs ? params.split_pos : 0; split_pos = params.split_pos<bs ? params.split_pos : 0;
} }
else else
@ -164,25 +163,19 @@ bool handle_epollin(tproxy_conn_t *conn,int *data_transferred){
case split_method: case split_method:
// do we have already split position ? if so use it without another search // do we have already split position ? if so use it without another search
if (method_split_pos) if (method_split_pos)
{
split_array = NULL;
split_pos = method_split_pos; split_pos = method_split_pos;
}
else else
{
split_array = http_split_methods; split_array = http_split_methods;
split_array_pos_offset = 3;
}
break; break;
case split_host: case split_host:
if (host_split_pos) if (host_split_pos)
{
split_array = NULL;
split_pos = host_split_pos; split_pos = host_split_pos;
}
else else
split_array = http_split_host; split_array = http_split_host;
break; break;
default:
split_array = NULL;
split_pos=0;
} }
} }
if (split_array) if (split_array)
@ -194,8 +187,8 @@ bool handle_epollin(tproxy_conn_t *conn,int *data_transferred){
if (p=find_bin(buf,bs,*split_item,l)) if (p=find_bin(buf,bs,*split_item,l))
{ {
split_pos = p-buf; split_pos = p-buf;
printf("Found split item '%s' at pos %zd\n",*split_item,split_pos); printf("Found split item '%s' at pos %zd. Split offset is -%zd.\n",*split_item,split_pos,split_array_pos_offset);
split_pos += l-1; split_pos += l-split_array_pos_offset;
break; break;
} }
} }