Do not convert to a real URI but a string, to avoid adding slashes to paths - holymoly - A tor enabled gopher client written in CHICKEN scheme
(HTM) git clone git://vernunftzentrum.de/holymoly.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit bef86b5fc6c6f72808291feaf6bc2797537177bc
(DIR) parent 8ac8bea87387ce3d2d5851c18ca7aff2f502cd25
(HTM) Author: Christian Kellermann <ckeen@pestilenz.org>
Date: Wed, 15 Aug 2018 10:27:44 +0200
Do not convert to a real URI but a string, to avoid adding slashes to paths
Diffstat:
holymoly.scm | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
---
(DIR) diff --git a/holymoly.scm b/holymoly.scm
@@ -89,7 +89,7 @@
(renderer (car l))))
(when (and use-cursor (= (+ pos i) (current-cursor cursor)))
(let ((e (list-ref lines (+ pos i))))
- (new-status "~a" (uri->string (entry->uri e))))
+ (new-status "~a" (entry->string e)))
(mvwchgat win i 0 -1 A_STANDOUT 0 #f))
(draw (cdr l) (add1 i))))
(wrefresh win)
@@ -128,7 +128,7 @@
(prev-cursor! cursor)
(adjust-cursor!)))))) ; backspace
((113) (k 'quit)) ; q
- ((#x47 #x67) (k (uri->entry (get-user-input "New uri:" (uri->string (entry->uri (current-page)))))) pos) ; G
+ ((#x47 #x67) (k (uri->entry (get-user-input "New uri:" (entry->string (current-page))))) pos) ; G
(else pos)))))))))
(define (get-user-input #!optional (prompt "Enter query:") (suggestion ""))
@@ -322,7 +322,7 @@
(alist-ref (entry-type e) type-handlers)
(lambda (c) (save-selector e c))))
(next (begin
- (new-status "~a" (uri->string (entry->uri e)))
+ (new-status "~a" (entry->string e))
(handler res))))
(new-status "~a" next)
(cond
@@ -339,12 +339,12 @@
(selector (string-intersperse (drop path 2) "/")))
(make-entry type "" selector server port '())))
-(define (entry->uri e)
- (make-uri scheme: "gopher"
- host: (entry-host e)
- port: (entry-port e)
- path: (append `(/ ,(type->string (entry-type e))
- ,@(string-split (entry-selector e) "/")))))
+(define (entry->string e)
+ (sprintf "gopher://~a:~a/~a"
+ (entry-host e)
+ (entry-port e)
+ (string-append (type->string (entry-type e))
+ (entry-selector e))))
(define (main args)
(initscr)