annotate lisp/w3/url-gw.el @ 118:7d55a9ba150c r20-1b11

Import from CVS: tag r20-1b11
author cvs
date Mon, 13 Aug 2007 09:24:17 +0200
parents 9f59509498e1
children 9b50b4588a93
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
1 ;;; url-gw.el --- Gateway munging for URL loading
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
2 ;; Author: wmperry
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
3 ;; Created: 1997/03/27 21:29:24
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
4 ;; Version: 1.8
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
5 ;; Keywords: comm, data, processes
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
6
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
8 ;;; Copyright (c) 1997 Free Software Foundation, Inc.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
9 ;;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
10 ;;; This file is not part of GNU Emacs, but the same permissions apply.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
11 ;;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
13 ;;; it under the terms of the GNU General Public License as published by
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
14 ;;; the Free Software Foundation; either version 2, or (at your option)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
15 ;;; any later version.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
16 ;;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
17 ;;; GNU Emacs is distributed in the hope that it will be useful,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
20 ;;; GNU General Public License for more details.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
21 ;;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
22 ;;; You should have received a copy of the GNU General Public License
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
24 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
25 ;;; Boston, MA 02111-1307, USA.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
27 (require 'cl)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
28
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
29 (defvar url-gateway-local-host-regexp nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
30 "*A regular expression specifying local hostnames/machines.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
31
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
32 (defvar url-gateway-prompt-pattern
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
33 "^[^#$%>;]*[#$%>;] *" ;; "bash\\|\$ *\r?$\\|> *\r?"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
34 "*A regular expression matching a shell prompt.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
35
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
36 (defvar url-gateway-rlogin-host nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
37 "*What hostname to actually rlog into before doing a telnet.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
38
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
39 (defvar url-gateway-rlogin-user-name nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
40 "*Username to log into the remote machine with when using rlogin.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
41
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
42 (defvar url-gateway-rlogin-parameters '("telnet" "-8")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
43 "*Parameters to `url-open-rlogin'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
44 This list will be used as the parameter list given to rsh.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
45
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
46 (defvar url-gateway-telnet-host nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
47 "*What hostname to actually login to before doing a telnet.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
48
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
49 (defvar url-gateway-telnet-parameters '("exec" "telnet" "-8")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
50 "*Parameters to `url-open-telnet'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
51 This list will be executed as a command after logging in via telnet.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
52
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
53 (defvar url-gateway-telnet-login-prompt "^\r*.?login:"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
54 "*Prompt that tells us we should send our username when loggin in w/telnet.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
55
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
56 (defvar url-gateway-telnet-password-prompt "^\r*.?password:"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
57 "*Prompt that tells us we should send our password when loggin in w/telnet.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
58
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
59 (defvar url-gateway-telnet-user-name nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
60 "User name to log in via telnet with.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
61
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
62 (defvar url-gateway-telnet-password nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
63 "Password to use to log in via telnet with.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
64
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
65 (defvar url-gateway-broken-resolution nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
66 "*Whether to use nslookup to resolve hostnames.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
67 This should be used when your version of Emacs cannot correctly use DNS,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
68 but your machine can. This usually happens if you are running a statically
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
69 linked Emacs under SunOS 4.x")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
70
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
71 (defvar url-gateway-nslookup-program "nslookup"
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
72 "*If non-NIL then a string naming nslookup program." )
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
73
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
74 ;; Stolen from ange-ftp
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
75 ;;;###autoload
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
76 (defun url-gateway-nslookup-host (host)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
77 "Attempt to resolve the given HOSTNAME using nslookup if possible."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
78 (interactive "sHost: ")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
79 (if url-gateway-nslookup-program
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
80 (let ((proc (start-process " *nslookup*" " *nslookup*"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
81 url-gateway-nslookup-program host))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
82 (res host))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
83 (process-kill-without-query proc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
84 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
85 (set-buffer (process-buffer proc))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
86 (while (memq (process-status proc) '(run open))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
87 (accept-process-output proc))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
88 (goto-char (point-min))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
89 (if (re-search-forward "Name:.*\nAddress: *\\(.*\\)$" nil t)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
90 (setq res (buffer-substring (match-beginning 1)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
91 (match-end 1))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
92 (kill-buffer (current-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
93 res)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
94 host))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
95
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
96 ;; Stolen from red gnus nntp.el
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
97 (defun url-wait-for-string (regexp proc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
98 "Wait until string arrives in the buffer."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
99 (let ((buf (current-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
100 (goto-char (point-min))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
101 (while (not (re-search-forward regexp nil t))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
102 (accept-process-output proc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
103 (set-buffer buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
104 (goto-char (point-min)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
105
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
106 ;; Stolen from red gnus nntp.el
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
107 (defun url-open-rlogin (name buffer host service)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
108 "Open a connection using rsh."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
109 (if (not (stringp service))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
110 (setq service (int-to-string service)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
111 (let ((proc (if url-gateway-rlogin-user-name
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
112 (start-process
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
113 name buffer "rsh"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
114 url-gateway-rlogin-host "-l" url-gateway-rlogin-user-name
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
115 (mapconcat 'identity
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
116 (append url-gateway-rlogin-parameters
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
117 (list host service)) " "))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
118 (start-process
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
119 name buffer "rsh" url-gateway-rlogin-host
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
120 (mapconcat 'identity
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
121 (append url-gateway-rlogin-parameters
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
122 (list host service))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
123 " ")))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
124 (set-buffer buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
125 (url-wait-for-string "^\r*200" proc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
126 (beginning-of-line)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
127 (delete-region (point-min) (point))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
128 proc))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
129
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
130 ;; Stolen from red gnus nntp.el
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
131 (defun url-open-telnet (name buffer host service)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
132 (if (not (stringp service))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
133 (setq service (int-to-string service)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
134 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
135 (set-buffer (get-buffer-create buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
136 (erase-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
137 (let ((proc (start-process name buffer "telnet" "-8"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
138 (case-fold-search t))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
139 (when (memq (process-status proc) '(open run))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
140 (process-send-string proc "set escape \^X\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
141 (process-send-string proc (concat
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
142 "open " url-gateway-telnet-host "\n"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
143 (url-wait-for-string url-gateway-telnet-login-prompt proc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
144 (process-send-string
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
145 proc (concat
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
146 (or url-gateway-telnet-user-name
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
147 (setq url-gateway-telnet-user-name (read-string "login: ")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
148 "\n"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
149 (url-wait-for-string url-gateway-telnet-password-prompt proc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
150 (process-send-string
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
151 proc (concat
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
152 (or url-gateway-telnet-password
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
153 (setq url-gateway-telnet-password
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
154 (funcall url-passwd-entry-func "Password: ")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
155 "\n"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
156 (erase-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
157 (url-wait-for-string url-gateway-prompt-pattern proc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
158 (process-send-string
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
159 proc (concat (mapconcat 'identity
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
160 (append url-gateway-telnet-parameters
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
161 (list host service)) " ") "\n"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
162 (url-wait-for-string "^\r*Escape character.*\r*\n+" proc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
163 (delete-region (point-min) (match-end 0))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
164 (process-send-string proc "\^]\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
165 (url-wait-for-string "^telnet" proc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
166 (process-send-string proc "mode character\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
167 (accept-process-output proc 1)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
168 (sit-for 1)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
169 (goto-char (point-min))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
170 (forward-line 1)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
171 (delete-region (point) (point-max)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
172 proc)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
173
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
174 ;;###autoload
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
175 (defun url-open-stream (name buffer host service)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
176 "Open a stream to a host"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
177 (let ((gw-method (if (and url-gateway-local-host-regexp
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
178 (not (eq 'ssl url-gateway-method))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
179 (string-match
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
180 url-gateway-local-host-regexp
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
181 host))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
182 'native
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
183 url-gateway-method))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
184 ;; This hack is for OS/2 Emacs so that it will not do bogus CRLF
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
185 ;; conversions while trying to be 'helpful'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
186 (tcp-binary-process-output-services (if (stringp service)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
187 (list service)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
188 (list service
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
189 (int-to-string service))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
190
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
191 ;; An attempt to deal with denied connections, and attempt to reconnect
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
192 (cur-retries 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
193 (retry t)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
194 (errobj nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
195 (conn nil))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
196
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
197 ;; If the user told us to do DNS for them, do it.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
198 (if url-gateway-broken-resolution
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
199 (setq host (url-gateway-nslookup-host host)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
200
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
201 (condition-case errobj
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
202 (setq conn (case gw-method
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
203 (ssl
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
204 (open-ssl-stream name buffer host service))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
205 ((tcp native)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
206 (and (eq 'tcp gw-method) (require 'tcp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
207 (open-network-stream name buffer host service))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
208 (socks
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
209 (socks-open-network-stream name buffer host service))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
210 (telnet
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
211 (url-open-telnet name buffer host service))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
212 (rlogin
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
213 (url-open-rlogin name buffer host service))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
214 (otherwise
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
215 (error "Bad setting of url-gateway-method: %s"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
216 url-gateway-method))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
217 (error
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
218 (insert "Could not contact host: " host " / "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
219 (if (stringp service) service (int-to-string service))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
220 "\nAttempted using gateway method: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
221 (symbol-name gw-method)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
222 "\n---- Error was: ----\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
223 (setq url-current-mime-headers '(("content-type" . "text/plain")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
224 (display-error errobj (current-buffer))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
225 (if conn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
226 (mule-inhibit-code-conversion conn))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 16
diff changeset
227 conn))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
228
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
229 (provide 'url-gw)