1 ;;; url-misc.el --- Misc Uniform Resource Locator retrieval code
2 ;; Keywords: comm, data, processes
4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5 ;;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
6 ;;; Copyright (c) 1996, 97, 98, 99, 2002 Free Software Foundation, Inc.
8 ;;; This file is part of GNU Emacs.
10 ;;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;;; it under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 2, or (at your option)
13 ;;; any later version.
15 ;;; GNU Emacs is distributed in the hope that it will be useful,
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;;; Boston, MA 02111-1307, USA.
24 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 (autoload 'Info-goto-node
"info" "" t
)
29 (autoload 'man
"man" nil t
)
33 "Fetch a Unix manual page URL."
34 (man (url-filename url
))
39 "Fetch a GNU Info URL."
41 (let* ((fname (url-filename url
))
42 (node (url-unhex-string (or (url-target url
) "Top"))))
44 (Info-goto-node (concat "(" fname
")" node
))
45 (error "Malformed url: %s" (url-recreate-url url
)))
48 (defun url-do-terminal-emulator (type server port user
)
50 (generate-new-buffer (format "%s%s" (if user
(concat user
"@") "") server
))
56 (error "Unknown terminal emulator required: %s" type
)))
60 (list server
"-l" user
)
63 (if user
(message "Please log in as user: %s" user
))
68 (if user
(message "Please log in as user: %s" user
))
72 (defun url-generic-emulator-loader (url)
73 (let* ((type (intern (downcase (url-type url
))))
74 (server (url-host url
))
76 (port (url-port url
)))
77 (url-do-terminal-emulator type server port name
))
81 (defalias 'url-rlogin
'url-generic-emulator-loader
)
83 (defalias 'url-telnet
'url-generic-emulator-loader
)
85 (defalias 'url-tn3270
'url-generic-emulator-loader
)
90 "Fetch a data URL (RFC 2397)."
92 ;; The mediatype may need to be hex-encoded too -- see the RFC.
93 (desc (url-unhex-string (url-filename url
)))
97 (if (not (string-match "\\([^,]*\\)?," desc
))
98 (error "Malformed data URL: %s" desc
)
99 (setq mediatype
(match-string 1 desc
))
100 (if (and mediatype
(string-match ";base64\\'" mediatype
))
101 (setq mediatype
(substring mediatype
0 (match-beginning 0))
103 (if (or (null mediatype
)
104 (eq ?\
; (aref mediatype 0)))
105 (setq mediatype
(concat "text/plain" mediatype
)))
106 (setq data
(url-unhex-string (substring desc
(match-end 0)))))
107 (set-buffer (generate-new-buffer " *url-data*"))
108 (mm-disable-multibyte)
109 (insert (format "Content-Length: %d\n" (length data
))
110 "Content-Type: " mediatype
"\n"
111 "Content-Encoding: " encoding
"\n"
113 (if data
(insert data
))
118 ;;; arch-tag: 8c544e1b-d8bc-40a6-b319-f1f37fef65a0