1
;;;; www/main.scm: general WWW navigation aids.
3
(define-module (www main)
7
;;;; Copyright (C) 1997 Free Software Foundation, Inc.
9
;;;; This program is free software; you can redistribute it and/or modify
10
;;;; it under the terms of the GNU General Public License as published by
11
;;;; the Free Software Foundation; either version 2, or (at your option)
12
;;;; any later version.
14
;;;; This program is distributed in the hope that it will be useful,
15
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
;;;; GNU General Public License for more details.
19
;;;; You should have received a copy of the GNU General Public License
20
;;;; along with this software; see the file COPYING. If not, write to
21
;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22
;;;; Boston, MA 02111-1307 USA
25
(define dispatch-table
26
(acons 'http http:get '()))
29
;;; parse a URL into portions, open a connection, and retrieve
32
(define-public (www:set-protocol-handler! proto handler)
34
(assq-set! dispatch-table proto handler)))
36
(define-public (www:get url-str)
37
(let ((url (url:parse url-str)))
38
;; get handler for this protocol
39
(case (url:scheme url)
40
((http) (let ((msg (http:get url)))
41
(http:message-body msg)))
43
(let ((handle (assq-ref dispatch-table (url:scheme url))))
45
(handle (url:host url)
48
(error "unknown URL scheme" (url:scheme url))))))))