}
if ((value = _decode_hex_digit(**p)) < 0) {
- parser->error = t_strdup_printf(
+ parser->error = p_strdup_printf(parser->pool,
"Expecting hex digit after '%%', but found '%c'", **p);
return -1;
}
*p += 1;
if ((value = _decode_hex_digit(**p)) < 0) {
- parser->error = t_strdup_printf(
+ parser->error = p_strdup_printf(parser->pool,
"Expecting hex digit after '%%%c', but found '%c'", *((*p)-1), **p);
return -1;
}
}
if (decoded_r != NULL)
- *decoded_r = t_strdup(str_c(decoded));
+ *decoded_r = p_strdup(parser->pool, str_c(decoded));
return TRUE;
}
return 0;
parser->cur = (const unsigned char *)p;
+ if (!parser->pool->datastack_pool)
+ *scheme_r = p_strdup(parser->pool, *scheme_r);
return 1;
}
return -1;
}
if (*address == 'v') {
- parser->error = t_strdup_printf(
+ parser->error = p_strdup_printf(parser->pool,
"Future IP host address '%s' not supported", address);
return -1;
}
if ((ret = inet_pton(AF_INET6, address, &ip6)) <= 0) {
- parser->error = t_strdup_printf(
+ parser->error = p_strdup_printf(parser->pool,
"Invalid IPv6 host address '%s'", address);
return -1;
}
return -1;
if (auth != NULL) {
- auth->host_literal = t_strdup(str_c(literal));
+ auth->host_literal = p_strdup(parser->pool, str_c(literal));
auth->host_ip.family = AF_INET6;
auth->host_ip.u.ip6 = ip6;
auth->have_host_ip = TRUE;
preserve = parser->cur;
if ((ret = uri_parse_ipv4address(parser, literal, &ip4)) > 0) {
if (auth != NULL) {
- auth->host_literal = t_strdup(str_c(literal));
+ auth->host_literal = p_strdup(parser->pool, str_c(literal));
auth->host_ip.family = AF_INET;
auth->host_ip.u.ip4 = ip4;
auth->have_host_ip = TRUE;
if (uri_parse_reg_name(parser, literal) < 0)
return -1;
if (auth != NULL) {
- auth->host_literal = t_strdup(str_c(literal));
+ auth->host_literal = p_strdup(parser->pool, str_c(literal));
auth->have_host_ip = FALSE;
}
return 0;
/* Extract userinfo */
if (p < parser->end && *p == '@') {
if (auth != NULL)
- auth->enc_userinfo = t_strdup_until(parser->cur, p);
+ auth->enc_userinfo = p_strdup_until(parser->pool, parser->cur, p);
parser->cur = p+1;
}
return 0;
if (segment_r != NULL)
- *segment_r = t_strdup_until(parser->cur, p);
+ *segment_r = p_strdup_until(parser->pool, parser->cur, p);
parser->cur = p;
return 1;
}
count = 0;
if (path_r != NULL)
- t_array_init(&segments, 16);
+ p_array_init(&segments, parser->pool, 16);
else
memset(&segments, 0, sizeof(segments));
}
if (query_r != NULL)
- *query_r = t_strdup_until(parser->cur+1, p);
+ *query_r = p_strdup_until(parser->pool, parser->cur+1, p);
parser->cur = p;
return 1;
}
}
if (fragment_r != NULL)
- *fragment_r = t_strdup_until(parser->cur+1, p);
+ *fragment_r = p_strdup_until(parser->pool, parser->cur+1, p);
parser->cur = p;
return 1;
}
string_t *uri_parser_get_tmpbuf(struct uri_parser *parser, size_t size)
{
if (parser->tmpbuf == NULL)
- parser->tmpbuf = t_str_new(size);
+ parser->tmpbuf = str_new(parser->pool, size);
else
str_truncate(parser->tmpbuf, 0);
return parser->tmpbuf;