* Get rid of the surrounding parens; later on when generating the
* filter, they'll be put back.
*/
- sec->filter = apr_pstrdup(cmd->pool, urld->lud_filter+1);
- sec->filter[strlen(sec->filter)-1] = '\0';
+ sec->filter = apr_pstrmemdup(cmd->pool, urld->lud_filter+1,
+ strlen(urld->lud_filter)-2);
}
else {
sec->filter = apr_pstrdup(cmd->pool, urld->lud_filter);
ap_set_content_type(r, "text/plain");
ap_set_content_length(r, 2);
- ap_rprintf(r, "OK");
+ ap_rputs("OK", r);
ap_rflush(r);
return OK;
/* make sure the URI does not have a trailing "/" */
len = strlen(r->uri);
if (len > 1 && r->uri[len - 1] == '/') {
- s = apr_pstrdup(r->pool, r->uri);
- s[len - 1] = '\0';
+ s = apr_pstrmemdup(r->pool, r->uri, len-1);
resource->uri = s;
}
else {
char *d;
apr_size_t l;
- d = apr_pstrdup(p, dir);
- l = strlen(d);
+ l = strlen(dir);
+ d = apr_pstrmemdup(p, dir, l);
if (l > 1 && d[l - 1] == '/')
d[l - 1] = '\0';
conf->dir = d;
/* fast exit */
if (varlen < 4) {
- return apr_pstrdup(r->pool, "");
+ return "";
}
result = NULL;
/* fast exit */
if (inputlen == span) {
- return apr_pstrdup(pool, input);
+ return apr_pstrmemdup(pool, input, inputlen);
}
/* well, actually something to do */
static int is_true(const char *w)
{
- if (strcasecmp(w, "on") == 0 ||
- strcasecmp(w, "1") == 0 ||
+ if (strcasecmp(w, "on") == 0 || strcmp(w, "1") == 0 ||
strcasecmp(w, "true") == 0)
{
return 1;
const char *x = ap_strchr_c(p, '=');
if (x) {
- char *key = apr_pstrndup(cmd->pool, p, x-p);
- if (strcmp(key, "preservehost") == 0) {
+ if (strncmp(p, "preservehost", x-p) == 0) {
conf->preservehost = is_true(x+1);
}
}
return NULL;
}
- url_copy = apr_pstrdup(p, url);
url_length = strlen(url);
+ url_copy = apr_pstrmemdup(p, url, url_length);
/*
* We need to find the start of the path and
char *res;
if (!pos) {
- res = apr_pstrdup(atrans, *line);
- *line += strlen(*line);
+ size_t len = strlen(*line);
+ res = apr_pstrmemdup(atrans, *line, len);
+ *line += len;
return res;
}
if (*w_ == '\0')
return NULL;
- w = apr_pstrdup(p, w_);
+ wlen = strlen(w_); /* wlen must be > 0 at this point */
+ w = apr_pstrmemdup(p, w_, wlen);
/* apr_parse_addr_port() doesn't understand ":*" so handle that first. */
- wlen = strlen(w); /* wlen must be > 0 at this point */
wild_port = 0;
if (w[wlen - 1] == '*') {
if (wlen < 2) {