| 492 | |
| 493 | |
| 494 | static inline char* _parse_to(char* buffer, char *end, struct to_body *to_b, |
| 495 | int multi) |
| 496 | { |
| 497 | int status; |
| 498 | int saved_status; |
| 499 | char *tmp; |
| 500 | char *end_mark; |
| 501 | struct to_body *first_b = to_b; |
| 502 | |
| 503 | status=START_TO; |
| 504 | saved_status=START_TO; |
| 505 | memset(to_b, 0, sizeof(struct to_body)); |
| 506 | to_b->error=PARSE_OK; |
| 507 | end_mark=0; |
| 508 | |
| 509 | for( tmp=buffer; tmp<end; tmp++) |
| 510 | { |
| 511 | switch(*tmp) |
| 512 | { |
| 513 | case ' ': |
| 514 | case '\t': |
| 515 | switch (status) |
| 516 | { |
| 517 | case F_CRLF: |
| 518 | case F_LF: |
| 519 | case F_CR: |
| 520 | /*previous=crlf and now =' '*/ |
| 521 | status=saved_status; |
| 522 | break; |
| 523 | case URI_ENCLOSED: |
| 524 | to_b->uri.len = tmp - to_b->uri.s; |
| 525 | status = E_URI_ENCLOSED; |
| 526 | break; |
| 527 | case URI_OR_TOKEN: |
| 528 | status = MAYBE_URI_END; |
| 529 | end_mark = tmp; |
| 530 | break; |
| 531 | case DISPLAY_TOKEN: |
| 532 | end_mark = tmp; |
| 533 | status = DISPLAY_TOKEN2; |
| 534 | break; |
| 535 | } |
| 536 | break; |
| 537 | case '\n': |
| 538 | switch (status) |
| 539 | { |
| 540 | case URI_OR_TOKEN: |
| 541 | end_mark = tmp; |
| 542 | status = MAYBE_URI_END; |
| 543 | case MAYBE_URI_END: |
| 544 | case DISPLAY_TOKEN: |
| 545 | case DISPLAY_TOKEN2: |
| 546 | case E_DISPLAY_QUOTED: |
| 547 | case END: |
| 548 | saved_status=status; |
| 549 | status=F_LF; |
| 550 | break; |
| 551 | case F_CR: |
no test coverage detected