-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vmod_std: New partial arg for std.cache_req_body()
This parameter defaults to false to avoid breaking existing code.
- Loading branch information
Showing
3 changed files
with
58 additions
and
4 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,50 @@ | ||
varnishtest "partial std.cache_req_body()" | ||
|
||
barrier b1 sock 2 | ||
|
||
server s1 { | ||
close | ||
|
||
accept | ||
rxreq | ||
expect req.bodylen == 150 | ||
txresp | ||
} -start | ||
|
||
varnish v1 -cliok "param.set debug +syncvsl,+flush_head,+slow_bereq" | ||
varnish v1 -vcl+backend { | ||
import std; | ||
import vtc; | ||
|
||
sub vcl_recv { | ||
std.cache_req_body(100b, partial=true); | ||
} | ||
|
||
sub vcl_backend_fetch { | ||
if (bereq.retries == 1) { | ||
vtc.barrier_sync("${b1_sock}"); | ||
} | ||
} | ||
|
||
sub vcl_backend_error { | ||
return (retry); | ||
} | ||
} -start | ||
|
||
logexpect l1 -v v1 -i FetchError -g raw { | ||
expect 0 1002 FetchError "Failed to send a partial req.body" | ||
expect 0 1002 FetchError "backend write error" | ||
} -start | ||
|
||
client c1 { | ||
txreq -method POST -nolen -hdr "transfer-encoding: chunked" | ||
chunkedlen 100 | ||
barrier b1 sync | ||
chunkedlen 50 | ||
chunkedlen 0 | ||
rxresp | ||
expect resp.status == 200 | ||
} -run | ||
|
||
logexpect l1 -wait | ||
server s1 -wait |
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
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