From c59202a6dc3eabf0b6749645e14aa7742b310300 Mon Sep 17 00:00:00 2001 From: sdomi Date: Fri, 13 Jun 2025 02:18:00 +0200 Subject: [PATCH 01/15] server: respect cfg[enable_multipart] --- src/server.sh | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/server.sh b/src/server.sh index 6be454e..4810a05 100755 --- a/src/server.sh +++ b/src/server.sh @@ -224,30 +224,33 @@ if [[ "${r[post]}" == true ]] && [[ "${r[status]}" == 200 || "${r[status]}" == # I could have done it as an array, but this solution works, and it's # speedy enough so I don't care. - if [[ $tmpdir ]]; then - declare post_multipart - tmpfile=$(mktemp -p $tmpdir) - dd iflag=fullblock of=$tmpfile ibs=${r[content_length]} count=1 obs=1M + if [[ "$tmpdir" ]]; then + if [[ "${cfg[enable_multipart]}" == true ]]; then + # FIXME: ugly, potentially leaky, potentially dangerous code ahead + declare post_multipart + tmpfile=$(mktemp -p $tmpdir) + dd iflag=fullblock of=$tmpfile ibs="${r[content_length]}" count=1 obs=1M - delimeter_len=$(echo -n "${r[content_boundary]}"$'\015' | wc -c) - boundaries_list=$(echo -ne $(grep $tmpfile -ao -e ${r[content_boundary]} --byte-offset | sed -E 's/:(.*)//g') | sed -E 's/ [0-9]+$//') + delimeter_len=$(echo -n "${r[content_boundary]}"$'\015' | wc -c) + boundaries_list=$(echo -ne $(grep $tmpfile -ao -e "${r[content_boundary]}" --byte-offset | sed -E 's/:(.*)//g') | sed -E 's/ [0-9]+$//') - for i in $boundaries_list; do - tmpout=$(mktemp -p $tmpdir) - dd iflag=fullblock if=$tmpfile ibs=$(($i+$delimeter_len)) obs=1M skip=1 | while true; do - read -r line - if [[ $line == $'\015' ]]; then - cat - > $tmpout - break - fi + for i in $boundaries_list; do + tmpout=$(mktemp -p $tmpdir) + dd iflag=fullblock if=$tmpfile ibs=$(($i+$delimeter_len)) obs=1M skip=1 | while true; do + read -r line + if [[ $line == $'\015' ]]; then + cat - > $tmpout + break + fi + done + length=$(grep $tmpout --byte-offset -ae ${r[content_boundary]} | sed -E 's/:(.*)//' | head -n 1) + outfile=$(mktemp -p $tmpdir) + post_multipart+=($outfile) + dd iflag=fullblock if=$tmpout ibs=$length count=1 obs=1M of=$outfile + rm $tmpout done - length=$(grep $tmpout --byte-offset -ae ${r[content_boundary]} | sed -E 's/:(.*)//' | head -n 1) - outfile=$(mktemp -p $tmpdir) - post_multipart+=($outfile) - dd iflag=fullblock if=$tmpout ibs=$length count=1 obs=1M of=$outfile - rm $tmpout - done - rm $tmpfile + rm $tmpfile + fi else if [[ "${r[content_length]}" ]]; then read -r -N "${r[content_length]}" data From 41cbf1ee42270e86a2af90b393ed7dcaefed6eef Mon Sep 17 00:00:00 2001 From: sdomi Date: Thu, 17 Jul 2025 09:51:07 +0200 Subject: [PATCH 02/15] docs: add example for template -index --- docs/template-examples.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/template-examples.md b/docs/template-examples.md index 10ab8fb..ce0c13c 100644 --- a/docs/template-examples.md +++ b/docs/template-examples.md @@ -145,6 +145,24 @@ This is very useful for rendering data in tables: ![our example, now rendered as a table](https://f.sakamoto.pl/IwIf39cYw.png) +In this specific example the loop index is readily available; However, if your code iterates over +a list of strings and you'd need to keep track of an additional index variable, the template +engine can do it for you with `{{-index}}`: + +``` + + + + + {{start _list}} + + + + + {{end _list}} +
number
{{-index}}meow
+``` + ### integration with notORM notORM's `data_iter` function works great with nested_add; Body of a callback function can be From 23281e594aa13fe54723378cbd68af030ca3d027 Mon Sep 17 00:00:00 2001 From: lemonsh Date: Tue, 2 Sep 2025 16:54:54 +0200 Subject: [PATCH 03/15] allow running from non-root directories --- http.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/http.sh b/http.sh index 2d186c8..d7206d3 100755 --- a/http.sh +++ b/http.sh @@ -15,9 +15,12 @@ setup_config() { echo "cfg[init_version]=$HTTPSH_VERSION" >> "config/master.sh" } -if [[ ! -f "$PWD/http.sh" ]]; then - echo -e "Please run HTTP.sh inside its designated directory\nRunning the script from arbitrary locations isn't supported." - exit 1 +if [[ "${0##*/}" == "http.sh" ]]; then + # make sure that working directory is http.sh root + cd "${0%/*}" +elif [[ ! -f "$PWD/http.sh" ]]; then + echo -e "Could not detect HTTP.sh directory\nPlease run HTTP.sh inside its designated directory" + exit 1 fi source src/version.sh From 47b5dd9f290caf069c3f5430307176df6a69c1a1 Mon Sep 17 00:00:00 2001 From: famfo Date: Fri, 5 Sep 2025 17:47:00 +0200 Subject: [PATCH 04/15] http.sh: fix socat IPv6 bind --- http.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/http.sh b/http.sh index d7206d3..b3877ef 100755 --- a/http.sh +++ b/http.sh @@ -130,13 +130,19 @@ if [[ -f "${cfg[namespace]}/config.sh" ]]; then unset run_once fi +if [[ "${cfg[ip]}" == *":"* ]]; then + socat_listen="TCP6-LISTEN" +else + socat_listen="TCP-LISTEN" +fi + if [[ ${cfg[socat_only]} == true ]]; then echo "[INFO] listening directly via socat, assuming no ncat available" echo "[HTTP] listening on ${cfg[ip]}:${cfg[port]}" if [[ ${cfg[dbg]} == true ]]; then - socat tcp-listen:${cfg[port]},bind=${cfg[ip]},fork "exec:bash -c \'src/server.sh ${cfg[debuggier]}\'" + socat $socat_listen:${cfg[port]},bind=${cfg[ip]},fork "exec:bash -c \'src/server.sh ${cfg[debuggier]}\'" else - socat tcp-listen:${cfg[port]},bind=${cfg[ip]},fork "exec:bash -c src/server.sh" 2>> /dev/null + socat $socat_listen:${cfg[port]},bind=${cfg[ip]},fork "exec:bash -c src/server.sh" 2>> /dev/null if [[ $? != 0 ]]; then echo "[WARN] socat quit with a non-zero status; Maybe the port is in use?" fi @@ -157,7 +163,7 @@ else ncat -i 600s -l -U "$socket" -c src/server.sh -k 2>> /dev/null done & fi - socat TCP-LISTEN:${cfg[port]},fork,bind=${cfg[ip]} UNIX-CLIENT:$socket & + socat $socat_listen:${cfg[port]},fork,bind=${cfg[ip]} UNIX-CLIENT:$socket & echo "[HTTP] listening on ${cfg[ip]}:${cfg[port]} through '$socket'" fi From 44c128289c1f10ba045a80b63d34b8f5c61d08ad Mon Sep 17 00:00:00 2001 From: sdomi Date: Sat, 13 Sep 2025 14:18:14 +0200 Subject: [PATCH 05/15] template: escape newlines on raw replace statements --- src/template.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/template.sh b/src/template.sh index e2f072c..2ca64ea 100755 --- a/src/template.sh +++ b/src/template.sh @@ -85,7 +85,7 @@ function render() { buf+="s${_tpl_ctrl}\{\{start $key\}\}.*\{\{end $key\}\}${_tpl_ctrl}\{\{$key\}\}${_tpl_ctrl};s${_tpl_ctrl}\{\{$key\}\}${_tpl_ctrl}$(tr -d "${_tpl_ctrl}" <<< "$value" | sed "s${_tpl_ctrl}{{start $key}}${_tpl_ctrl}${_tpl_ctrl};s${_tpl_ctrl}{{end $key}}${_tpl_ctrl}${_tpl_ctrl}")${_tpl_ctrl};" unset "$subtemplate" elif [[ "$key" == "@"* && "${ref["$key"]}" != '' ]]; then - local value="$(tr -d "${_tpl_ctrl}${_tpl_newline}" <<< "${ref["$key"]}" | sed -E 's/\&/�UwU�/g')" + local value="$(tr -d "${_tpl_ctrl}${_tpl_newline}" <<< "${ref["$key"]}" | tr '\n' "${_tpl_newline}" | sed -E 's/\&/�UwU�/g')" buf+="s${_tpl_ctrl}\{\{$key\}\}${_tpl_ctrl}${value}${_tpl_ctrl}g;" elif [[ "$key" == "-index" && "$3" == true ]]; then # foreach index mode buf+="s${_tpl_ctrl}\{\{\-index\}\}${_tpl_ctrl}${_index}${_tpl_ctrl}g;" From d563570d6fa76df7fd6947fcf78cf860ea5ce5c3 Mon Sep 17 00:00:00 2001 From: sdomi Date: Sun, 14 Sep 2025 12:18:38 +0200 Subject: [PATCH 06/15] template: fixes around handling nonexistant files --- src/template.sh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/template.sh b/src/template.sh index 2ca64ea..dab253f 100755 --- a/src/template.sh +++ b/src/template.sh @@ -8,11 +8,7 @@ function render() { local _tpl_ctrl=$'\02' local tplfile - _template_find_absolute_path "$2" - - if [[ ! "$tplfile" ]]; then - exit 1 # fail hard - fi + _template_find_absolute_path "$2" || exit 1 if [[ "$3" != true ]]; then local template="$(tr -d "${_tpl_newline}${_tpl_ctrl}" < "$tplfile" | sed 's/\&/�UwU�/g')" @@ -27,6 +23,7 @@ function render() { # recursion is currently unsupported here, i feel like it may break things? if [[ "$template" == *'{{#'* && "$3" != true ]]; then local subtemplate= + local _old_tplfile="$tplfile" while read key; do # below check prevents the loop loading itself as a template. # this is possibly not enough to prevent all recursions, but @@ -34,19 +31,20 @@ function render() { local i local IFS='' - _old_tplfile="$tplfile" - _template_find_absolute_path "$key" - if [[ "$(realpath "$tplfile")" == "$_old_tplfile" ]]; then + _template_find_absolute_path "$key" || continue + local tplfile_real="$(realpath "$tplfile")" + + if [[ "$tplfile_real" == "$_old_tplfile" ]]; then subtemplate+="s${_tpl_ctrl}\{\{\#$key\}\}${_tpl_ctrl}I cowardly refuse to endlessly recurse\!${_tpl_ctrl}g;" continue fi # don't even try to include files below httpsh's root - [[ "$(realpath "$tplfile")" != "$(dirname "$(realpath "${cfg[namespace]}")")"* ]] && continue - local input="$(tr -d "${_tpl_ctrl}${_tpl_newline}" < "$tplfile" | sed 's/\&/�UwU�/g')" + [[ "$tplfile_real" != "$(dirname "$(realpath "${cfg[namespace]}")")"* ]] && continue + local input="$(tr -d "${_tpl_ctrl}${_tpl_newline}" < "$tplfile_real" | sed 's/\&/�UwU�/g')" garbage+="$input"$'\n' input="$(tr $'\n' "${_tpl_newline}" <<< "$input")" # for another hack subtemplate+="s${_tpl_ctrl}\{\{\#$key\}\}${_tpl_ctrl}${input}${_tpl_ctrl};" - _template_find_special_uri "$(cat "$tplfile")" + _template_find_special_uri "$(cat "$tplfile_real")" done <<< "$(grep -Poh '{{#\K(.*?)(?=}})' <<< "$template")" buf+="${subtemplate}" @@ -140,19 +138,22 @@ function render() { # # _template_find_absolute_path(name) -> $tplfile _template_find_absolute_path() { + unset tplfile if [[ "$1" == /dev/stdin || "$1" == "/dev/fd/"* ]]; then tplfile="$1" + return elif [[ ! "${template_relative_paths}" ]]; then tplfile="${cfg[namespace]}/$1" + return else for (( i=0; i<${#template_relative_paths[@]}; i++ )); do if [[ -f "${template_relative_paths[i]}/$1" ]]; then tplfile="${template_relative_paths[i]}/$1" - break + return fi done fi - + return 1 } _template_uri_list=() From a656bc03e42e3ea65910219279b345e9bda3f3d5 Mon Sep 17 00:00:00 2001 From: sdomi Date: Sun, 14 Sep 2025 20:01:54 +0200 Subject: [PATCH 07/15] http.sh: very basic util implementation, for faster creation of out-of-band scripts --- http.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/http.sh b/http.sh index b3877ef..2f66e54 100755 --- a/http.sh +++ b/http.sh @@ -102,6 +102,21 @@ if [[ "$1" == 'shell' ]]; then exit 0 fi +if [[ -x "${cfg[namespace]}/util/${1}.sh" ]]; then + HTTPSH_SCRIPTNAME="$1" + shift + shopt -s extglob + source src/account.sh + source src/mail.sh + source src/mime.sh + source src/misc.sh + source src/notORM.sh + source src/template.sh + source "${cfg[namespace]}/config.sh" + source "${cfg[namespace]}/util/$HTTPSH_SCRIPTNAME.sh" + exit 0 +fi + cat <&2 _ _ _______ _______ _____ ______ _ _ | | | |_______|_______| _ \/ ___/| | | | From d3b0b23f6dc5e49b4bf38903f28ad1360cf285df Mon Sep 17 00:00:00 2001 From: sdomi Date: Sun, 14 Sep 2025 21:02:30 +0200 Subject: [PATCH 08/15] http.sh: support built-in utils --- http.sh | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/http.sh b/http.sh index 2f66e54..a5f5b80 100755 --- a/http.sh +++ b/http.sh @@ -102,21 +102,30 @@ if [[ "$1" == 'shell' ]]; then exit 0 fi -if [[ -x "${cfg[namespace]}/util/${1}.sh" ]]; then - HTTPSH_SCRIPTNAME="$1" - shift - shopt -s extglob - source src/account.sh - source src/mail.sh - source src/mime.sh - source src/misc.sh - source src/notORM.sh - source src/template.sh - source "${cfg[namespace]}/config.sh" - source "${cfg[namespace]}/util/$HTTPSH_SCRIPTNAME.sh" - exit 0 +if [[ "$1" == "utils" ]]; then # list all available utils + ls "${cfg[namespace]}/util/" fi +for path in "${cfg[namespace]}/util/" "src/util/"; do + if [[ -x "$path${1}.sh" ]]; then + HTTPSH_SCRIPTNAME="$1" + shift + shopt -s extglob + source src/account.sh + source src/mail.sh + source src/mime.sh + source src/misc.sh + source src/notORM.sh + source src/template.sh + source "${cfg[namespace]}/config.sh" + source "$path$HTTPSH_SCRIPTNAME.sh" + exit 0 + elif [[ -f "$path${1}.sh" ]]; then + echo "[WARN] util '$1' found, but not executable. Ignoring..." + fi +done +unset path + cat <&2 _ _ _______ _______ _____ ______ _ _ | | | |_______|_______| _ \/ ___/| | | | From 765ae292b953b7dcc5f3b86b2c419844a6993fbc Mon Sep 17 00:00:00 2001 From: sdomi Date: Sun, 14 Sep 2025 21:07:32 +0200 Subject: [PATCH 09/15] http.sh: implement sleeping well at night --- http.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/http.sh b/http.sh index a5f5b80..53995e0 100755 --- a/http.sh +++ b/http.sh @@ -107,8 +107,8 @@ if [[ "$1" == "utils" ]]; then # list all available utils fi for path in "${cfg[namespace]}/util/" "src/util/"; do - if [[ -x "$path${1}.sh" ]]; then - HTTPSH_SCRIPTNAME="$1" + HTTPSH_SCRIPTNAME="$(basename "$1")" + if [[ -x "$path$HTTPSH_SCRIPTNAME.sh" ]]; then shift shopt -s extglob source src/account.sh @@ -120,11 +120,11 @@ for path in "${cfg[namespace]}/util/" "src/util/"; do source "${cfg[namespace]}/config.sh" source "$path$HTTPSH_SCRIPTNAME.sh" exit 0 - elif [[ -f "$path${1}.sh" ]]; then - echo "[WARN] util '$1' found, but not executable. Ignoring..." + elif [[ -f "$path$HTTPSH_SCRIPTNAME.sh" ]]; then + echo "[WARN] util '$1' found, but not executable. Ignoring..." >&2 fi done -unset path +unset path HTTPSH_SCRIPTNAME cat <&2 _ _ _______ _______ _____ ______ _ _ From cc95f8613673a91f248d725398aa36370ee22483 Mon Sep 17 00:00:00 2001 From: sdomi Date: Sun, 14 Sep 2025 21:42:52 +0200 Subject: [PATCH 10/15] docs, http.sh: document util invocation --- README.md | 1 + docs/running.md | 3 +++ docs/util.md | 34 ++++++++++++++++++++++++++++++++++ http.sh | 4 +++- 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 docs/util.md diff --git a/README.md b/README.md index 843db46..d06583c 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ We have some guides and general documentation in the [docs](docs/) directory. Am - [Tests](docs/tests.md) - [HTTP Router](docs/router.md) - [Template engine](docs/template.md) +- [Script integrations](docs/util.md) - [List of security fixes](docs/sec-fixes/) ## Dependencies diff --git a/docs/running.md b/docs/running.md index f6df44b..b6cbc97 100644 --- a/docs/running.md +++ b/docs/running.md @@ -9,3 +9,6 @@ The arg parsing is a bit rudimentary atm. Assume only one option supported per i - `debug` shows stderr (useful for debugging) - `debuggier` shows stderr and calltrace - `shell` drops you into an environment practically equivalent to the runtime +- `utils` lists all available [utilities](./util.md) (scripts which integrate into the + standard HTTP.sh environment, but are strictly for CLI use. Useful for administrative tasks.) +- ` [params]` launches an utility, if it's available diff --git a/docs/util.md b/docs/util.md new file mode 100644 index 0000000..4b95f14 --- /dev/null +++ b/docs/util.md @@ -0,0 +1,34 @@ +# utils: integrating scripts with http.sh + +HTTP.sh provides a number of useful APIs designed to make interfacing with HTTP and browsers easier. +Some of those (especially notORM) are also useful in a CLI environment, to help with migrations and +other administrative tasks. + +Utils integrate into HTTP.sh through calling the main script, with the utility name as the first +parameter. So, for `meow.sh` the invocation would be `./http.sh meow`, or `./http.sh meow [params]` +if the util takes any parameters. + +Utils are automagically started within the environment, and otherwise work like normal scripts. +Of note: + +- `$0` is always the `./http.sh` invocation, not your script name +- script name is instead stored in `$HTTPSH_SCRIPTNAME` +- `$@` contain parameters to the utility, not a full invocation. +- at the present, only the `master.sh` config is loaded +- the environment is equivalent to `./http.sh shell` + +A list of utilities can be obtained by calling `./http.sh utils`. + +## Built-in utils + +The following scripts are generic helpers shipped with HTTP.sh. We hope they'll come in handy. + +### notORM + +WIP. Currently can only dump a store out to the terminal: + +```bash +$ ./http.sh notORM dump storage/new.dat +declare -a data=([0]="0" [1]="domi" [2]="http://sdomi.pl/" [3]="" [4]="XOaj44smtzCg1p88fgG7bEnMeTNt361wK8Up4BKEiU747lcNIuMAez60zEiAaALWMwzcQ6" [5]="0" [6]="meow~" [7]="RCszUuBXQI") + (…) +``` diff --git a/http.sh b/http.sh index 53995e0..92b871c 100755 --- a/http.sh +++ b/http.sh @@ -103,7 +103,9 @@ if [[ "$1" == 'shell' ]]; then fi if [[ "$1" == "utils" ]]; then # list all available utils - ls "${cfg[namespace]}/util/" + # would be cool to make this more generic + ls "${cfg[namespace]}/util/" "src/util" + exit 0 fi for path in "${cfg[namespace]}/util/" "src/util/"; do From a60245bb4c30ceea34cbd4ed2c487c9677c64f84 Mon Sep 17 00:00:00 2001 From: sdomi Date: Sun, 14 Sep 2025 21:43:10 +0200 Subject: [PATCH 11/15] util/notORM: new util --- src/util/notORM.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 src/util/notORM.sh diff --git a/src/util/notORM.sh b/src/util/notORM.sh new file mode 100755 index 0000000..27a9120 --- /dev/null +++ b/src/util/notORM.sh @@ -0,0 +1,11 @@ +#!/bin/bash +if [[ ! "$1" ]]; then + echo "usage: $0 $HTTPSH_SCRIPTNAME [params] + +Action can be one of: + dump - dump the contents of a notORM store" + exit 1 +elif [[ "$1" == dump ]]; then + x() { declare -p data; } + data_iter "$2" { } x +fi From 8bd34c98232563542d2fbcb69c5e325bdfbc9342 Mon Sep 17 00:00:00 2001 From: sdomi Date: Sun, 14 Sep 2025 21:52:25 +0200 Subject: [PATCH 12/15] util/bump: new util --- http.sh | 7 ++++++- src/util/bump.sh | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 src/util/bump.sh diff --git a/http.sh b/http.sh index 92b871c..34a9cab 100755 --- a/http.sh +++ b/http.sh @@ -59,7 +59,12 @@ fi source config/master.sh if [[ "$HTTPSH_VERSION" != "${cfg[init_version]}" ]]; then - echo "WARN: HTTP.sh was updated since this instance was initialized (config v${cfg[init_version]:-(none)}, runtime v$HTTPSH_VERSION). There may be breaking changes. Edit cfg[init_version] in config/master.sh to remove this warning." + echo "WARN: HTTP.sh was updated since this instance was initialized (config v${cfg[init_version]:-(none)}, runtime v$HTTPSH_VERSION). There may be breaking changes. + +Check for breaking changes (announced on IRC and in `git log`), +then use this to ACK the message: + +./http.sh bump" fi while read i; do diff --git a/src/util/bump.sh b/src/util/bump.sh new file mode 100755 index 0000000..7db026b --- /dev/null +++ b/src/util/bump.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if [[ "$HTTPSH_VERSION" != "${cfg[init_version]}" ]]; then + sed -i '/cfg\[init_version\]=/d' config/master.sh + echo "cfg[init_version]=$HTTPSH_VERSION" >> "config/master.sh" + echo "Version bumped. I hope you checked for breaking changes!" +else + echo "All good! :3" +fi From e10d927d2dd8943cd958fbe6770cf017fcc914f2 Mon Sep 17 00:00:00 2001 From: sdomi Date: Sun, 14 Sep 2025 22:00:59 +0200 Subject: [PATCH 13/15] docs: mention bump util and future plans --- docs/util.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/util.md b/docs/util.md index 4b95f14..b11dc2c 100644 --- a/docs/util.md +++ b/docs/util.md @@ -32,3 +32,14 @@ $ ./http.sh notORM dump storage/new.dat declare -a data=([0]="0" [1]="domi" [2]="http://sdomi.pl/" [3]="" [4]="XOaj44smtzCg1p88fgG7bEnMeTNt361wK8Up4BKEiU747lcNIuMAez60zEiAaALWMwzcQ6" [5]="0" [6]="meow~" [7]="RCszUuBXQI") (…) ``` + +### bump + +Acknowledges a version after a HTTP.sh update. Takes no parameters. + +## Future plans + +- List a description for each util on the `./http.sh utils` page. This would require storing more + metadata on the utils, TBD. +- more 1st-party utils! +- more work on notORM util, ideally it should allow one to do all actions on the DB From e45eef0f586f7c36b7f6cf81ece335e2023e5361 Mon Sep 17 00:00:00 2001 From: sdomi Date: Sun, 14 Sep 2025 22:02:04 +0200 Subject: [PATCH 14/15] version: bump to 0.97.3 --- src/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.sh b/src/version.sh index c290b98..3285da3 100644 --- a/src/version.sh +++ b/src/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -HTTPSH_VERSION=0.97.2 +HTTPSH_VERSION=0.97.3 From ea129b83501240d1f0995c65260e415aa70b75d4 Mon Sep 17 00:00:00 2001 From: sdomi Date: Mon, 15 Sep 2025 02:07:58 +0200 Subject: [PATCH 15/15] notORM: fix mangling the `r` array, leading to unexplainable logic issues ideally we should figure out a consistent prefix for variables, or at least stop using single-letter names... TBD --- src/notORM.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notORM.sh b/src/notORM.sh index 887f741..4ca7ba9 100755 --- a/src/notORM.sh +++ b/src/notORM.sh @@ -190,7 +190,7 @@ data_iter() { [[ ! -f "$1" ]] && return 4 local store="$1" local IFS=$'\n' - local r=2 + local _r=2 if [[ "$2" == '{' ]]; then _data_parse_pairs @@ -216,10 +216,10 @@ data_iter() { done "$callback" # only reached if an entry matched all constraints [[ $? == 255 ]] && return 255 - r=0 + _r=0 done < "$store" - return $r + return $_r } # replace a value in `store` with `array`, filtering by `search`.