/[libspopc]/parsing.c
ViewVC logotype

Diff of /parsing.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 23 by ben, Sun Apr 18 11:05:58 2010 UTC revision 24 by ben, Sun Apr 8 22:56:53 2012 UTC
# Line 24  Line 24 
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')){

Legend:
Removed from v.23  
changed lines
  Added in v.24

  ViewVC Help
Powered by ViewVC 1.1.26