]> gitweb.factorcode.org Git - factor.git/commitdiff
gopher: fix gopher urls to include the type character properly.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 26 Oct 2016 22:41:54 +0000 (15:41 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 26 Oct 2016 23:49:22 +0000 (16:49 -0700)
extra/gopher/gopher.factor

index 32d81cf3786c23fc20f94091b1d79a0a1aa9ba7a..c450e386763868e6e4a2acaa6172386a21856c8b 100644 (file)
@@ -40,12 +40,9 @@ CONSTANT: A_PLUS_MOVIE CHAR: ;
 CONSTANT: A_PLUS_SOUND CHAR: <
 
 : gopher-get ( selector -- item-type byte-array )
-    "/" split1 "" or
-    [ dup length 1 > [ string>number ] [ first ] if ]
-    [
-        "?" split1 [ "\t" glue ] when*
-        "\r\n" append utf8 encode write flush contents
-    ] bi* ;
+    "/" split1 "" or [ first ] dip
+    "?" split1 [ "\t" glue ] when*
+    "\r\n" append utf8 encode write flush contents ;
 
 PRIVATE>
 
@@ -78,7 +75,7 @@ M: gopher-link >url
     ] [
         {
             [ host>> ] [ port>> ] [ type>> ] [ selector>> ]
-        } cleave "gopher://%s:%s/%s%s" sprintf
+        } cleave "gopher://%s:%s/%c%s" sprintf
     ] if >url ;
 
 : gopher-link. ( gopher-link -- )