From a865757360c3f1b8e0a709ee4ae1ecf65efae65c Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 27 Jul 2021 23:24:53 +0200 Subject: fix(parse)!: admit query --- examples/paste | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/paste b/examples/paste index 17f34e9..bec238d 100644 --- a/examples/paste +++ b/examples/paste @@ -10,9 +10,11 @@ find_item() { return 1 } -case "$Method $Request_URI" in +abs_path=${Request_URI%%\?*} + +case "$Method $abs_path" in "GET /"[0-9a-z]*) - if item=$(find_item ${Request_URI#/}); then + if item=$(find_item ${abs_path#/}); then printf 'HTTP/1.1 200 OK\r\n' printf 'Content-Type: %s\r\n' "$(file -ib $item)" printf 'Server: %s\r\n' "$Server" -- cgit v1.2.3