telnet urls
This commit is contained in:
@@ -18,6 +18,7 @@ Improvements over the original Bopher from that post:
|
||||
- ability to accept `gopher://` URLs from the command line
|
||||
- ability to save the URL to the currently viewed resource into the stash text file
|
||||
- ability to force-download pages instead of viewing regardless of their type
|
||||
- ability to display 8-type Gophermap entries as `telnet://` URIs (not opening anything for security reasons)
|
||||
|
||||
"Pure Bash" means any external commands must only be used if absolutely required. For now, Bopher-NG only depends on three external commands (all POSIX-compliant):
|
||||
|
||||
|
||||
+4
-1
@@ -12,6 +12,7 @@
|
||||
# - ability to accept gopher:// URLs from the command line
|
||||
# - ability to save the URL to the currently viewed resource into the stash text file
|
||||
# - ability to force-download pages instead of viewing regardless of their type
|
||||
# - displaying type 8 entries (as per RFC1436) as the telnet:// URI scheme
|
||||
|
||||
# save the command line parameters
|
||||
|
||||
@@ -100,11 +101,13 @@ gmparse() { # args: line, curhost, curport
|
||||
[[ -z "$rhost" ]] && rhost="$2" # fill in the missing hostname
|
||||
[[ -z "$rport" ]] && rport="$3" # fill in the missing port number
|
||||
local action='D' # all unknown types are set to download
|
||||
if [[ 'i' == "$rtype" || '3' == "$rtype" || 'h' == "$rtype" ]]; then # handle information lines
|
||||
if [[ 'i' == "$rtype" || '3' == "$rtype" || 'h' == "$rtype" || '8' == "$rtype" ]]; then # handle information lines
|
||||
action='E'
|
||||
[[ '3' == "$rtype" ]] && desc="$ERRCOLOR$desc$ERESET" # wrap error messages in the coloration terminal commands
|
||||
# handle external URLs as information lines of a special kind
|
||||
[[ 'h' == "$rtype" ]] && desc="$desc: ${sel#URL:}"
|
||||
# handle 8-type resources as telnet:// URIs
|
||||
[[ '8' == "$rtype" ]] && desc="$desc: telnet://${sel}@${rhost}:${rport}/"
|
||||
fi
|
||||
[[ '0' == "$rtype" ]] && action='P' # plain text is plain text
|
||||
[[ '1' == "$rtype" ]] && action='M' # it's a Gophermap
|
||||
|
||||
Reference in New Issue
Block a user