Guess the end of an E-Mail if the end is unknown (end==0 or end < start).

This commit is contained in:
Wolfram Schneider 1998-04-13 00:16:43 +00:00
parent 1ebb90ef0f
commit c0c30963f9
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=2667
2 changed files with 24 additions and 4 deletions

View file

@ -6,7 +6,7 @@
# by John Fieber
# February 26, 1998
#
# $Id: getmsg.cgi,v 1.13 1998-03-30 13:40:20 wosch Exp $
# $Id: getmsg.cgi,v 1.14 1998-04-13 00:16:43 wosch Exp $
#
require "./cgi-lib.pl";
@ -50,7 +50,17 @@ sub Fetch
{
@finfo = stat DATA;
seek DATA, $start, 0;
read DATA, $message, $end - $start;
if ($end > $start && $start >= 0) {
read DATA, $message, $end - $start;
} else {
# Unknown length, guess the end of the E-Mail
my($newline) = 0;
while(<DATA>) {
last if ($newline && /^From /);
if (/^$/) { $newline = 1 } else { $newline = 0; }
$message .= $_;
}
}
close(DATA);
print "last-modified: " .
POSIX::strftime("%a, %d %b %Y %T GMT", gmtime($finfo[9])) . "\n";

View file

@ -6,7 +6,7 @@
# by John Fieber
# February 26, 1998
#
# $Id: getmsg.cgi,v 1.13 1998-03-30 13:40:20 wosch Exp $
# $Id: getmsg.cgi,v 1.14 1998-04-13 00:16:43 wosch Exp $
#
require "./cgi-lib.pl";
@ -50,7 +50,17 @@ sub Fetch
{
@finfo = stat DATA;
seek DATA, $start, 0;
read DATA, $message, $end - $start;
if ($end > $start && $start >= 0) {
read DATA, $message, $end - $start;
} else {
# Unknown length, guess the end of the E-Mail
my($newline) = 0;
while(<DATA>) {
last if ($newline && /^From /);
if (/^$/) { $newline = 1 } else { $newline = 0; }
$message .= $_;
}
}
close(DATA);
print "last-modified: " .
POSIX::strftime("%a, %d %b %Y %T GMT", gmtime($finfo[9])) . "\n";