read_mime_header safety
Jesse Guardiani <[email protected]> Thu, 2 Jun 2005 14:02:26 +0000 (UTC)
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello, I'm writing a mail filter for qmail-qfilter in OCaml that uses read_mime_header to parse just the header of the message and perform logic based on the header field values. qmail-qfilter passes incoming email messages to it's filter programs on stdin, and qmail-qfilter reads the message output from the filter program's stdout so the modified message can be passed to the next filter program or qmail-queue. My #1 concern with this OCaml filter program I'm writing is ultimate reliability. If read_mime_header fails to parse the header properly, I want to execute a default action. I will have two possible default actions at this point: 1.) Allow the message through 2.) Block the message entirely And I'll make this configurable at run time via a config file. So, given the following code to read the header: let ch = new Netchannels.input_channel (stdin) in let stream = new Netstream.input_stream ch in let header = Netmime.read_mime_header stream in If read_mime_header throws an exception and I catch the exception and the program is configured to allow the message through on error conditions, how do I reset ch to the beginning of stdin so I can pass the message to stdout in it's entirety? Thanks! -- Jesse Guardiani Programmer / Sys Admin [email protected] ------------------------------------------------------- This SF.Net email is sponsored by Yahoo. Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005