[mew-dist 19750] final CRLF

Tatsuya Kinoshita tats at example.com
2001年 12月 4日 (火) 10:15:22 JST


POPで受信する際にメール末尾の改行文字が削られないよう、修正しました。

RFC 1939を見るかぎり、"CRLF.CRLF"ではなく".CRLF"の行を除外するの
が正しいのだと思います。

RFC 1939:

> 3. Basic Operation

>    Responses to certain commands are multi-line.  In these cases, which
>    are clearly indicated below, after sending the first line of the
>    response and a CRLF, any additional lines are sent, each terminated
>    by a CRLF pair.  When all lines of the response have been sent, a
>    final line is sent, consisting of a termination octet (decimal code
>    046, ".") and a CRLF pair.  If any line of the multi-line response
>    begins with the termination octet, the line is "byte-stuffed" by
>    pre-pending the termination octet to that line of the response.
>    Hence a multi-line response is terminated with the five octets
>    "CRLF.CRLF".  When examining a multi-line response, the client checks
>    to see if the line begins with the termination octet.  If so and if
>    octets other than CRLF follow, the first octet of the line (the
>    termination octet) is stripped away.  If so and if CRLF immediately
>    follows the termination character, then the response from the POP
>    server is ended and the line containing ".CRLF" is not considered
>    part of the multi-line response.

P.S. SMTPについてはRFC 2821で加筆されたみたい。

-- 
木下達也
-------------- next part --------------

 This patch is written by Tatsuya Kinoshita.  Copyright is disclaimed.

*** mew.orig/mew-pop.el	Fri Nov  9 07:09:03 2001
--- mew/mew-pop.el	Tue Dec  4 09:45:02 2001
***************
*** 784,793 ****
      (when (string= mew-cs-eol "\r\n")
        (goto-char (point-min))
        (while (search-forward "\r\n" nil t) (replace-match "\n" nil t)))
!     ;; deleting \n.\n
      (goto-char (point-max))
!     (forward-line -2)
!     (end-of-line)
      (delete-region (point) (point-max))
      ;; unescape ^.
      (goto-char (point-min))
--- 784,792 ----
      (when (string= mew-cs-eol "\r\n")
        (goto-char (point-min))
        (while (search-forward "\r\n" nil t) (replace-match "\n" nil t)))
!     ;; deleting .\n
      (goto-char (point-max))
!     (forward-line -1)
      (delete-region (point) (point-max))
      ;; unescape ^.
      (goto-char (point-min))


Mew-dist メーリングリストの案内