summaryrefslogtreecommitdiffstats
path: root/krebs/3modules
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-01-24 14:36:22 +0100
committerlassulus <lassulus@lassul.us>2022-01-24 14:36:22 +0100
commite422692ef62655ddb5dcd0e5b95d7e25ce898a7f (patch)
treed7300f9c212c9a3f4586ff57dde413c92f287a5f /krebs/3modules
parent77440ee9a7f040f735bce6e5c06ba15c62451742 (diff)
go: fix urls with missing prefix
Diffstat (limited to 'krebs/3modules')
-rw-r--r--krebs/3modules/go.nix12
1 files changed, 9 insertions, 3 deletions
diff --git a/krebs/3modules/go.nix b/krebs/3modules/go.nix
index fea25e036..80cd90e27 100644
--- a/krebs/3modules/go.nix
+++ b/krebs/3modules/go.nix
@@ -41,11 +41,17 @@ let
fi
;;
"POST /")
- uri=$(head -c "$req_content_length" \
+ uri_candidate=$(head -c "$req_content_length" \
| sed 's/+/ /g;s/%\(..\)/\\x\1/g;' \
| xargs -0 echo -e \
- | tee /tmp/tee.log \
- | ${pkgs.urix}/bin/urix \
+ )
+
+ if $(echo "$uri_candidate" | grep -q '^uri=//.*'); then
+ # fix urls with missing https: in front
+ uri_candidate=$(echo "$uri_candidate" | sed 's,//,https://,g')
+ fi
+
+ uri=$(echo "$uri_candidate" | ${pkgs.urix}/bin/urix \
| head -1 \
)