Lines Matching refs:Parser
141 @param[in] State Current value of the parser state machine.
209 This function parse the authority component of the input URL and update the parser.
305 @param[in] State Current value of the parser state machine.
401 Create a URL parser for the input URL string.
432 HTTP_URL_PARSER *Parser;
438 Parser = AllocateZeroPool (sizeof (HTTP_URL_PARSER));
439 if (Parser == NULL) {
506 Parser->FieldData[Field].Length++;
513 Parser->FieldBitMap |= BIT (Field);
514 Parser->FieldData[Field].Offset = (UINT32) (Char - Url);
515 Parser->FieldData[Field].Length = 1;
522 if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_AUTHORITY)) != 0) {
523 Status = NetHttpParseAuthority (Url, FoundAt, Parser);
529 *UrlParser = Parser;
560 HTTP_URL_PARSER *Parser;
566 Parser = (HTTP_URL_PARSER*) UrlParser;
568 if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_HOST)) == 0) {
572 Name = AllocatePool (Parser->FieldData[HTTP_URI_FIELD_HOST].Length + 1);
578 Url + Parser->FieldData[HTTP_URI_FIELD_HOST].Offset,
579 Parser->FieldData[HTTP_URI_FIELD_HOST].Length,
619 HTTP_URL_PARSER *Parser;
625 Parser = (HTTP_URL_PARSER*) UrlParser;
627 if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_HOST)) == 0) {
631 Ip4String = AllocatePool (Parser->FieldData[HTTP_URI_FIELD_HOST].Length + 1);
637 Url + Parser->FieldData[HTTP_URI_FIELD_HOST].Offset,
638 Parser->FieldData[HTTP_URI_FIELD_HOST].Length,
681 HTTP_URL_PARSER *Parser;
687 Parser = (HTTP_URL_PARSER*) UrlParser;
689 if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_HOST)) == 0) {
696 Length = Parser->FieldData[HTTP_URI_FIELD_HOST].Length;
701 Ptr = Url + Parser->FieldData[HTTP_URI_FIELD_HOST].Offset;
754 HTTP_URL_PARSER *Parser;
760 Parser = (HTTP_URL_PARSER*) UrlParser;
762 if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_PORT)) == 0) {
766 PortString = AllocatePool (Parser->FieldData[HTTP_URI_FIELD_PORT].Length + 1);
772 Url + Parser->FieldData[HTTP_URI_FIELD_PORT].Offset,
773 Parser->FieldData[HTTP_URI_FIELD_PORT].Length,
782 *Port = (UINT16) AsciiStrDecimalToUintn (Url + Parser->FieldData[HTTP_URI_FIELD_PORT].Offset);
788 Release the resource of the URL parser.
790 @param[in] UrlParser Pointer to the parser.
1008 Initialize a HTTP message-body parser.
1010 This function will create and initialize a HTTP message parser according to caller provided HTTP message
1020 @param[out] MsgParser Pointer to the returned buffer to store the message parser.
1022 @retval EFI_SUCCESS Successfully initialized the parser.
1025 @retval Others Failed to initialize the parser.
1041 HTTP_BODY_PARSER *Parser;
1051 Parser = AllocateZeroPool (sizeof (HTTP_BODY_PARSER));
1052 if (Parser == NULL) {
1056 Parser->State = BodyParserBodyStart;
1062 Parser->IgnoreBody = HttpIoNoMessageBody (Method, StatusCode);
1066 Parser->IsChunked = HttpIoIsChunked (HeaderCount, Headers);
1070 Status = HttpIoParseContentLengthHeader (HeaderCount, Headers, &Parser->ContentLength);
1072 Parser->ContentLengthIsValid = TRUE;
1080 // Set state to skip body parser if the message shouldn't have a message body.
1082 if (Parser->IgnoreBody) {
1083 Parser->State = BodyParserComplete;
1085 Parser->Callback = Callback;
1086 Parser->Context = Context;
1089 *MsgParser = Parser;
1098 @param[in, out] MsgParser Pointer to the message parser.
1119 HTTP_BODY_PARSER *Parser;
1129 Parser = (HTTP_BODY_PARSER*) MsgParser;
1131 if (Parser->IgnoreBody) {
1132 Parser->State = BodyParserComplete;
1133 if (Parser->Callback != NULL) {
1134 Status = Parser->Callback (
1138 Parser->Context
1147 if (Parser->State == BodyParserBodyStart) {
1148 Parser->ParsedBodyLength = 0;
1149 if (Parser->IsChunked) {
1150 Parser->State = BodyParserChunkSizeStart;
1152 Parser->State = BodyParserBodyIdentity;
1161 switch (Parser->State) {
1169 if (Parser->Callback != NULL) {
1170 Status = Parser->Callback (
1173 MIN (BodyLength, Parser->ContentLength - Parser->ParsedBodyLength),
1174 Parser->Context
1180 Char += MIN (BodyLength, Parser->ContentLength - Parser->ParsedBodyLength);
1181 Parser->ParsedBodyLength += MIN (BodyLength, Parser->ContentLength - Parser->ParsedBodyLength);
1182 if (Parser->ParsedBodyLength == Parser->ContentLength) {
1183 Parser->State = BodyParserComplete;
1184 if (Parser->Callback != NULL) {
1185 Status = Parser->Callback (
1189 Parser->Context
1202 Parser->CurrentChunkSize = 0;
1203 Parser->State = BodyParserChunkSize;
1207 Parser->State = BodyParserChunkExtStart;
1210 Parser->State = BodyParserChunkSizeEndCR;
1213 Parser->State = BodyParserStateMax;
1218 if (Parser->CurrentChunkSize > (((~((UINTN) 0)) - 16) / 16)) {
1221 Parser->CurrentChunkSize = Parser->CurrentChunkSize * 16 + HttpIoHexCharToUintn (*Char);
1230 Parser->State = BodyParserChunkSizeEndCR;
1237 Parser->State = BodyParserStateMax;
1241 if (Parser->CurrentChunkSize == 0) {
1247 Parser->ContentLengthIsValid = TRUE;
1248 Parser->State = BodyParserLastCRLF;
1251 Parser->State = BodyParserChunkDataStart;
1252 Parser->CurrentChunkParsedSize = 0;
1262 Parser->State = BodyParserLastCRLFEnd;
1265 Parser->State = BodyParserTrailer;
1271 Parser->State = BodyParserComplete;
1273 if (Parser->Callback != NULL) {
1274 Status = Parser->Callback (
1278 Parser->Context
1286 Parser->State = BodyParserStateMax;
1292 Parser->State = BodyParserChunkSizeEndCR;
1302 LengthForCallback = MIN (Parser->CurrentChunkSize - Parser->CurrentChunkParsedSize, RemainderLengthInThis);
1303 if (Parser->Callback != NULL) {
1304 Status = Parser->Callback (
1308 Parser->Context
1315 Parser->ContentLength += LengthForCallback;
1316 Parser->CurrentChunkParsedSize += LengthForCallback;
1317 if (Parser->CurrentChunkParsedSize == Parser->CurrentChunkSize) {
1318 Parser->State = BodyParserChunkDataEnd;
1324 Parser->State = BodyParserChunkDataEndCR;
1326 Parser->State = BodyParserStateMax;
1333 Parser->State = BodyParserStateMax;
1337 Parser->State = BodyParserChunkSizeStart;
1346 if (Parser->State == BodyParserStateMax) {
1356 @param[in] MsgParser Pointer to the message parser.
1368 HTTP_BODY_PARSER *Parser;
1370 Parser = (HTTP_BODY_PARSER*) MsgParser;
1372 if (Parser->State == BodyParserComplete) {
1383 @param[in] MsgParser Pointer to the message parser.
1398 HTTP_BODY_PARSER *Parser;
1404 Parser = (HTTP_BODY_PARSER*) MsgParser;
1406 if (!Parser->ContentLengthIsValid) {
1410 *ContentLength = Parser->ContentLength;
1415 Release the resource of the message parser.
1417 @param[in] MsgParser Pointer to the message parser.