emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

url issues


From: Dave Love
Subject: url issues
Date: Thu, 08 Apr 2004 11:46:07 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

The url files need attention to the headers.  They need the CVS
keyword bits removed and replaced by proper Author lines, &c.  I
assume Maintainer should be changed to FSF.  Also, the copyright
boilerplate isn't in the standard form.

You need to import ssl.el and socks.el from w3 for https and socks
gateway support.

url-ldap.el seems to need serious attention to make it work with the
Emacs ldap.el, which I either didn't realize or remember.  See the
Fixme comment.  Perhaps the ldap.el maintainer could take a look.

There are still some compilation warnings which I haven't fixed,
including one for `assoc-ignore-case' which lacks a NEWS entry.

Here's a collection of changes, some of which I've had lying around
for a while and others I've just spotted.

2004-04-08  Dave Love  <address@hidden>

        * url/url-mailto.el (mail-send-and-exit, message-send-and-exit):
        Autoload.

        * url/url-file.el (url-file-build-filename): Don't use
        directory-sep-char.

        * url/url-auth.el (url-register-auth-scheme): Fix `format' call.

        * url/url-about.el (url-scheme-registry): Defvar.
        (url-about): Use text/plain.

        * url/url-vars.el (cl): Don't require.
        (url): Add :version.
        (url-bug-address): Use bug-gnu-emacs.

        * url/url-util.el (url-hexify-string): Don't give multibyte error
        for char <16.
        (mail-header-extract): Autoload.

        * url/url-parse.el: Doc fixes.

        * url/url-ldap.el (ldap): Require.
        (url-ldap): Fix `format' call.
        (url-ldap-certificate-formatter): Avoid warning.

        * url/url-https.el (url-https-create-secure-wrapper): Use modern
        backquotes.

        * url/url-dav.el (url-dav-rename-file): Fix args of `signal'.
        (url-intersection): New.
        (url-dav-supported-p): Use it.
        (url-dav-save-resource): Declare url-http-response-status special.

        * url/url-cache.el (url-util): Require.

Index: lisp/url/url-about.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-about.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-about.el
--- lisp/url/url-about.el       4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-about.el       8 Apr 2004 10:36:29 -0000
@@ -45,6 +45,8 @@
                  (put 'url-extension-protocols 'schemes schemes)
                  schemes)))))
 
+(defvar url-scheme-registry)
+
 (defun url-about-protocols (url)
   (url-probe-protocols)
   (insert "<html>\n"
@@ -92,7 +94,7 @@
     (if (fboundp func)
        (progn
          (set-buffer (generate-new-buffer " *about-data*"))
-         (insert "Content-type: text/html\n\n")
+         (insert "Content-type: text/plain\n\n")
          (funcall func url)
          (current-buffer))
       (error "URL does not know about `%s'" item))))
Index: lisp/url/url-auth.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-auth.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-auth.el
--- lisp/url/url-auth.el        4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-auth.el        8 Apr 2004 10:36:29 -0000
@@ -301,9 +301,9 @@ RATING   a rating between 1 and 10 of th
         (node (assoc type url-registered-auth-schemes)))
     (if (not (fboundp function))
        (url-warn 'security
-                 (format (eval-when-compile
-                           "Tried to register `%s' as an auth scheme"
-                           ", but it is not a function!") function)))
+                 (format (concat
+                          "Tried to register `%s' as an auth scheme"
+                          ", but it is not a function!") function)))
 
     (if node
        (setcdr node (cons function rating))
Index: lisp/url/url-cache.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-cache.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-cache.el
--- lisp/url/url-cache.el       4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-cache.el       8 Apr 2004 10:36:29 -0000
@@ -26,6 +26,7 @@
 ;;; Boston, MA 02111-1307, USA.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (require 'url-parse)
+(require 'url-util)
 
 (defcustom url-cache-directory
   (expand-file-name "cache" url-configuration-directory)
@@ -141,7 +142,7 @@ FILE can be created or overwritten."
 
 (defun url-cache-create-filename-using-md5 (url)
   "Create a cached filename using MD5.
- Very fast if you are in XEmacs, suitably fast otherwise."
+Very fast if you have an `md5' primitive function, suitably fast otherwise."
   (require 'md5)
   (if url
       (let* ((url (if (vectorp url) (url-recreate-url url) url))
Index: lisp/url/url-cookie.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-cookie.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-cookie.el
--- lisp/url/url-cookie.el      4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-cookie.el      8 Apr 2004 10:36:29 -0000
@@ -441,6 +441,10 @@ to run the `url-cookie-setup-save-timer'
   :type 'integer
   :group 'url)
 
+;; Warning removal:
+(autoload 'delete-itimer "itimer")
+(autoload 'start-itimer "itimer")
+
 ;;;###autoload
 (defun url-cookie-setup-save-timer ()
   "Reset the cookie saver timer."
Index: lisp/url/url-dav.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-dav.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-dav.el
--- lisp/url/url-dav.el 4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-dav.el 8 Apr 2004 10:36:29 -0000
@@ -22,6 +22,8 @@
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;; DAV is in RFC 2518.
+
 (eval-when-compile
   (require 'cl))
 
@@ -32,12 +34,23 @@
 (defvar url-dav-supported-protocols '(1 2)
   "List of supported DAV versions.")
 
+(defun url-intersection (l1 l2)
+  "Return a list of the elements occuring in both of the lists L1 and L2."
+  (if (null l2)
+      l2
+    (let (result)
+      (while l1
+       (if (member (car l1) l2)
+           (setq result (cons (pop l1) result))
+         (pop l1)))
+      (nreverse result))))
+
 ;;;###autoload
 (defun url-dav-supported-p (url)
   (and (featurep 'xml)
        (fboundp 'xml-expand-namespace)
-       (intersection url-dav-supported-protocols
-                    (plist-get (url-http-options url) 'dav))))
+       (url-intersection url-dav-supported-protocols
+                        (plist-get (url-http-options url) 'dav))))
 
 (defun url-dav-node-text (node)
   "Return the text data from the XML node NODE."
@@ -613,6 +626,8 @@ Returns `t' iff the lock was successfull
         (url-debug 'dav "Unrecognized DAV:locktype (%S)" (car lock)))))
     modes))
 
+(autoload 'url-http-head-file-attributes "url-http")
+
 ;;;###autoload
 (defun url-dav-file-attributes (url)
   (let ((properties (cdar (url-dav-get-properties url)))
@@ -674,6 +689,7 @@ Returns `t' iff the lock was successfull
   "Save OBJ as URL using WebDAV.
 URL must be a fully qualified URL.
 OBJ may be a buffer or a string."
+  (declare (special url-http-response-status))
   (let ((buffer nil)
        (result nil)
        (url-request-extra-headers nil)
@@ -861,7 +877,9 @@ If NOSORT is non-nil, the list is not so
 (defun url-dav-rename-file (oldname newname &optional overwrite)
   (if (not (and (string-match url-handler-regexp oldname)
                (string-match url-handler-regexp newname)))
-      (signal 'file-error "Cannot rename between different URL backends" 
oldname newname))
+      (signal 'file-error
+             (list "Cannot rename between different URL backends"
+                   oldname newname)))
 
   (let* ((headers nil)
         (props nil)
Index: lisp/url/url-file.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-file.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-file.el
--- lisp/url/url-file.el        4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-file.el        8 Apr 2004 10:36:29 -0000
@@ -126,10 +126,14 @@ to them."
     ;; directory-sep-char as its separator?  Would it be safer to just
     ;; use '/' unconditionally and rely on the FTP server to
     ;; straighten it out for us?
+;;     (if (and (file-directory-p filename)
+;;          (not (string-match (format "%c$" directory-sep-char) filename)))
+;;     (url-set-filename url
+;;                       (format "%s%c" filename directory-sep-char)))
     (if (and (file-directory-p filename)
-            (not (string-match (format "%c$" directory-sep-char) filename)))
-       (url-set-filename url
-                         (format "%s%c" filename directory-sep-char)))
+            (not (string-match "/$" filename)))
+       (url-set-filename url (format "%s/" filename)))
+
 
     ;; If it is a directory, look for an index file first.
     (if (and (file-directory-p filename)
Index: lisp/url/url-history.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-history.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-history.el
--- lisp/url/url-history.el     4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-history.el     8 Apr 2004 10:36:29 -0000
@@ -80,6 +80,11 @@ to run the `url-history-setup-save-timer
   "Hash table for global history completion.")
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Warning avoidance:
+(autoload 'delete-itimer "itimer")
+(autoload 'start-itimer "itimer")
+
 ;;;###autoload
 (defun url-history-setup-save-timer ()
   "Reset the history list timer."
Index: lisp/url/url-https.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-https.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-https.el
--- lisp/url/url-https.el       4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-https.el       8 Apr 2004 10:36:29 -0000
@@ -36,14 +36,14 @@
 (defalias 'url-https-expand-file-name 'url-http-expand-file-name)
 
 (defmacro url-https-create-secure-wrapper (method args)
-  (` (defun (, (intern (format (if method "url-https-%s" "url-https") 
method))) (, args)
-       (, (format "HTTPS wrapper around `%s' call." (or method "url-http")))
-       (condition-case ()
-          (require 'ssl)
-        (error
-         (error "HTTPS support could not find `ssl' library.")))
-       (let ((url-gateway-method 'ssl))
-        ((, (intern (format (if method "url-http-%s" "url-http") method))) (,@ 
(remove '&rest (remove '&optional args))))))))
+  `(defun ,(intern (format (if method "url-https-%s" "url-https") method)) 
,args
+    ,(format "HTTPS wrapper around `%s' call." (or method "url-http"))
+    (condition-case ()
+       (require 'ssl)
+      (error
+       (error "HTTPS support could not find `ssl' library")))
+    (let ((url-gateway-method 'ssl))
+      ( ,(intern (format (if method "url-http-%s" "url-http") method)) 
,@(remove '&rest (remove '&optional args))))))
 
 (url-https-create-secure-wrapper nil (url callback cbargs))
 (url-https-create-secure-wrapper file-exists-p (url))
Index: lisp/url/url-ldap.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-ldap.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-ldap.el
--- lisp/url/url-ldap.el        4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-ldap.el        8 Apr 2004 10:36:29 -0000
@@ -28,6 +28,7 @@
 (require 'url-vars)
 (require 'url-parse)
 (require 'url-util)
+(require 'ldap)
 
 ;; This has been implemented from RFC2255 'The LDAP URL Format' (Dec 1997)
 ;;
@@ -38,7 +39,7 @@
 ;; ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US
 ;;
 ;; For simple queries, I have verified compatibility with Netscape
-;; Communicator v4.5 under linux.
+;; Communicator v4.5 under GNU/Linux.
 ;;
 ;; For anything _useful_ though, like specifying the attributes,
 ;; scope, filter, or extensions, netscape claims the URL format is
@@ -95,8 +96,8 @@
   (condition-case ()
       (require 'ssl)
     (error nil))
-  (let ((vals (and (fboundp 'ssl-certificate-information)
-                  (ssl-certificate-information data))))
+  (let ((vals (if (fboundp 'ssl-certificate-information)
+                 (ssl-certificate-information data))))
     (if (not vals)
        "<b>Unable to parse certificate</b>"
       (concat "<table border=0>\n"
@@ -110,6 +111,7 @@
   (format "<img alt='JPEG Photo' src='data:image/jpeg;base64,%s'>" 
          (url-hexify-string (base64-encode-string data))))
 
+;; Fixme: This needs sorting out for the Emacs LDAP functions, specifically 
calls of ldap-open, ldap-close, ldap-search-internal
 ;;;###autoload
 (defun url-ldap (url)
   (save-excursion
@@ -213,7 +215,7 @@
                                    "</td></tr>\n")
                          ;; Multiple matches, slightly uglier
                          (insert "   <tr>\n"
-                                 (format "    <td valign=top>" (length (cdr 
attr)))
+                                 (format "    <td valign=top>")
                                  (url-ldap-attribute-pretty-name (car attr)) 
"</td><td>"
                                  (mapconcat (lambda (x)
                                               (url-ldap-attribute-pretty-desc 
(car attr) x))
Index: lisp/url/url-mailto.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-mailto.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-mailto.el
--- lisp/url/url-mailto.el      4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-mailto.el      8 Apr 2004 10:36:29 -0000
@@ -61,6 +61,10 @@
        (save-excursion
          (insert "\n"))))))
 
+;; Warning avoidance.
+(autoload 'mail-send-and-exit "sendmail")
+(autoload 'message-send-and-exit "sendmail")
+
 ;;;###autoload
 (defun url-mailto (url)
   "Handle the mailto: URL syntax."
Index: lisp/url/url-news.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-news.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-news.el
--- lisp/url/url-news.el        4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-news.el        8 Apr 2004 10:36:29 -0000
@@ -76,7 +76,7 @@
                "   </p>\n"
                "   <p>\n"
                "    If you If you feel this is an error, <a href=\""
-               "mailto:"; url-bug-address "\">send me mail</a>\n"
+               "mailto:"; url-bug-address "\">send mail</a>\n"
                "   </p>\n"
                "  </div>\n"
                " </body>\n"
@@ -92,7 +92,7 @@
   (if (string-match "/+$" newsgroup)
       (setq newsgroup (substring newsgroup 0 (match-beginning 0))))
 
-  ;; This saves us from checking new news if GNUS is already running
+  ;; This saves us from checking new news if Gnus is already running
   ;; FIXME - is it relatively safe to use gnus-alive-p here? FIXME
   (if (or (not (get-buffer gnus-group-buffer))
          (save-excursion
Index: lisp/url/url-parse.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-parse.el,v
retrieving revision 1.3
diff -u -p -r1.3 url-parse.el
--- lisp/url/url-parse.el       4 Apr 2004 04:44:10 -0000       1.3
+++ lisp/url/url-parse.el       8 Apr 2004 10:36:29 -0000
@@ -87,6 +87,7 @@
   
 ;;;###autoload
 (defun url-recreate-url (urlobj)
+  "Recreate a URL string from the parsed URLOBJ."
   (concat (url-type urlobj) ":" (if (url-host urlobj) "//" "")
          (if (url-user urlobj)
              (concat (url-user urlobj)
@@ -114,7 +115,7 @@
 (defun url-generic-parse-url (url)
   "Return a vector of the parts of URL.
 Format is:
-\[proto username password hostname portnumber file reference attributes 
fullp\]"
+\[TYPE USER PASSWORD HOST PORT FILE TARGET ATTRIBUTES FULL\]"
   (cond
    ((null url)
     (make-vector 9 nil))
Index: lisp/url/url-util.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-util.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-util.el
--- lisp/url/url-util.el        4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-util.el        8 Apr 2004 10:36:29 -0000
@@ -29,6 +29,7 @@
 (require 'url-parse)
 (autoload 'timezone-parse-date "timezone")
 (autoload 'timezone-make-date-arpa-standard "timezone")
+(autoload 'mail-header-extract "mailheader")
 
 (defvar url-parse-args-syntax-table
   (copy-syntax-table emacs-lisp-mode-syntax-table)
@@ -294,9 +295,28 @@ Will not do anything if url-show-status 
        (+ 10 (- x ?A)))
     (- x ?0)))
 
+;; Fixme: Is this definition better, and does it ever matter?
+
+;; (defun url-unhex-string (str &optional allow-newlines)
+;;   "Remove %XX, embedded spaces, etc in a url.
+;; If optional second argument ALLOW-NEWLINES is non-nil, then allow the
+;; decoding of carriage returns and line feeds in the string, which is normally
+;; forbidden in URL encoding."
+;;   (setq str (or str ""))
+;;   (setq str (replace-regexp-in-string "%[[:xdigit:]]\\{2\\}"
+;;                                   (lambda (match)
+;;                                     (string (string-to-number
+;;                                              (substring match 1) 16)))
+;;                                   str t t))
+;;   (if allow-newlines
+;;       (replace-regexp-in-string "[\n\r]" (lambda (match)
+;;                                        (format "%%%.2X" (aref match 0)))
+;;                             str t t)
+;;     str))
+
 ;;;###autoload
 (defun url-unhex-string (str &optional allow-newlines)
-  "Remove %XXX embedded spaces, etc in a url.
+  "Remove %XX embedded spaces, etc in a url.
 If optional second argument ALLOW-NEWLINES is non-nil, then allow the
 decoding of carriage returns and line feeds in the string, which is normally
 forbidden in URL encoding."
@@ -336,11 +356,9 @@ This is taken from RFC 2396.")
    (lambda (char)
      ;; Fixme: use a char table instead.
      (if (not (memq char url-unreserved-chars))
-        (if (< char 16)
-            (format "%%0%X" char)
-          (if (> char 255)
-              (error "Hexifying multibyte character %s" str))
-          (format "%%%X" char))
+        (if (> char 255)
+              (error "Hexifying multibyte character %s" str)
+          (format "%%%02X" char))
        (char-to-string char)))
    str ""))
 
Index: lisp/url/url-vars.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-vars.el,v
retrieving revision 1.2
diff -u -p -r1.2 url-vars.el
--- lisp/url/url-vars.el        4 Apr 2004 04:44:10 -0000       1.2
+++ lisp/url/url-vars.el        8 Apr 2004 10:36:29 -0000
@@ -27,7 +27,6 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (require 'mm-util)
-(eval-when-compile (require 'cl))
 
 (defconst url-version (let ((x "$State: Exp $"))
                        (if (string-match "State: \\([^ \t\n]+\\)" x)
@@ -37,6 +36,7 @@
 
 (defgroup url nil
   "Uniform Resource Locator tool"
+  :version "21.4"
   :group 'hypermedia)
 
 (defgroup url-file nil
@@ -100,7 +100,7 @@ the second time is 'too old' when compar
   :type 'function
   :group 'url-cache)
 
-(defvar url-bug-address "address@hidden"
+(defconst url-bug-address "address@hidden"
   "Where to send bug reports.")
 
 (defcustom url-personal-mail-address nil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]