void *Parse_parse (int fd, int reqOnly) { http400 = generate400(); //getToken(fd, 1); modify ReqLine_t reqline; Http_t http = 0; if(reqOnly){ reqline = Parse_reqLine (fd); return reqline; } parseHeaders(fd); if (token.kind!=TOKEN_CRLF) parseError(fd); int num = parseBody(fd); reqline = gReqline; http = Http_new (HTTP_KIND_REQUEST , reqline , 0 , 0 , 0); if (DEBUG) Http_print (1, http); return http; }
Http_t Parse_parse (int fd) { http400 = generate400(); getToken(fd, 1); ReqLine_t reqline; Http_t http = 0; reqline = parseRequestLine (fd); parseHeaders(fd); if (token.kind!=TOKEN_CRLF) parseError(fd); parseBody(fd); http = Http_new (HTTP_KIND_REQUEST , reqline , 0 , 0 , 0); if (DEBUG) Http_print (1, http); return http; }