[dovecot-cvs] dovecot/src/imap imap-fetch-body-section.c,1.5,1.6
cras at procontrol.fi
cras at procontrol.fi
Tue Mar 18 02:29:52 EET 2003
Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv31880
Modified Files:
imap-fetch-body-section.c
Log Message:
Partial body fetches were buggy
Index: imap-fetch-body-section.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/imap-fetch-body-section.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- imap-fetch-body-section.c 22 Jan 2003 20:23:12 -0000 1.5
+++ imap-fetch-body-section.c 18 Mar 2003 00:29:49 -0000 1.6
@@ -78,6 +78,7 @@
struct istream *stream;
const char *str;
int skip_cr;
+ uoff_t size;
off_t ret;
stream = mail->get_stream(mail, &hdr_size, &body_size);
@@ -87,8 +88,13 @@
if (fetch_header)
message_size_add(&body_size, &hdr_size);
- str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n",
- ctx->prefix, body_size.virtual_size);
+ if (body->skip >= body_size.virtual_size)
+ size = 0;
+ else {
+ size = body_size.virtual_size - body->skip;
+ if (size > body->max_size) size = body->max_size;
+ }
+ str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n", ctx->prefix, size);
if (o_stream_send_str(ctx->output, str) < 0)
return FALSE;
@@ -96,6 +102,7 @@
&partial, stream,
fetch_header ? 0 : hdr_size.physical_size,
body->skip);
+
ret = message_send(ctx->output, stream, &body_size,
skip_cr, body->max_size);
if (ret > 0) {
More information about the dovecot-cvs
mailing list