-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from dev-null-matt/varnish61
Supports text/plain and application/x-www-Form-urlencoded with charset
- Loading branch information
Showing
3 changed files
with
78 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM ubuntu:bionic | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
curl \ | ||
gnupg \ | ||
apt-transport-https | ||
|
||
RUN echo "deb https://packagecloud.io/varnishcache/varnish60lts/ubuntu/ bionic main" > /etc/apt/sources.list.d/varnishcache_varnish60lts.list \ | ||
echo "deb-src https://packagecloud.io/varnishcache/varnish60lts/ubuntu/ bionic main" >> /etc/apt/sources.list.d/varnishcache_varnish60lts.list | ||
|
||
RUN curl -L https://packagecloud.io/varnishcache/varnish60lts/gpgkey > key.txt && \ | ||
apt-key add key.txt && \ | ||
apt-get update | ||
|
||
RUN apt-get install -y \ | ||
libtool \ | ||
automake \ | ||
docutils-common \ | ||
varnish-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
varnishtest "with charset" | ||
|
||
server s1 { | ||
rxreq | ||
expect req.http.t1 == "1" | ||
expect req.http.t2 == "123" | ||
expect req.http.t3 == "" | ||
expect req.http.t6 == "1" | ||
expect req.http.l1 == "1" | ||
expect req.http.l2 == "3" | ||
expect req.http.l3 == "0" | ||
txresp | ||
rxreq | ||
expect req.http.t1 == "1" | ||
expect req.http.t2 == "123" | ||
expect req.http.t3 == "" | ||
expect req.http.t6 == "1" | ||
expect req.http.l1 == "1" | ||
expect req.http.l2 == "3" | ||
expect req.http.l3 == "0" | ||
txresp | ||
} -start | ||
|
||
varnish v1 -vcl+backend { | ||
import std; | ||
import ${vmod_parseform}; | ||
|
||
|
||
sub vcl_recv { | ||
std.cache_req_body(1MB); | ||
set req.http.t1 = parseform.get("a"); | ||
set req.http.t2 = parseform.get("aa"); | ||
set req.http.t3 = parseform.get("aaa"); | ||
set req.http.t4 = parseform.get(key="a", glue="*******"); | ||
set req.http.t5 = parseform.get(key="aa", encode=urlencode); | ||
set req.http.t6 = parseform.get("A"); | ||
set req.http.l1 = parseform.len("a"); | ||
set req.http.l2 = parseform.len("aa"); | ||
set req.http.l3 = parseform.len("aaa"); | ||
return(pass); | ||
} | ||
} -start | ||
|
||
|
||
client c1 { | ||
txreq -url "/" -req "POST" -hdr "Content-Type: application/x-www-Form-urlencoded; charset=UTC-8" -body "a=1&aa=123" | ||
rxresp | ||
txreq -url "/" -req "POST" -hdr "Content-Type: text/plain; charset=UTC-8" -body "a=1\r\naa=123" | ||
rxresp | ||
} | ||
|
||
client c1 -run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters