12.06.2015 Views

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

124 MAIL FOLDER ANNOYANCE-FILTER §142<br />

142. At the end of a MIME part, switch off the decoder and reset the part properties to void.<br />

〈 Reset MIME decoder state 142 〉 ≡<br />

mimeContentType = mimeContentTypeCharset = mimeContentTypeName =<br />

mimeContentDispositionFilename = mimeContentTypeBoundary =<br />

mimeContentTransferEncoding = "";<br />

mdp = Λ;<br />

mbi = Λ;<br />

asp = Λ;<br />

byteStream = false ;<br />

This code is used in sections 129, 130, 139, and 162.<br />

143. Statements in the message header section may be continued onto multiple lines. Continuations<br />

are denoted by white space in the first column of successive continuations. To simplify header parsing,<br />

we look ahead and concatenate all continuations into one single header statement. <strong>The</strong> twiddling with<br />

lal in the following code is to ensure the integrity of transcripts. We delete trailing space from the look<br />

ahead line before concatenating it, but if we in fact looked ahead to a line which is not a continuation,<br />

we want to eventually save it in the transcript as it originally arrived, complete with trailing space, so<br />

we replace it with the original line before deleting the trailing space.<br />

〈 Check for continuation of mail header lines 143 〉 ≡<br />

〈 Check for lines with our sentinel already present in the header 144 〉;<br />

while ((inHeader ∨ inPartHeader ) ∧ getline (∗is , lookAheadLine ) ≠ Λ) {<br />

string lal = lookAheadLine ;<br />

while ((lookAheadLine .length ( ) > 0) ∧ (isISOspace (lookAheadLine [lookAheadLine .length ( ) − 1])))<br />

{<br />

lookAheadLine .erase (lookAheadLine .length ( ) − 1);<br />

}<br />

if ((lookAheadLine .length ( ) > 0) ∧ isISOspace (lookAheadLine [0])) {<br />

string ::size type p = 1;<br />

while (isISOspace (lookAheadLine [p])) {<br />

p++;<br />

}<br />

s += lookAheadLine .substr (p);<br />

if ((tlist ≠ Λ) ∧ (¬isSpoofedHeader )) {<br />

tlist ⃗ push back (lal );<br />

}<br />

continue;<br />

}<br />

lookedAhead = true ;<br />

lookAheadLine = lal ;<br />

break;<br />

}<br />

if (isSpoofedHeader ) {<br />

ostringstream os ;<br />

}<br />

os ≪ "Spoofed␣header␣rejected:␣" ≪ s;<br />

reportParserDiagnostic(os .str ( ));<br />

continue;<br />

This code is cited in section 256.<br />

This code is used in section 141.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!