12.06.2015 Views

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

114 MAIL FOLDER ANNOYANCE-FILTER §130<br />

}<br />

}<br />

if (¬getline (∗is , s)) {<br />

〈 Advance to next file if traversing directory 138 〉;<br />

return false ;<br />

}<br />

}<br />

}<br />

nLines ++;<br />

if (sloppyheaders ) { /∗ Spam seems to have begun to arrive with the required blank line<br />

separating a mail message header and the first MIME separator. Since the “--” sequence<br />

which precedes the sentinel (whatever it be) cannot appear in a legitimate header, we<br />

check for it here and, if the header runs onto the sentinel, fake a blank line to properly<br />

terminate the header. ∗/<br />

if (inHeader ∧ multiPart ∧ (partBoundary ≠ "") ∧ (s.substr (0, 2) ≡ "−−") ∧ (s.substr (2,<br />

partBoundary .length ( )) ≡ partBoundary )) {<br />

if (Annotate (’d’)) {<br />

ostringstream os ;<br />

os ≪ "Header␣runs␣into␣−−" ≪ partBoundary ≪<br />

"␣sentinel.␣␣Adding␣blank␣line␣to␣end␣header.";<br />

reportParserDiagnostic(os );<br />

}<br />

assert(¬lookedAhead );<br />

lookedAhead = true ;<br />

lookAheadLine = s;<br />

s = "";<br />

}<br />

}<br />

if ((mdp ≡ Λ) ∧ (tlist ≠ Λ) ∧ (¬decoderEOF )) {<br />

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

}<br />

〈 Check for start of new message in folder 139 〉;<br />

〈 Eliminate any trailing space from line 140 〉;<br />

〈 Process message header lines 141 〉;<br />

〈 Parse MIME part header 149 〉;<br />

〈 Check for MIME part sentinel 151 〉;<br />

〈 Decode multiple byte character set 152 〉;<br />

return true ;

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

Saved successfully!

Ooh no, something went wrong!