From e31ba53ca571e917f2b6c885449e9f2731b90988 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 30 May 2020 16:54:30 -0500 Subject: Remove port number from parsed authority When navigating to a link with the port included, request_url doesn't do the right thing. For now I've changed the code in transform_resource to remove the port from the authority field, but that is probably not the right place to put it. I'm going to deal with this later though. --- bollux | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bollux b/bollux index c938abe..2e0aa0e 100755 --- a/bollux +++ b/bollux @@ -206,7 +206,8 @@ transform_resource() { # transform_resource BASE_URL REFERENCE_URL # cf. 5.3 -- recomposition local r="" isdefined "T[scheme]" && r="$r${T[scheme]}:" - isdefined "T[authority]" && r="$r//${T[authority]}" + # remove the port from the authority + isdefined "T[authority]" && r="$r//${T[authority]%:*}" r="$r${T[path]}" isdefined T[query] && r="$r?${T[query]}" isdefined T[fragment] && r="$r#${T[fragment]}" @@ -343,7 +344,10 @@ handle_response() { REDIRECTS=0 die "$((100 + code))" "$code" ;; - *) die "$((100 + code)) Unknown response code: $code." ;; + *) + [[ -z "${code-}" ]] && die 100 "Empty response code." + die "$((100 + code)) Unknown response code: $code." + ;; esac } -- cgit 1.4.1-21-gabe81