Commit 4bb69f69 authored by Jan Idzikowski's avatar Jan Idzikowski

FIX cl-smtp::rfc2045-q-encode-string-to-stream

 - correct dot masking, see rfc5321 4.5.2
   "Before sending a line of mail text, the SMTP client checks the
    first character of the line.  If it is a period, one additional
    period is inserted at the beginning of the line."
 - add test rfc2045-q-encode-string-to-stream-6
parent f49b923c
Version 20170920.1
2017.09.20
Fix error in rfc2045-q-encode-string-to-stream
correct dot masking (rfc5321 4.5.2), add new test rfc2045-q-encode-string-to-stream-6
Thanks Jocelyn Fréchot for the bug report
Change cl-smtp.asd, cl-smtp.lisp, tests.lisp CHANGELOG
Version 20151023.2
2015.10.23
Fix error with newlines in header strings.
......
......@@ -21,7 +21,7 @@
:licence "LLGPL"
:author "Jan Idzikowski <jidzikowski@common-lisp.net>"
:maintainer "Jan Idzikowski <jidzikowski@common-lisp.net>"
:version "20151023.2"
:version "20170920.1"
:perform (load-op :after (op webpage)
(pushnew :cl-smtp cl:*features*))
:depends-on (:usocket
......
......@@ -120,8 +120,8 @@
(write-blank-line stream)
(setf last-line-break n))
(cond
((and (char= c #\.) (or (= n 0) (= (1- n) last-line-break))
(or (eq nc #\Return) (eq nc #\Newline) (not nc)))
((and (char= c #\.) (or (= n 0) (= (1- n) last-line-break)
(= last-line-break columns)))
(write-char #\. stream)
(write-char #\. stream))
((char= c #\NewLine)
......
......@@ -59,7 +59,15 @@ n !"
(rfc2045-q-encode-string-to-stream
str s :external-format :latin-1 :columns 64))))
(assert qstr)
(assert (string-equal qstr (format nil "check of masked dots.~C~C..~C~C.end" #\Return #\Newline #\Return #\Newline)))))
(assert (string-equal qstr (format nil "check of masked dots.~C~C..~C~C..end" #\Return #\Newline #\Return #\Newline)))))
(define-cl-smtp-test "rfc2045-q-encode-string-to-stream-6" ()
(let* ((str (format nil "check of masked dot at last column 12345678901234567890123456789.~A~ALAST LINE" #\Newline #\Newline))
(qstr (with-output-to-string (s)
(rfc2045-q-encode-string-to-stream
str s :external-format :latin-1 :columns 64))))
(assert qstr)
(assert (string-equal qstr (format nil "check of masked dot at last column 12345678901234567890123456789=~C~C..~C~C~C~CLAST LINE" #\Return #\Newline #\Return #\Newline #\Return #\Newline)))))
(define-cl-smtp-test "string-has-non-ascii-1" ()
(assert (string-has-non-ascii "test Ü ende")))
......
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