diff options
| author | 2012-06-03 23:49:14 +0200 | |
|---|---|---|
| committer | 2012-06-03 23:49:14 +0200 | |
| commit | a08ae0c9a77d315cffc1e7101a17acbb1eaa71df (patch) | |
| tree | cc4830d2d5a1c337b9069d2c5e1d993193793b1b | |
| parent | 085b4c76ef55c5d1470be826d436d3c991982bba (diff) | |
| download | tekuti-a08ae0c9a77d315cffc1e7101a17acbb1eaa71df.tar.gz tekuti-a08ae0c9a77d315cffc1e7101a17acbb1eaa71df.zip | |
make urlish? less -ish
* tekuti/util.scm (urlish?): Use string->uri.
| -rw-r--r-- | tekuti/util.scm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tekuti/util.scm b/tekuti/util.scm index 176fc5b..e77d255 100644 --- a/tekuti/util.scm +++ b/tekuti/util.scm @@ -28,6 +28,7 @@ #:use-module (tekuti match-bind) #:use-module (srfi srfi-1) #:use-module (srfi srfi-19) + #:use-module (web uri) #:export (with-output-to-string* with-input-from-string* expanduser match-lines dbg unwind-protect dsu-sort hash-push! list-has-length? list-head-match mapn filter-mapn @@ -59,10 +60,11 @@ ;; hacky #fragment interpreting... (define (urlish? x) - (match-bind "^https?://([a-zA-Z0-9-]+\\.)+[a-zA-Z]+(/[a-zA-Z0-9$_.+!*'(),;/?:#@&=-]*)?$" - x (_ . args) - x - #f)) + (let ((uri (string->uri x))) + (and uri + (memq (uri-scheme uri) '(http https)) + (uri-host uri) + #t))) ;; bad name relative to mapn... (define (foldn kons n knil values) |
