aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@esdenera.com>2015-06-23 19:41:33 +0200
committerReyk Floeter <reyk@esdenera.com>2015-06-23 19:41:33 +0200
commit429408fc074117ba9222fe949b426f196a722e4a (patch)
treec1f4e4b8e1fd6716dcaa90ca378d82f1e4dacd75
parent81406d22e54b5d3ad4799d92125dd1c4a4bc0a28 (diff)
downloadhttpd-429408fc074117ba9222fe949b426f196a722e4a.tar.gz
httpd-429408fc074117ba9222fe949b426f196a722e4a.zip
sync with -current
-rw-r--r--httpd/Makefile2
-rw-r--r--httpd/httpd.conf.56
-rw-r--r--httpd/httpd.h2
-rw-r--r--httpd/parse.y2
-rw-r--r--httpd/patterns.729
-rw-r--r--httpd/patterns.c7
-rw-r--r--httpd/patterns.h2
-rw-r--r--httpd/server_http.c9
8 files changed, 29 insertions, 30 deletions
diff --git a/httpd/Makefile b/httpd/Makefile
index 69fdb5e..e01dec1 100644
--- a/httpd/Makefile
+++ b/httpd/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.27 2015/02/23 10:39:10 reyk Exp $
+# $OpenBSD: Makefile,v 1.28 2015/06/23 15:23:14 reyk Exp $
PROG= httpd
SRCS= parse.y
diff --git a/httpd/httpd.conf.5 b/httpd/httpd.conf.5
index 24d92ac..db73b8f 100644
--- a/httpd/httpd.conf.5
+++ b/httpd/httpd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: httpd.conf.5,v 1.61 2015/05/28 19:29:40 jmc Exp $
+.\" $OpenBSD: httpd.conf.5,v 1.63 2015/06/23 17:29:19 jmc Exp $
.\"
.\" Copyright (c) 2014, 2015 Reyk Floeter <reyk@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 28 2015 $
+.Dd $Mdocdate: June 23 2015 $
.Dt HTTPD.CONF 5
.Os
.Sh NAME
@@ -212,7 +212,7 @@ The configured IP address of the server.
The configured TCP server port of the server.
.It Ic $SERVER_NAME
The name of the server.
-.It Ic Pf % Ar n
+.It Pf % Ar n
The capture index
.Ar n
of a string that was captured by the enclosing
diff --git a/httpd/httpd.h b/httpd/httpd.h
index ff76281..20d75a7 100644
--- a/httpd/httpd.h
+++ b/httpd/httpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: httpd.h,v 1.83 2015/05/20 09:28:47 kettenis Exp $ */
+/* $OpenBSD: httpd.h,v 1.84 2015/06/23 15:23:14 reyk Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
diff --git a/httpd/parse.y b/httpd/parse.y
index f556bf0..1ba5cf3 100644
--- a/httpd/parse.y
+++ b/httpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.67 2015/04/01 04:51:15 jsg Exp $ */
+/* $OpenBSD: parse.y,v 1.68 2015/06/23 15:23:14 reyk Exp $ */
/*
* Copyright (c) 2007 - 2015 Reyk Floeter <reyk@openbsd.org>
diff --git a/httpd/patterns.7 b/httpd/patterns.7
index 1eeef4c..7c951db 100644
--- a/httpd/patterns.7
+++ b/httpd/patterns.7
@@ -1,4 +1,4 @@
-.\" $OpenBSD$
+.\" $OpenBSD: patterns.7,v 1.2 2015/06/23 17:29:19 jmc Exp $
.\"
.\" Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
.\" Copyright (C) 1994-2015 Lua.org, PUC-Rio.
@@ -23,19 +23,19 @@
.\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.\"
.\" Derived from section 6.4.1 in manual.html of Lua 5.3.1:
-.\" $Id: manual.of,v 1.151 2015/06/10 21:08:57 roberto Exp $
+.\" $Id: patterns.7,v 1.2 2015/06/23 17:29:19 jmc Exp $
.\"
-.Dd $Mdocdate: Jun 19 2015 $
+.Dd $Mdocdate: June 23 2015 $
.Dt PATTERNS 7
.Os
.Sh NAME
.Nm patterns
-.Nd Lua's pattern matching rules.
+.Nd Lua's pattern matching rules
.Sh DESCRIPTION
Pattern matching in
.Xr httpd 8
is based on the implementation of the Lua scripting language and
-provides a simple and fast alternative to Regular expressions (REs) that
+provides a simple and fast alternative to the regular expressions (REs) that
are described in
.Xr re_format 7 .
Patterns are described by regular strings, which are interpreted as
@@ -47,7 +47,6 @@ functions.
This document describes the syntax and the meaning (that is, what they
match) of these strings.
.Sh CHARACTER CLASS
-.Pp
A character class is used to represent a set of characters.
The following combinations are allowed in describing a character
class:
@@ -90,7 +89,7 @@ is any non-alphanumeric character) represents the character
This is the standard way to escape the magic characters.
Any non-alphanumeric character (including all punctuation characters,
even the non-magical) can be preceded by a
-.Eq %
+.Sq %
when used to represent itself in a pattern.
.It Bq Ar set
represents the class which is the union of all
@@ -172,7 +171,7 @@ Unlike
these repetition items will always match the shortest possible sequence;
.It
a single character class followed by
-.Sq \? ,
+.Sq \&? ,
which matches zero or one occurrence of a character in the class.
It always matches one occurrence if possible;
.It
@@ -189,7 +188,7 @@ and
.Ar y
are two distinct characters;
such item matches strings that start with
-.Ar x,
+.Ar x ,
end with
.Ar y ,
and where the
@@ -198,7 +197,7 @@ and
.Ar y
are
.Em balanced .
-This means that, if one reads the string from left to right, counting
+This means that if one reads the string from left to right, counting
.Em +1
for an
.Ar x
@@ -237,12 +236,12 @@ A caret
at the beginning of a pattern anchors the match at the beginning of
the subject string.
A
-.Sq \$
+.Sq $
at the end of a pattern anchors the match at the end of the subject string.
At other positions,
.Sq ^
and
-.Sq \$
+.Sq $
have no special meaning and represent themselves.
.Sh CAPTURES
A pattern can contain sub-patterns enclosed in parentheses; they
@@ -272,8 +271,8 @@ on the string
there will be two captures: 3 and 5.
.Sh SEE ALSO
.Xr fnmatch 3 ,
-.Xr re_format 3 ,
-.Xr httpd 8 .
+.Xr re_format 7 ,
+.Xr httpd 8
.Rs
.%A Roberto Ierusalimschy
.%A Luiz Henrique de Figueiredo
@@ -292,7 +291,7 @@ an implementation based on Lua 5.3.1 appeared in
.Ox 5.8 .
.Sh AUTHORS
The pattern matching is derived from the original implementation of
-the Lua scripting language, that is written by
+the Lua scripting language written by
.An -nosplit
.An Roberto Ierusalimschy ,
.An Waldemar Celes ,
diff --git a/httpd/patterns.c b/httpd/patterns.c
index 61f6ab8..3b2cbcc 100644
--- a/httpd/patterns.c
+++ b/httpd/patterns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD$ */
+/* $OpenBSD: patterns.c,v 1.2 2015/06/23 15:35:20 semarie Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -26,7 +26,7 @@
/*
* Derived from Lua 5.3.1:
- * $Id: lstrlib.c,v 1.229 2015/05/20 17:39:23 roberto Exp $
+ * $Id: patterns.c,v 1.2 2015/06/23 15:35:20 semarie Exp $
* Standard library for string operations and pattern-matching
*/
@@ -156,9 +156,6 @@ match_class(int c, int cl)
case 'x':
res = isxdigit(c);
break;
- case 'z':
- res = (c == 0);
- break; /* deprecated option */
default:
return (cl == c);
}
diff --git a/httpd/patterns.h b/httpd/patterns.h
index 6db5991..e753849 100644
--- a/httpd/patterns.h
+++ b/httpd/patterns.h
@@ -1,4 +1,4 @@
-/* $OpenBSD$ */
+/* $OpenBSD: patterns.h,v 1.1 2015/06/23 15:23:14 reyk Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
diff --git a/httpd/server_http.c b/httpd/server_http.c
index bd686e2..112bb00 100644
--- a/httpd/server_http.c
+++ b/httpd/server_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_http.c,v 1.82 2015/06/22 11:46:06 reyk Exp $ */
+/* $OpenBSD: server_http.c,v 1.84 2015/06/23 17:25:01 semarie Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -911,8 +911,11 @@ server_expand_http(struct client *clt, const char *val, char *buf,
return (NULL);
/* Expand variable with matched value */
- if (expand_string(buf, len, ibuf,
- clt->clt_srv_match.sm_match[n]) != 0)
+ if ((str = url_encode(clt->clt_srv_match.sm_match[n])) == NULL)
+ return (NULL);
+ ret = expand_string(buf, len, ibuf, str);
+ free(str);
+ if (ret != 0)
return (NULL);
}
if (strstr(val, "$DOCUMENT_URI") != NULL) {