Browse code
2008-04-28 Ahmon Dancy <dancy@dancy>
layer authored on 21/05/2008 21:01:56
Showing 3 changed files
Showing 3 changed files
... | ... |
@@ -1,3 +1,11 @@ |
1 |
+2008-05-21 Ahmon Dancy <dancy@dancy> |
|
2 |
+ |
|
3 |
+ * bug17849: Fix parse-mime-structure behavior when it |
|
4 |
+ encounters malformatted headers. Now treats a malformatted |
|
5 |
+ header as the first line of the body. |
|
6 |
+ |
|
7 |
+ Commented out an extraneous debug message. |
|
8 |
+ |
|
1 | 9 |
2007-09-24 Ahmon Dancy <dancy@dancy> |
2 | 10 |
|
3 | 11 |
* rfe7462: rfc2822.cl: further improvements |
... | ... |
@@ -1,6 +1,7 @@ |
1 | 1 |
#+(version= 8 1) |
2 |
-(sys:defpatch "mime" 1 |
|
3 |
- "v1: changes to internal/undocumented portions of module." |
|
2 |
+(sys:defpatch "mime" 2 |
|
3 |
+ "v1: changes to internal/undocumented portions of module; |
|
4 |
+v2: better parse-mime-structure behavior in the face of malformatted headers." |
|
4 | 5 |
:type :system |
5 | 6 |
:post-loadable t) |
6 | 7 |
|
... | ... |
@@ -13,7 +14,6 @@ v3: add mime structure parsing support." |
13 | 14 |
:type :system |
14 | 15 |
:post-loadable t) |
15 | 16 |
|
16 |
-#+(version= 7 0) |
|
17 | 17 |
(sys:defpatch "mime" 2 |
18 | 18 |
"v0: New module. See documentation.; |
19 | 19 |
v1: Improve default transfer encoding determination; |
... | ... |
@@ -40,7 +40,7 @@ v2: make-mime-part: Default external-format is :utf8." |
40 | 40 |
;; merchantability or fitness for a particular purpose. See the GNU |
41 | 41 |
;; Lesser General Public License for more details. |
42 | 42 |
;; |
43 |
-;; $Id: mime-api.cl,v 1.8 2007/08/02 18:14:31 layer Exp $ |
|
43 |
+;; $Id: mime-api.cl,v 1.9 2008/05/21 21:01:56 layer Exp $ |
|
44 | 44 |
|
45 | 45 |
(defpackage :net.post-office |
46 | 46 |
(:use #:lisp #:excl) |
... | ... |
@@ -14,7 +14,7 @@ |
14 | 14 |
;; merchantability or fitness for a particular purpose. See the GNU |
15 | 15 |
;; Lesser General Public License for more details. |
16 | 16 |
;; |
17 |
-;; $Id: mime-parse.cl,v 1.7 2007/08/02 18:14:31 layer Exp $ |
|
17 |
+;; $Id: mime-parse.cl,v 1.8 2008/05/21 21:01:56 layer Exp $ |
|
18 | 18 |
|
19 | 19 |
(defpackage :net.post-office |
20 | 20 |
(:use #:lisp #:excl) |
... | ... |
@@ -73,7 +73,7 @@ |
73 | 73 |
(multiple-value-bind (part stop-reason newpos) |
74 | 74 |
(parse-mime-structure-1 stream nil nil 0 mbox :outer t) |
75 | 75 |
(when (and part mbox (not (eq stop-reason :eof))) |
76 |
- (format t "advancing to next mbox boundary~%") |
|
76 |
+ ;;(format t "advancing to next mbox boundary~%") |
|
77 | 77 |
(multiple-value-bind (x y z newpos2) |
78 | 78 |
(read-until-boundary stream nil newpos t) |
79 | 79 |
(declare (ignore x y z)) |
... | ... |
@@ -414,8 +414,7 @@ |
414 | 414 |
|
415 | 415 |
;; Returns offset of end of line in buffer. Or nil if EOF |
416 | 416 |
;; Second value is the number of characters read (including EOL chars) |
417 |
-;; This is slower than a read-line call, but in the long run can |
|
418 |
-;; lead to big savings in gc time. |
|
417 |
+ |
|
419 | 418 |
;: parse-headers, read-until-boundary, collect-message-data-from-mbox |
420 | 419 |
;: |
421 | 420 |
(defun mime-read-line (stream buffer) |
... | ... |
@@ -479,7 +478,7 @@ |
479 | 478 |
(loop |
480 | 479 |
(multiple-value-bind (end bytes) |
481 | 480 |
(mime-read-line stream line) |
482 |
- (declare (fixnum end)) |
|
481 |
+ (declare (fixnum end bytes)) |
|
483 | 482 |
|
484 | 483 |
(if (null end) ;; EOF |
485 | 484 |
(return)) |
... | ... |
@@ -500,8 +499,10 @@ |
500 | 499 |
(return)) |
501 | 500 |
|
502 | 501 |
((whitespace-char-p (schar line 0)) ;; Continuation line |
503 |
- (if (null current) ;; Malformed header line |
|
504 |
- (return)) |
|
502 |
+ (when (null current) ;; Malformed header line |
|
503 |
+ (decf count bytes) |
|
504 |
+ (mime-unread-line line end bytes) |
|
505 |
+ (return)) |
|
505 | 506 |
|
506 | 507 |
(let ((newcons (cons (subseq line 0 end) nil))) |
507 | 508 |
(setf (cdr lastcons) newcons) |
... | ... |
@@ -514,6 +515,7 @@ |
514 | 515 |
;; Malformed header line. Unread it (so that it |
515 | 516 |
;; will be treated as part of the body) and |
516 | 517 |
;; consider the headers terminated. |
518 |
+ (decf count bytes) |
|
517 | 519 |
(mime-unread-line line end bytes) |
518 | 520 |
(return)) |
519 | 521 |
|