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