httpserver/sockets.cpp
//-----------------------------------------------------------------------------------
// This static function will read HTTP request headers and will return data block 
// size or 0 if not available.
//-----------------------------------------------------------------------------------
This static function will read HTTP request headers and will return data block
size or 0 if not available.
This static function will read HTTP request headers and will return data block size or 0 if not available .
static int read_headers(int clientConnection,int &discoverRequest) {
int data_length = 0;
char buf[1024];
   discoverRequest = 0;
   do {
	   if(read_line(clientConnection,buf,1024)==0) break;
	   if(strlen(buf)==0) break;
	   if(cmp(GetKey(buf),"USER-AGENT")) {
		   char* value = GetValue(buf);
		   if(cmp(value,"STOPDISCOVER")) 
			   discoverRequest = 2;
	   }
	   if(cmp(GetKey(buf),"CONTENT-LENGTH")) {
		   char* value = GetValue(buf);
		   data_length = atoi(value);
           DBG(printf("Request length : %d (%s)\n",data_length,value));
	   }
	   if(cmp(GetKey(buf),"CONTENT-TYPE")) {
		   char* value = GetValue(buf);
		   if(cmp(value,"APPLICATION/DISCOVER")) 
			   discoverRequest = 1;
	   }
   } while(1);
   return data_length;
}
static int read_headers ( int clientConnection , int & discoverRequest ) { int data_length = 0 ; char buf [ 1024 ] ; discoverRequest = 0 ; do { if ( read_line ( clientConnection , buf , 1024 ) == 0 ) break ; if ( strlen ( buf ) == 0 ) break ; if ( cmp ( GetKey ( buf ) , " " ) ) { char * value = GetValue ( buf ) ; if ( cmp ( value , " " ) ) discoverRequest = 2 ; } if ( cmp ( GetKey ( buf ) , " " ) ) { char * value = GetValue ( buf ) ; data_length = atoi ( value ) ; DBG ( printf ( " \n " , data_length , value ) ) ; } if ( cmp ( GetKey ( buf ) , " " ) ) { char * value = GetValue ( buf ) ; if ( cmp ( value , " " ) ) discoverRequest = 1 ; } } while ( 1 ) ; return data_length ; }
This static function will read HTTP request headers and will return data block
size or 0 if not available.
This static function will read HTTP request headers and will return data block size or 0 if not available .