home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!chx400!sicsun!disuns2!disuns2.epfl.ch!simon
- From: simon@lia.di.epfl.ch (Simon Leinen)
- Newsgroups: gnu.emacs.gnus
- Subject: missing CRs in NNTP communication (RFC violation)
- Message-ID: <SIMON.92Jul30124258@liasg1.epfl.ch>
- Date: 30 Jul 92 10:42:58 GMT
- Sender: news@disuns2.epfl.ch
- Organization: DI-LIA -- Ecole Polytechnique Federale de Lausanne
- Lines: 60
- Nntp-Posting-Host: liasg1.epfl.ch
- X-Md4-Signature: 870626cb5828e09f03067e3e23ee6389
-
- Testing GNUS against a new NNTP implementation, I found that GNUS
- fails to terminate the lines it sends to the remote NNTP server
- correctly. RFC 977 states:
-
- 272 Each command line must be terminated by a CR-LF (Carriage Return -
- 273 Line Feed) pair.
- [...]
-
- For lines of posted articles this requirement is not stated
- explicitly, but the server I tested required CRLFs even there (this
- has been fixed now).
-
- My fix was to replace two functions in nntp.el to insert proper CRLF
- sequences before sending lines to the NNTP process. Tested on Lucid
- GNU Emacs 19.2 with C-News 1.5.11 and VMNNTP.
- --
- Simon.
-
- (defun nntp-encode-text ()
- "Encode text in current buffer for NNTP transmission.
- 1. Insert additional `.' at beginning of lines that start with a dot.
- 2. Insert CRs at the end of lines that don't have it already.
- 3. Insert `.' at end of buffer (end of text mark)."
- (save-excursion
- ;; Insert newline at end of buffer.
- (goto-char (point-max))
- (if (not (bolp))
- (insert "\n"))
- ;; Replace `.' at beginning of line with `..'.
- (goto-char (point-min))
- ;; (replace-regexp "^\\." "..")
- (while (search-forward "\n" nil t)
- (if (or (= (match-beginning 0) (point-min))
- (not (eq (char-after (1- (match-beginning 0))) 13)))
- (progn
- (forward-char -1)
- (insert "\r")
- (forward-char 1)))
- (if (looking-at "\\.")
- (insert ".")))
- ;; Insert `.' at end of buffer (end of text mark).
- (goto-char (point-max))
- (insert ".\r\n")
- ))
-
- (defun nntp-send-strings-to-server (&rest strings)
- "Send list of STRINGS to news server as command and its arguments."
- (let ((cmd (car strings))
- (strings (cdr strings)))
- ;; Command and each argument must be separeted by one or more spaces.
- (while strings
- (setq cmd (concat cmd " " (car strings)))
- (setq strings (cdr strings)))
- ;; Make sure the connection hasn't been closed on us.
- (or (nntp-server-opened)
- (nntp-restart-connection))
- ;; Command line must be terminated by a CR-LF.
- (nntp-trace "SEND [%s]" cmd)
- (process-send-string nntp-server-process (concat cmd "\r\n"))
- ))
-