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.

§209 ANNOYANCE-FILTER POP3 PROXY SERVER CLASS DEFINITION 173<br />

209. Now we’re ready to read the status line from the server. This will begin with “+OK” if the<br />

request was successful and “−ERR” if now.<br />

〈 Read status line from server 209 〉 ≡<br />

serverLength = 0;<br />

int rl = −1;<br />

while (true ) {<br />

rl = recv (serverSocket , serverBuffer + serverLength , 1, 0);<br />

if (rl < 0) {<br />

perror ("POP3Proxy␣reading␣request␣status␣from␣server");<br />

break;<br />

}<br />

serverLength ++;<br />

if (serverBuffer [serverLength − 1] ≡ ’\n’) {<br />

break;<br />

}<br />

if (serverLength ≥ POP_MAX_MESSAGE) {<br />

cerr ≪ "POP3Proxy␣reply␣from␣server␣too␣long." ≪ endl ;<br />

rl = −1;<br />

break;<br />

}<br />

}<br />

if (rl < 0) {<br />

break;<br />

}<br />

if (popProxyTrace ) {<br />

cerr ≪ "POP3:␣Server␣reply␣is␣" ≪ serverLength ≪ "␣bytes" ≪ endl ;<br />

}<br />

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

This code is used in section 204.

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

Saved successfully!

Ooh no, something went wrong!