| 1685 | */ |
| 1686 | |
| 1687 | AP_DECLARE(char *) ap_get_token(apr_pool_t *p, const char **accept_line, |
| 1688 | int accept_white) |
| 1689 | { |
| 1690 | const char *ptr = *accept_line; |
| 1691 | const char *tok_start; |
| 1692 | char *token; |
| 1693 | |
| 1694 | /* Find first non-white byte */ |
| 1695 | |
| 1696 | while (apr_isspace(*ptr)) |
| 1697 | ++ptr; |
| 1698 | |
| 1699 | tok_start = ptr; |
| 1700 | |
| 1701 | /* find token end, skipping over quoted strings. |
| 1702 | * (comments are already gone). |
| 1703 | */ |
| 1704 | |
| 1705 | while (*ptr && (accept_white || !apr_isspace(*ptr)) |
| 1706 | && *ptr != ';' && *ptr != ',') { |
| 1707 | if (*ptr++ == '"') |
| 1708 | while (*ptr) |
| 1709 | if (*ptr++ == '"') |
| 1710 | break; |
| 1711 | } |
| 1712 | |
| 1713 | token = apr_pstrmemdup(p, tok_start, ptr - tok_start); |
| 1714 | |
| 1715 | /* Advance accept_line pointer to the next non-white byte */ |
| 1716 | |
| 1717 | while (apr_isspace(*ptr)) |
| 1718 | ++ptr; |
| 1719 | |
| 1720 | *accept_line = ptr; |
| 1721 | return token; |
| 1722 | } |
| 1723 | |
| 1724 | |
| 1725 | /* find http tokens, see the definition of token from RFC2068 */ |
no outgoing calls
no test coverage detected