From 9a326888d3d566d3c6993852b1c36aaf970c290c Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sun, 7 Nov 2010 13:26:54 +0000 Subject: [PATCH] Start some docs for the ap_expr parser. Still needs a lot of work but may be usefult for testers. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1032273 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/expr.html | 5 + docs/manual/expr.html.en | 301 ++++++++++++++++++++++++++++++++++++ docs/manual/expr.xml | 314 ++++++++++++++++++++++++++++++++++++++ docs/manual/expr.xml.meta | 12 ++ 4 files changed, 632 insertions(+) create mode 100644 docs/manual/expr.html create mode 100644 docs/manual/expr.html.en create mode 100644 docs/manual/expr.xml create mode 100644 docs/manual/expr.xml.meta diff --git a/docs/manual/expr.html b/docs/manual/expr.html new file mode 100644 index 0000000000..592b58bd39 --- /dev/null +++ b/docs/manual/expr.html @@ -0,0 +1,5 @@ +# GENERATED FROM XML -- DO NOT EDIT + +URI: expr.html.en +Content-Language: en +Content-type: text/html; charset=ISO-8859-1 diff --git a/docs/manual/expr.html.en b/docs/manual/expr.html.en new file mode 100644 index 0000000000..d8fd3af885 --- /dev/null +++ b/docs/manual/expr.html.en @@ -0,0 +1,301 @@ + + + +Expressions in Apache - Apache HTTP Server + + + + + +
<-
+
+Apache > HTTP Server > Documentation > Version 2.3

Expressions in Apache

+
+

Available Languages:  en 

+
+ +

Historically, there are several syntax variants for expressions used to express + a condition in the different modules of the Apache HTTP Server. + There is some ongoing effort to only use a single variant, called ap_expr, + for all configuration directives. + This document describes the ap_expr expression parser. +

+
+ +
top
+
+

Grammar in BNF notation

+ +
+
+expr        ::= "true" | "false"
+              | "!" expr
+              | expr "&&" expr
+              | expr "||" expr
+              | "(" expr ")"
+              | comp
+
+comp        ::= stringcomp
+              | integercomp
+              | unaryop word
+              | word binaryop word
+              | word "in" "{" wordlist "}"
+              | word "in" listfunction
+              | word "=~" regex
+              | word "!~" regex
+
+
+stringcomp  ::= word "==" word | word "eq" word
+              | word "!=" word | word "ne" word
+              | word "<"  word | word "lt" word
+              | word "<=" word | word "le" word
+              | word ">"  word | word "gt" word
+              | word ">=" word | word "ge" word
+
+integercomp ::= word "-eq" word | word "eq" word
+              | word "-ne" word | word "ne" word
+              | word "-lt" word | word "lt" word
+              | word "-le" word | word "le" word
+              | word "-gt" word | word "gt" word
+              | word "-ge" word | word "ge" word
+
+wordlist    ::= word
+              | wordlist "," word
+
+word        ::= word "." word
+              | digit
+              | "'" string "'"
+              | """ string """
+              | variable
+              | function
+
+string      ::= stringpart
+              | string stringpart
+
+stringpart  ::= cstring
+              | variable
+
+cstring     ::= ...
+digit       ::= [0-9]+
+
+variable    ::= "%{" varname "}"
+              | "%{" funcname ":" funcargs "}"
+
+function     ::= funcname "(" word ")"
+
+listfunction ::= listfuncname "(" word ")"
+
+
+ +
top
+
+

Variables

+ +

XXX: not all vars are available in all request phases

+ +

Request headers (XXX:see req function)

+ + + + + + + + +
Name
HTTP_ACCEPT
HTTP_FORWARDED
HTTP_HOST
HTTP_PROXY_CONNECTION
HTTP_REFERER
HTTP_USER_AGENT
+ +

Other request related variables

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
REQUEST_METHOD
REQUEST_SCHEME
REQUEST_URI
REQUEST_FILENAME
REMOTE_HOST
REMOTE_IDENT
REMOTE_USER
SERVER_ADMIN
SERVER_NAME
SERVER_PORT
SERVER_PROTOCOL
SCRIPT_FILENAME
PATH_INFO
QUERY_STRING
IS_SUBREQ
DOCUMENT_ROOT
AUTH_TYPE
THE_REQUEST
CONTENT_TYPE
REMOTE_ADDR
HTTPS
IPV6
+ +

Misc variables

+ + + + + + + + + + + + + + + + + + + + + + +
NameDescription
TIME_YEAR
TIME_MON
TIME_DAY
TIME_HOUR
TIME_MIN
TIME_SEC
TIME_WDAY
TIME
SERVER_SOFTWARE
API_VERSION
+ +
top
+
+

Binary operators

+ + +

With the exception of some built-in comparison operators, binary + operators have the form "-[a-zA-Z][a-zA-Z0-9_]+", i.e. a + minus and at least two characters. The name is not case sensitive. + Modules may register additional binary operators.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAlternative Description
===String equality
!= + String inequality
< + String less than
<= + String less than or equal
> + String greater than
>= + String greater than or equal
-eqeqInteger equality
-neneInteger inequality
-ltltInteger less than
-leleInteger less than or equal
-gtgtInteger greater than
-gegeInteger greater than or equal
+ +
top
+
+

Unary operators

+ + +

Unary operators have the form "-[a-zA-Z]", i.e. a + minus and one character. The name is case sensitive. + Modules may register additional unary operators.

+ + + + + + +
NameDescription
-nString is not empty (XXX: not yet implemented)
-zString is empty (XXX: not yet implemented)
+ +
top
+
+

Functions

+ + +

Normal string-valued functions take one string as argument and return + a string. Functions names are not case sensitive. + Modules may register additional functions.

+ + + + + + + + + + + + + + + + + + +
NameDescription
req, httpGet HTTP request header
respGet HTTP response header
osenvLookup operating system environment variable
envLookup request environment variable (XXX: will need to be changed for better ssl_expr compat)
lolowerConvert string to lower case
toupperConvert string to uppser case
escapeEscape special characters in %hex encoding
unescapeUnescape %hex encoded string, leaving URL-special characters encoded (XXX: describe better)
+ +

In addition to string-valued functions, there are also list-valued functions which + take one string as argument and return a wordlist, i.e. a list of strings. The wordlist + can be used with the special -in operator. + Functions names are not case sensitive. + Modules may register additional functions.

+ +

There are no built-in list-valued functions. mod_ssl provides + PeerExtList (XXX: link)

+ +
+
+

Available Languages:  en 

+
+ \ No newline at end of file diff --git a/docs/manual/expr.xml b/docs/manual/expr.xml new file mode 100644 index 0000000000..aa81488169 --- /dev/null +++ b/docs/manual/expr.xml @@ -0,0 +1,314 @@ + + + + + + + + + + Expressions in Apache + + +

Historically, there are several syntax variants for expressions used to express + a condition in the different modules of the Apache HTTP Server. + There is some ongoing effort to only use a single variant, called ap_expr, + for all configuration directives. + This document describes the ap_expr expression parser. +

+
+ +
+ Grammar in BNF notation +
+
+expr        ::= "true" | "false"
+              | "!" expr
+              | expr "&&" expr
+              | expr "||" expr
+              | "(" expr ")"
+              | comp
+
+comp        ::= stringcomp
+              | integercomp
+              | unaryop word
+              | word binaryop word
+              | word "in" "{" wordlist "}"
+              | word "in" listfunction
+              | word "=~" regex
+              | word "!~" regex
+
+
+stringcomp  ::= word "==" word | word "eq" word
+              | word "!=" word | word "ne" word
+              | word "<"  word | word "lt" word
+              | word "<=" word | word "le" word
+              | word ">"  word | word "gt" word
+              | word ">=" word | word "ge" word
+
+integercomp ::= word "-eq" word | word "eq" word
+              | word "-ne" word | word "ne" word
+              | word "-lt" word | word "lt" word
+              | word "-le" word | word "le" word
+              | word "-gt" word | word "gt" word
+              | word "-ge" word | word "ge" word
+
+wordlist    ::= word
+              | wordlist "," word
+
+word        ::= word "." word
+              | digit
+              | "'" string "'"
+              | """ string """
+              | variable
+              | function
+
+string      ::= stringpart
+              | string stringpart
+
+stringpart  ::= cstring
+              | variable
+
+cstring     ::= ...
+digit       ::= [0-9]+
+
+variable    ::= "%{" varname "}"
+              | "%{" funcname ":" funcargs "}"
+
+function     ::= funcname "(" word ")"
+
+listfunction ::= listfuncname "(" word ")"
+
+
+ +
+ +
+ Variables +

XXX: not all vars are available in all request phases

+ +

Request headers (XXX:see req function)

+ + + + + + + + + + + + +
Name
HTTP_ACCEPT
HTTP_FORWARDED
HTTP_HOST
HTTP_PROXY_CONNECTION
HTTP_REFERER
HTTP_USER_AGENT
+ +

Other request related variables

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
REQUEST_METHOD
REQUEST_SCHEME
REQUEST_URI
REQUEST_FILENAME
REMOTE_HOST
REMOTE_IDENT
REMOTE_USER
SERVER_ADMIN
SERVER_NAME
SERVER_PORT
SERVER_PROTOCOL
SCRIPT_FILENAME
PATH_INFO
QUERY_STRING
IS_SUBREQ
DOCUMENT_ROOT
AUTH_TYPE
THE_REQUEST
CONTENT_TYPE
REMOTE_ADDR
HTTPS
IPV6
+ +

Misc variables

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
TIME_YEAR
TIME_MON
TIME_DAY
TIME_HOUR
TIME_MIN
TIME_SEC
TIME_WDAY
TIME
SERVER_SOFTWARE
API_VERSION
+ +
+ +
+ Binary operators + +

With the exception of some built-in comparison operators, binary + operators have the form "-[a-zA-Z][a-zA-Z0-9_]+", i.e. a + minus and at least two characters. The name is not case sensitive. + Modules may register additional binary operators.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameAlternative Description
===String equality
!=String inequality
<String less than
<=String less than or equal
>String greater than
>=String greater than or equal
-eqeqInteger equality
-neneInteger inequality
-ltltInteger less than
-leleInteger less than or equal
-gtgtInteger greater than
-gegeInteger greater than or equal
+ +
+ +
+ Unary operators + +

Unary operators have the form "-[a-zA-Z]", i.e. a + minus and one character. The name is case sensitive. + Modules may register additional unary operators.

+ + + + + + + + + +
NameDescription
-nString is not empty (XXX: not yet implemented)
-zString is empty (XXX: not yet implemented)
+ +
+ +
+ Functions + +

Normal string-valued functions take one string as argument and return + a string. Functions names are not case sensitive. + Modules may register additional functions.

+ + + + + + + + + + + + + + + + + + + + + +
NameDescription
req, httpGet HTTP request header
respGet HTTP response header
osenvLookup operating system environment variable
envLookup request environment variable (XXX: will need to be changed for better ssl_expr compat)
lolowerConvert string to lower case
toupperConvert string to uppser case
escapeEscape special characters in %hex encoding
unescapeUnescape %hex encoded string, leaving URL-special characters encoded (XXX: describe better)
+ +

In addition to string-valued functions, there are also list-valued functions which + take one string as argument and return a wordlist, i.e. a list of strings. The wordlist + can be used with the special -in operator. + Functions names are not case sensitive. + Modules may register additional functions.

+ +

There are no built-in list-valued functions. mod_ssl provides + PeerExtList (XXX: link)

+ +
+ +
diff --git a/docs/manual/expr.xml.meta b/docs/manual/expr.xml.meta new file mode 100644 index 0000000000..cccb2c638f --- /dev/null +++ b/docs/manual/expr.xml.meta @@ -0,0 +1,12 @@ + + + + + expr + / + . + + + en + + -- 2.40.0