]> gitweb.factorcode.org Git - factor.git/commitdiff
urls: allow pathnames to convert >url.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 23 Oct 2012 03:16:19 +0000 (20:16 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 23 Oct 2012 03:16:19 +0000 (20:16 -0700)
basis/urls/urls.factor

index f7881b13a7f86da8fda8a6b31644acb17402ea54..c36b8b08296a43995fe6bfc87b67d7f6a946cd16 100644 (file)
@@ -1,10 +1,11 @@
 ! Copyright (C) 2008, 2011 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel ascii combinators combinators.short-circuit
-sequences splitting fry namespaces make assocs arrays strings
-io.sockets io.encodings.string io.encodings.utf8 math
-math.parser accessors parser strings.parser lexer
-hashtables present peg.ebnf urls.encoding ;
+
+USING: accessors arrays assocs combinators fry hashtables
+io.pathnames io.sockets kernel lexer make math.parser
+namespaces peg.ebnf present sequences splitting strings
+strings.parser urls.encoding vocabs.loader ;
+
 IN: urls
 
 TUPLE: url protocol username password host port path query anchor ;
@@ -84,6 +85,8 @@ M: string >url
     } cleave
     dup host>> [ [ "/" or ] change-path ] when ;
 
+M: pathname >url string>> >url ;
+
 : protocol-port ( protocol -- port )
     {
         { "http" [ 80 ] }
@@ -192,7 +195,5 @@ PRIVATE>
 ! Literal syntax
 SYNTAX: URL" lexer get skip-blank parse-string >url suffix! ;
 
-USE: vocabs.loader
-
 { "urls" "prettyprint" } "urls.prettyprint" require-when
 { "urls" "io.sockets.secure" } "urls.secure" require-when