Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
338ad01
Adjustments for current varnish-cache
nigoroll May 20, 2022
c797fe1
Adjustments for current varnish-cache: __match_proto__ -> v_matchproto_
nigoroll May 20, 2022
54f051c
Adjustments for current varnish-cache: task methods
nigoroll May 20, 2022
103350c
Quick fix for cache_param access
nigoroll May 20, 2022
c1e9243
Adjustments for current varnish-cache: Workspace interface
nigoroll May 20, 2022
1a8451e
Adjustments for current varnish-cache: VRT interface
nigoroll May 20, 2022
b441c2e
Adjustments for current varnish-cache: Misc & includes
nigoroll May 20, 2022
47ccd3e
Remove superfluous mutex
nigoroll May 20, 2022
bd51e86
vmod_soap_gzip.c: Use workspace instead of apr pool
nigoroll May 21, 2022
6fa1d0a
Define OO interface
nigoroll Jun 2, 2022
06b5694
oo interface: Basic namespaces support
nigoroll Jun 2, 2022
cbbd222
Require threads support in libxml2
nigoroll Jun 2, 2022
d52291d
Register error callbacks writing to ctx->vsl / ctx->msg
nigoroll Jun 2, 2022
9f13d85
oo interface: .add_namespace() test arguments
nigoroll Jun 2, 2022
b2dd173
soap task on workspace
nigoroll Jun 2, 2022
1770be5
oo: soap task mechanics
nigoroll Jun 2, 2022
d6d6897
Refactor process_request: pull out init
nigoroll Jun 3, 2022
74fe291
Refactor process_request: generalize debug
nigoroll Jun 3, 2022
18fbaf8
Refactor process_request: pull out process_read
nigoroll Jun 3, 2022
bc866aa
gc unused state and panic for unknown state
nigoroll Jun 3, 2022
1cd6768
Rewrite request body processing to use proposed new API
nigoroll Jun 7, 2022
aab6f66
Only consume VRB_REMAIN if allowed
nigoroll Jul 4, 2022
d9f4e40
Basic oo xpath
nigoroll Jul 4, 2022
37920a4
Basic response body parsing
nigoroll Jul 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,20 @@ AC_ARG_WITH([rst2man],

m4_ifndef([VARNISH_PREREQ], AC_MSG_ERROR([Need varnish.m4 -- see README.md]))

VARNISH_PREREQ([4.1], [5.0.0])
VARNISH_PREREQ([4.1], [trunk])
VARNISH_VMODS([soap])

AC_SUBST([VARNISHSRC])
AC_ARG_VAR([VARNISHSRC], [path to Varnish source tree])
AS_IF([test "x${VARNISHSRC}" = "x" ], AC_MSG_FAILURE([\$VARNISHSRC is not set]), AC_MSG_RESULT([yes]))
AC_CHECK_FILE([$VARNISHSRC/include/vrt.h],
[],
[AC_MSG_FAILURE([\$VARNISHSRC "$VARNISHSRC" is not a Varnish source directory])]
[],
[AC_MSG_FAILURE([\$VARNISHSRC "$VARNISHSRC" is not a Varnish source directory])]
)

VMOD_TESTS="$(cd $srcdir/src && echo tests/*.vtc)"
AC_SUBST(VMOD_TESTS)

PKG_CHECK_VAR([LIBVARNISHAPI_LIBDIR], [varnishapi], [libdir])
AC_SUBST([VARNISH_LIBRARY_PATH],
[$LIBVARNISHAPI_LIBDIR:$LIBVARNISHAPI_LIBDIR/varnish])

AC_CONFIG_FILES([
Makefile
src/Makefile
Expand Down
7 changes: 2 additions & 5 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ AM_CFLAGS = $(VARNISHAPI_CFLAGS) -Wall -Werror \
-I/usr/include/apr-1.0 \
-I$(VARNISHSRC)

AM_LDFLAGS = $(VARNISHAPI_LIBS) $(VMOD_LDFLAGS) \
AM_LDFLAGS = $(VMOD_LDFLAGS) \
-lxml2 \
-lapr-1

vmod_LTLIBRARIES = libvmod_soap.la

libvmod_soap_la_SOURCES = \
vmod_soap.c \
vmod_soap_http.c \
vmod_soap_gzip.c \
vmod_soap_xml.c \
vmod_soap_request.c
vmod_soap_xml.c

nodist_libvmod_soap_la_SOURCES = \
vcc_soap_if.c \
Expand Down
7 changes: 7 additions & 0 deletions src/tests/a00000.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
if (req.http.Content-Encoding &&
req.http.Content-Encoding != "gzip") {
return (synth(400, "Content-Encoding not supported"));
}
std.cache_req_body(1M);

if(soap.is_valid()) {
set req.http.soap-ws-ns = soap.action_namespace();
}
Expand Down
9 changes: 8 additions & 1 deletion src/tests/a00001.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
varnishtest "No Content-Length (or zero/negative) / Transfer-Encoding: chunked"

server s1 {
rxreq
expect req.http.soap-ws-ns == "http://schemas.reuters.com/mytest"
expect req.http.content-length == 215
txresp -status 200

rxreq
expect req.http.soap-ws-ns == "http://schemas.reuters.com/mytest"
expect req.http.content-length == 181
Expand All @@ -9,9 +14,11 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
std.cache_req_body(1K);
if(soap.is_valid()) {
set req.http.soap-ws-ns = soap.action_namespace();
}
Expand All @@ -31,7 +38,7 @@ client c1 {
</Body></Envelope>}
chunkedlen 0
rxresp
expect resp.status == 400
expect resp.status == 200
} -run

client c1 {
Expand Down
2 changes: 2 additions & 0 deletions src/tests/a00002.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
std.cache_req_body(1K);
if(soap.is_valid()) {
set req.http.soap-ws-ns = soap.action_namespace();
}
Expand Down
2 changes: 2 additions & 0 deletions src/tests/a00003.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
std.cache_req_body(1K);
if(soap.is_valid()) {
set req.http.soap-ws-ns = soap.action_namespace();
}
Expand Down
2 changes: 2 additions & 0 deletions src/tests/a00004.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
std.cache_req_body(1K);
if(soap.is_valid()) {
set req.http.soap-ws-ns = soap.action_namespace();
}
Expand Down
3 changes: 3 additions & 0 deletions src/tests/a00005.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
std.cache_req_body(1K);

if(soap.is_valid()) {
set req.http.soap-ws-ns = soap.action_namespace();
}
Expand Down
16 changes: 7 additions & 9 deletions src/tests/a00006.vtc
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
varnishtest "SOAP: req body is not in XML format."

server s1 {
rxreq
expect req.http.soap-ws-ns == "http://schemas.reuters.com/mytest"
expect req.http.content-length == 198
txresp -status 200
} -start

varnish v1 -vcl+backend {
varnish v1 -vcl {
import ${vmod_soap};
import std;

backend foo none;

sub vcl_recv
{
# cache just enough to determine if xml
std.cache_req_body(10B, partial=true);
if(soap.is_valid()) {
set req.http.soap-ws-ns = soap.action_namespace();
return (synth(200));
}
else {
return (synth(400, "Wrong SOAP message"));
}
}

} -start

client c1 {
Expand Down
3 changes: 3 additions & 0 deletions src/tests/a00007.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
std.cache_req_body(1K);

if(soap.is_valid()) {
set req.http.soap-ws-ns = soap.action_namespace();
}
Expand Down
4 changes: 3 additions & 1 deletion src/tests/b00000.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
# 196b: just enough to read the namespace
std.cache_req_body(196b, partial=true);
set req.http.soap-ws-ns = soap.action_namespace();
}

} -start

client c1 {
Expand Down
2 changes: 2 additions & 0 deletions src/tests/b00001.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
std.cache_req_body(1M, partial=true);
set req.http.soap-ws-ns = soap.action();
}
} -start
Expand Down
2 changes: 2 additions & 0 deletions src/tests/b00002.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
std.cache_req_body(1K);
set req.http.soap-action = soap.action();
set req.http.soap-action-ns = soap.action_namespace();
}
Expand Down
2 changes: 2 additions & 0 deletions src/tests/b00003.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
std.cache_req_body(1M, partial=true);
set req.http.soap-action = soap.action();
set req.http.soap-action-ns = soap.action_namespace();
}
Expand Down
2 changes: 2 additions & 0 deletions src/tests/b00004.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_init
{
Expand All @@ -21,6 +22,7 @@ varnish v1 -vcl+backend {

sub vcl_recv
{
std.cache_req_body(1K);
if(req.url == "/header") {
set req.http.soap-uuid = soap.xpath_header("ui:userIdentity/uuid:UUID");
}
Expand Down
2 changes: 2 additions & 0 deletions src/tests/b00005.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
std.cache_req_body(1M);
set req.http.soap-ws-ns = soap.action_namespace();
if(!req.http.soap-ws-ns) {
return (synth(400, "SOAP Action URI is mandatory"));
Expand Down
2 changes: 2 additions & 0 deletions src/tests/b00006.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_init
{
Expand All @@ -17,6 +18,7 @@ varnish v1 -vcl+backend {

sub vcl_recv
{
std.cache_req_body(1K);
set req.http.soap-uuid = soap.xpath_header("ui:userIdentity/uuid:UUID");
if(!req.http.soap-uuid || req.http.soap-uuid == "") {
return (synth(400, "SOAP UUID is mandatory"));
Expand Down
2 changes: 2 additions & 0 deletions src/tests/b00007.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_init
{
Expand All @@ -17,6 +18,7 @@ varnish v1 -vcl+backend {

sub vcl_recv
{
std.cache_req_body(1K);
set req.http.soap-uuid = soap.xpath_body("ui:userIdentity/uuid:UUID");
if(!req.http.soap-uuid || req.http.soap-uuid == "") {
return (synth(400, "SOAP UUID is mandatory"));
Expand Down
2 changes: 2 additions & 0 deletions src/tests/b00008.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ server s1 {

varnish v1 -vcl+backend {
import ${vmod_soap};
import std;

sub vcl_recv
{
std.cache_req_body(1K);
if(soap.is_valid()) {
return (synth(800, "SOAP is devil"));
}
Expand Down
Loading