]> cat aescling's git repositories - httpd-execline.git/commitdiff
httpd.execline: style: flatten resource logic
authorcat æscling <11325618-aescling@users.noreply.gitlab.com>
Thu, 27 Jul 2023 04:50:16 +0000 (00:50 -0400)
committercat æscling <11325618-aescling@users.noreply.gitlab.com>
Thu, 27 Jul 2023 04:53:58 +0000 (00:53 -0400)
visible-to-httpd/binaries/httpd.execline

index 028d82195c6c0d3a431c676586beec68d948d5a6..24f6fc5bf58b9d9a15b7e1ce842f7641b5f80e3b 100755 (executable)
@@ -58,24 +58,20 @@ if -X -n -t {
        backtick -n resource {
                cd supported_domains
 
-               backtick -E -n candidate_resource {
-                       backtick -E -n without_dot_and_dot_dot {
-                               backtick -E -n without_query_string {
-                                       case -N -- ${requested_resource} {
-                                               "(.*)[?#].*" {
-                                                       elgetpositionals
-                                                       s6-echo -n -- ${1}
-                                               }
-                                       }
-                                       s6-echo -n -- ${requested_resource}
+               backtick -E -n without_query_string {
+                       case -N -- ${requested_resource} {
+                               "(.*)[?#].*" {
+                                       elgetpositionals
+                                       s6-echo -n -- ${1}
                                }
-                               pipeline { clean-dot-directories.execline ${without_query_string} }
-                               urlencode -d
                        }
-
-                       # include the hostname in the final resource name
-                       s6-echo -n -- ${hostname}/${without_dot_and_dot_dot}
+                       s6-echo -n -- ${requested_resource}
+               }
+               backtick -E -n without_dot_and_dot_dot {
+                       pipeline { clean-dot-directories.execline ${without_query_string} }
+                       urlencode -d
                }
+               define candidate_resource ${hostname}/${without_dot_and_dot_dot}
 
                # `${directory}` -> `${directory}/index.xhtml`  
                ifelse { eltest -d \${candidate_resource} }