24 |
#include <string.h> |
#include <string.h> |
25 |
#include "libspopc.h" |
#include "libspopc.h" |
26 |
|
|
27 |
int dotline(char* buf){ |
int dotline(char* buf, int total_size){ |
28 |
/* returns 1 if buf contains a "\r\n.\r\n" substring */ |
/* returns 1 if buf contains a "\r\n.\r\n" substring */ |
29 |
|
int skip; |
30 |
char* ptr; |
char* ptr; |
31 |
|
|
32 |
if(!buf){ |
if(!buf){ |
33 |
return(0); |
return(0); |
34 |
} |
} |
35 |
ptr = buf; |
skip = total_size > TCPBUFLEN ? total_size - TCPBUFLEN : 0; |
36 |
|
ptr = buf + skip; |
37 |
while((ptr = strchr(ptr,'\r'))){ |
while((ptr = strchr(ptr,'\r'))){ |
38 |
/* RFC1939 specifies that the termination line is "CRLF.CRLF" */ |
/* RFC1939 specifies that the termination line is "CRLF.CRLF" */ |
39 |
if((ptr[1] == '\n') && (ptr[2] == '.') && (ptr[3] == '\r') && (ptr[4] == '\n')){ |
if((ptr[1] == '\n') && (ptr[2] == '.') && (ptr[3] == '\r') && (ptr[4] == '\n')){ |