Commit c46e2ea5 authored by David Byers's avatar David Byers
Browse files

Bug fixes in HTML formatting code.

Initial support for extra headers and authentication in HTTP proxy code
parent 784f3a5c
2000-03-03 David Byers <davby@ida.liu.se>
* lyskom-rest.el (lyskom-w3-region): Save restriction, make start
and end markers so that simplifying the body tag won't screw
things up.
* startup.el (lyskom-www-proxy-connect-filter): Match HTTP/1.1
responses (and also 1.2 and 1.3 and so on.)
(lyskom): Send additional headers to HTTP proxy.
* vars.el.in (kom-www-proxy-headers): New variable.
2000-02-26 <davby@ida.liu.se>
* option-edit.el (lyskom-ispell-dictionary-widget): Protect this
......
......@@ -3,6 +3,15 @@
Att göra i elisp-klienten
=========================
* INTRESSANTA SAKER
** Man vill kunna skicka user-agent och proxy-authorization till
HTTP-proxyn. Se specen för HTTP 1.1, kapitel 11 och RFC 2069.
ftp://ftp.isi.edu/in-notes/rfc2616.txt
ftp://ftp.isi.edu/in-notes/rfc261y.txt
* SHOWSTOPPERS
** Martin, hade vissa problem med inställningarna. User-arean såg OK
......
......@@ -823,22 +823,23 @@ The position lyskom-last-viewed will always remain visible."
(defun lyskom-do-insert (string)
(let ((start (point)))
(insert string)
(let ((bounds (next-text-property-bounds 1 (max 1 (1- start))
'special-insert))
(next (make-marker))
(fn nil))
(while bounds
(set-marker next (cdr bounds))
(setq fn (get-text-property (car bounds) 'special-insert))
(remove-text-properties (car bounds) (cdr bounds)
'(special-insert))
(condition-case val
(funcall fn (car bounds) (cdr bounds))
(error (apply 'message "%S" val)))
(setq start next)
(setq bounds (next-text-property-bounds 1 start
'special-insert))))
))
(condition-case var
(let ((bounds (next-text-property-bounds 1 (max (point-min) (1- start))
'special-insert))
(next (make-marker))
(fn nil))
(while bounds
(set-marker next (cdr bounds))
(setq fn (get-text-property (car bounds) 'special-insert))
(remove-text-properties (car bounds) (cdr bounds)
'(special-insert))
(condition-case val
(funcall fn (car bounds) (cdr bounds))
(error (apply 'message "%S" val)))
(setq start next)
(setq bounds (next-text-property-bounds 1 start
'special-insert))))
(error nil))))
......@@ -1683,18 +1684,21 @@ in lyskom-messages."
(lyskom-external-function w3-finish-drawing)
(defun lyskom-w3-region (start end)
(unwind-protect
(condition-case nil
(progn
(narrow-to-region start end)
(when kom-w3-simplify-body
(save-excursion
(let ((case-fold-search t))
(goto-char start)
(while (re-search-forward "<body[^>]*>" end t)
(replace-match "<body>")))))
(w3-region start end)
(w3-finish-drawing)
(add-text-properties (point-min) (point-max) '(end-closed nil)))
(condition-case var
(save-restriction
(let ((buffer-read-only nil))
(setq start (set-marker (make-marker) start))
(setq end (set-marker (make-marker) end))
(narrow-to-region start end)
(when kom-w3-simplify-body
(save-excursion
(let ((case-fold-search t))
(goto-char start)
(while (re-search-forward "<body[^>]*>" end t)
(replace-match "<body>")))))
(w3-region start end)
(w3-finish-drawing)
(add-text-properties (point-min) (point-max) '(end-closed nil))))
(error nil))))
......
......@@ -147,7 +147,8 @@ See lyskom-mode for details."
(proxy-host nil)
(proxy-port nil)
(match (string-match "\\(.*\\):\\([0-9]+\\)"
(or proxy-host-string ""))))
(or proxy-host-string "")))
(headers nil))
(setq proxy-host (or (and match
(match-string 1 proxy-host-string))
proxy-host-string)
......@@ -157,6 +158,17 @@ See lyskom-mode for details."
proxy-host-string)))
80))
(cond (proxy-host
(setq headers
(cond ((stringp kom-www-proxy-headers)
(list kom-www-proxy-headers))
((and (listp kom-www-proxy-headers)
(stringp (car kom-www-proxy-headers)))
kom-www-proxy-headers)
((and (listp kom-www-proxy-headers)
(consp (car kom-www-proxy-headers)))
(cdr (or (lyskom-string-assoc proxy-host
kom-www-proxy-headers)
(assq t kom-www-proxy-headers))))))
(setq proc (open-network-stream name buffer
proxy-host
proxy-port))
......@@ -172,11 +184,16 @@ See lyskom-mode for details."
(lyskom-process-send-string
proc
(format "\
CONNECT %s:%d HTTP/1.0\r\n\
\r\n"
(format "CONNECT %s:%d HTTP/1.0\r\n"
host port))
(mapcar (lambda (header)
(lyskom-process-send-string proc header)
(lyskom-process-send-string proc "\r\n"))
headers)
(lyskom-process-send-string proc "\r\n")
;; Now wait for the answer from the proxy
;;
;; This is because anything we send before the
......@@ -285,7 +302,7 @@ CONNECT %s:%d HTTP/1.0\r\n\
(lyskom-debug-insert proc "-----> " output))
(cond
((and (= lyskom-www-proxy-connect-phase 1)
(string-match "^HTTP/1.0 200.*\r\n" output))
(string-match "^HTTP/1\\.. 200.*\r\n" output))
(setq lyskom-www-proxy-connect-phase 2)
;; safety check: see if the empty line is already in this output
(lyskom-www-proxy-connect-filter proc output))
......
......@@ -872,6 +872,19 @@ A proxy specification has the form \"HOST:PORT\" where HOST is the
host name of the proxy and PORT is the port to connect to. The :PORT
part is optional. If it is not specified, port 80 is assumed.")
(def-kom-var kom-www-proxy-headers
"User-Agent: Mozilla/4.7C-CCK-MCD [en] (X11; I; SunOS 5.6 sun4u)"
"*Headers to send to the proxy when connecting to LysKOM through a WWW
proxy. The value of this variable should either be a single string, which
is sent verbatim to the proxy, or a list of strings which will be sent to
the proxy separated by CRLF, or a list of elements like (NAME H1 H2 ... Hn)
where NAME is the name of a proxy and the remaining elements are headers
to send when connecting through that proxy.
Do not use this variable for proxy authentication.")
(def-kom-var kom-server-aliases
'(("kom.lysator.liu.se" . "LysKOM")
("kom.ludd.luth.se" . "LuddKOM")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment