annotate lisp/w3/url-ns.el @ 169:15872534500d r20-3b11

Import from CVS: tag r20-3b11
author cvs
date Mon, 13 Aug 2007 09:46:53 +0200
parents d2f30a177268
children 3d6bfa290dbd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
1 ;;; url-ns.el --- Various netscape-ish functions for proxy definitions
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
2 ;; Author: wmperry
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
3 ;; Created: 1997/06/29 22:51:33
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
4 ;; Version: 1.3
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
5 ;; Keywords: comm, data, processes, hypermedia
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
6
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
8 ;;; Copyright (c) 1997 Free Software Foundation, Inc.
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
9 ;;;
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
10 ;;; This file is not part of GNU Emacs, but the same permissions apply.
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
11 ;;;
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
13 ;;; it under the terms of the GNU General Public License as published by
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
14 ;;; the Free Software Foundation; either version 2, or (at your option)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
15 ;;; any later version.
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
16 ;;;
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
17 ;;; GNU Emacs is distributed in the hope that it will be useful,
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
20 ;;; GNU General Public License for more details.
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
21 ;;;
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
22 ;;; You should have received a copy of the GNU General Public License
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
24 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
25 ;;; Boston, MA 02111-1307, USA.
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
27
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
28 (require 'url-gw)
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
29
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
30 (defun isPlainHostName (host)
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 44
diff changeset
31 (not (string-match "\\." host)))
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
32
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
33 (defun dnsDomainIs (host dom)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
34 (setq host (url-gateway-nslookup-host host))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
35 (string-match (concat (regexp-quote dom) "$") host))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
36
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
37 (defun dnsResolve (host)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
38 (url-gateway-nslookup-host host))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
39
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
40 (defun isResolvable (host)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
41 (if (string-match "^[0-9.]+$" host)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
42 t
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
43 (not (string= host (url-gateway-nslookup-host host)))))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
45 (defun isInNet (ip net mask)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
46 (let ((netc (split-string ip "\\."))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
47 (ipc (split-string net "\\."))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
48 (maskc (split-string mask "\\.")))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
49 (if (or (/= (length netc) (length ipc))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
50 (/= (length ipc) (length maskc)))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
51 nil
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
52 (setq netc (mapcar 'string-to-int netc)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
53 ipc (mapcar 'string-to-int ipc)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
54 maskc (mapcar 'string-to-int maskc))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
55 (and
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
56 (= (logand (nth 0 netc) (nth 0 maskc))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
57 (logand (nth 0 ipc) (nth 0 maskc)))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
58 (= (logand (nth 1 netc) (nth 1 maskc))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
59 (logand (nth 1 ipc) (nth 1 maskc)))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
60 (= (logand (nth 2 netc) (nth 2 maskc))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
61 (logand (nth 2 ipc) (nth 2 maskc)))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
62 (= (logand (nth 3 netc) (nth 3 maskc))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
63 (logand (nth 3 ipc) (nth 3 maskc)))))))
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
64
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents:
diff changeset
65 (provide 'url-ns)