find http tokens, see the definition of token from RFC2068 */
| 1724 | |
| 1725 | /* find http tokens, see the definition of token from RFC2068 */ |
| 1726 | AP_DECLARE(int) ap_find_token(apr_pool_t *p, const char *line, const char *tok) |
| 1727 | { |
| 1728 | const unsigned char *start_token; |
| 1729 | const unsigned char *s; |
| 1730 | |
| 1731 | if (!line) |
| 1732 | return 0; |
| 1733 | |
| 1734 | s = (const unsigned char *)line; |
| 1735 | for (;;) { |
| 1736 | /* find start of token, skip all stop characters */ |
| 1737 | while (*s && TEST_CHAR(*s, T_HTTP_TOKEN_STOP)) { |
| 1738 | ++s; |
| 1739 | } |
| 1740 | if (!*s) { |
| 1741 | return 0; |
| 1742 | } |
| 1743 | start_token = s; |
| 1744 | /* find end of the token */ |
| 1745 | while (*s && !TEST_CHAR(*s, T_HTTP_TOKEN_STOP)) { |
| 1746 | ++s; |
| 1747 | } |
| 1748 | if (!ap_cstr_casecmpn((const char *)start_token, (const char *)tok, |
| 1749 | s - start_token)) { |
| 1750 | return 1; |
| 1751 | } |
| 1752 | if (!*s) { |
| 1753 | return 0; |
| 1754 | } |
| 1755 | } |
| 1756 | } |
| 1757 | |
| 1758 | static const char *find_last_token(apr_pool_t *p, const char *line, |
| 1759 | const char *tok) |
no test coverage detected