static int http_parse_auth_param(struct http_parser *parser, const char **param_r, const char **value_r) { const unsigned char *first = parser->cur, *end_token; int ret; /* auth-param = token BWS "=" BWS ( token / quoted-string ) */ /* token */ if ((ret=http_parser_skip_token(parser)) <= 0) { parser->cur = first; return ret; } end_token = parser->cur; /* BWS "=" BWS */ http_parse_ows(parser); if (parser->cur >= parser->end || *parser->cur != '=') { parser->cur = first; return 0; } parser->cur++; http_parse_ows(parser); /* ( token / quoted-string ) */ if ((ret=http_parse_token_or_qstring(parser, value_r)) <= 0) { parser->cur = first; return ret; } *param_r = t_strndup(first, end_token - first); return 1; }
int http_parse_token(struct http_parser *parser, const char **token_r) { const unsigned char *first = parser->cur; int ret; if ((ret=http_parser_skip_token(parser)) <= 0) return ret; *token_r = t_strndup(first, parser->cur - first); return 1; }