|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Victor Duchovni (Victor.Duchovni
MorganStanley.com)
Date: Thu Mar 29 2007 - 16:10:00 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Mar 29, 2007 at 10:50:00PM +0200, mouss wrote:
> Fabio Viero wrote:
> >Hi
> >
> >Well, the subject states exactly what i need. I hope the question
> >doesn?t sound "too" dumb. Just for sake i?ll tell once again. I need
> >to identify the end of the header section and the start of the body
> >section of a message. How to do that?
> >
> >Thanks.
> >
>
> - at start, you expect headers
> - headers start with the header name followed by ':'
> - headers may be continued: continuation lines start with space
> - as soon as you find a line that doesn't start a header nor continues
> it, you reached the body. Normally, a blank line separates the headers
> and the body, but...
>
>
> "pseudo"-perl code:
>
> $state="headers";
> $header="";
> while (<IN>) {
> chomp;
> # new header
> if (/^(\S+)\s*:/) { # \s* is for robustness...
> $header=$1;
> $value{$header} = $'; # you could trim if you want...
> next;
> }
> # continuation line
> if (/^\s*(.*/)/) {
what is that middle of 3 "/"s for?
> if ($header !~ /\S/) {
> # should not happen...
> last;
> }
> $value{$header} .= $1; # you could trim if you want
> next;
> }
> reached the body section
> $header = "";
> $line = $_;
> last;
> }
>
> here, check if $line is empty, otherwise, consider it part of the body.
--
Viktor.
Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.
To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majordomo
postfix.org?body=unsubscribe%20postfix-users>
If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]