dish/src/dish.cxx
//------------------------------------------------------------------------------------------
// This static function will read the line from the http reply. 
//------------------------------------------------------------------------------------------
This static function will read the line from the http reply.
This static function will read the line from the http reply .
static int read_line(int sock, char* buf, int maxLen) {
    char ch,prev=0;
    int readed = 0;
    do {
        int res = recv(sock, &ch, 1, 0);
        if(ch=='\n' && prev == '\r') break;
        if(res<1) {
            buf[readed]=0;
            return 0;
        }
        if(ch!=0) buf[readed++] = ch;
        if(readed>=maxLen) break;
        prev = ch;
    } while(1);
    buf[readed-1]=0;
    return 1;
}
static int read_line ( int sock , char * buf , int maxLen ) { char ch , prev = 0 ; int readed = 0 ; do { int res = recv ( sock , & ch , 1 , 0 ) ; if ( ch == ' \n ' && prev == ' \r ' ) break ; if ( res < 1 ) { buf [ readed ] = 0 ; return 0 ; } if ( ch != 0 ) buf [ readed ++ ] = ch ; if ( readed >= maxLen ) break ; prev = ch ; } while ( 1 ) ; buf [ readed - 1 ] = 0 ; return 1 ; }
This static function will read the line from the http reply.
This static function will read the line from the http reply .