diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/httpd/httpd.c | 8 | ||||
-rw-r--r-- | usr.sbin/httpd/httpd.h | 4 | ||||
-rw-r--r-- | usr.sbin/httpd/server_file.c | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/usr.sbin/httpd/httpd.c b/usr.sbin/httpd/httpd.c index 273e0f9c9fb..a1ad9682b8a 100644 --- a/usr.sbin/httpd/httpd.c +++ b/usr.sbin/httpd/httpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.c,v 1.33 2015/02/10 08:12:29 florian Exp $ */ +/* $OpenBSD: httpd.c,v 1.34 2015/02/12 10:05:29 reyk Exp $ */ /* * Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org> @@ -671,8 +671,8 @@ path_info(char *path) return (p - start); } -char* -escape_uri(const char *src) +char * +url_encode(const char *src) { static char hex[] = "0123456789ABCDEF"; char *dp, *dst; @@ -680,7 +680,7 @@ escape_uri(const char *src) /* We need 3 times the memory if every letter is encoded. */ if ((dst = calloc(3, strlen(src) + 1)) == NULL) - return NULL; + return (NULL); for (dp = dst; *src != 0; src++) { c = (unsigned char) *src; diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h index ecc12f50301..bb577295e3b 100644 --- a/usr.sbin/httpd/httpd.h +++ b/usr.sbin/httpd/httpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.h,v 1.79 2015/02/12 04:40:23 jsing Exp $ */ +/* $OpenBSD: httpd.h,v 1.80 2015/02/12 10:05:29 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org> @@ -585,10 +585,10 @@ void event_again(struct event *, int, short, void (*)(int, short, void *), struct timeval *, struct timeval *, void *); const char *url_decode(char *); +char *url_encode(const char *); const char *canonicalize_host(const char *, char *, size_t); const char *canonicalize_path(const char *, char *, size_t); size_t path_info(char *); -char *escape_uri(const char *); char *escape_html(const char *); void imsg_event_add(struct imsgev *); int imsg_compose_event(struct imsgev *, u_int16_t, u_int32_t, diff --git a/usr.sbin/httpd/server_file.c b/usr.sbin/httpd/server_file.c index 199bf07c3a4..f697504dd3c 100644 --- a/usr.sbin/httpd/server_file.c +++ b/usr.sbin/httpd/server_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_file.c,v 1.50 2015/02/10 08:12:29 florian Exp $ */ +/* $OpenBSD: server_file.c,v 1.51 2015/02/12 10:05:29 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org> @@ -341,7 +341,7 @@ server_file_index(struct httpd *env, struct client *clt, struct stat *st) strftime(tmstr, sizeof(tmstr), "%d-%h-%Y %R", &tm); namewidth = 51 - strlen(dp->d_name); - if ((escapeduri = escape_uri(dp->d_name)) == NULL) + if ((escapeduri = url_encode(dp->d_name)) == NULL) goto fail; if ((escapedhtml = escape_html(dp->d_name)) == NULL) goto fail; |