From: Jeremy Harris Date: Sat, 6 Aug 2016 13:04:45 +0000 (+0100) Subject: Merge branch 'CHUNKING' X-Git-Tag: exim-4_88_RC1~52 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/44bc8f0c2f3576b46bd6df1b818cb29eaf84df5b Merge branch 'CHUNKING' --- 44bc8f0c2f3576b46bd6df1b818cb29eaf84df5b diff --cc doc/doc-txt/NewStuff index 587dc6508,9e2be8372..719bedf31 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@@ -26,8 -26,11 +26,13 @@@ Version 4.8 the queue to be used for a message. A $queue_name variable gives visibility. - 6. The CHUNKING ESMTP extension from RFC 3030. May give some slight + 6. New expansion operators base32/base32d. + ++ 7. The CHUNKING ESMTP extension from RFC 3030. May give some slight + performance increase and network load decrease. Main config option + chunking_advertise_hosts, and smtp transport option hosts_try_chunking + for control. + Version 4.87 ------------ diff --cc src/src/transport.c index 8e0a80240,88d925e39..a68c22f29 --- a/src/src/transport.c +++ b/src/src/transport.c @@@ -608,10 -616,13 +616,8 @@@ Arguments addr (chain of) addresses (for extra headers), or NULL; only the first address is used fd file descriptor to write the message to - sendfn function for output - use_crlf turn NL into CR LF - rewrite_rules chain of header rewriting rules - rewrite_existflags flags for the rewriting rules ++ tctx transport context + sendfn function for output (transport or verify) - wck_flags - use_crlf turn NL into CR LF - use_bdat callback before chunk flush - rewrite_rules chain of header rewriting rules - rewrite_existflags flags for the rewriting rules - chunk_cb transport callback function for data-chunk commands Returns: TRUE on success; FALSE on failure. */ diff --cc src/src/transports/smtp.c index bbfef0632,25e493433..52b2b913f --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@@ -2350,9 -2483,42 +2484,42 @@@ els | (tblock->headers_only ? topt_no_body : 0) | (tblock->return_path_add ? topt_add_return_path : 0) | (tblock->delivery_date_add ? topt_add_delivery_date : 0) - | (tblock->envelope_to_add ? topt_add_envelope_to : 0), + | (tblock->envelope_to_add ? topt_add_envelope_to : 0) }; + /* If using CHUNKING we need a callback from the generic transport + support to us, for the sending of BDAT smtp commands and the reaping + of responses. The callback needs a whole bunch of state so set up + a transport-context structure to be passed around. */ + + if (peer_offered & PEER_OFFERED_CHUNKING) + { + tctx.check_string = tctx.escape_string = NULL; + tctx.options |= topt_use_bdat; + tctx.chunk_cb = smtp_chunk_cmd_callback; + tctx.inblock = &inblock; + tctx.outblock = &outblock; + tctx.host = host; + tctx.first_addr = first_addr; + tctx.sync_addr = &sync_addr; + tctx.pending_MAIL = pending_MAIL; + tctx.pending_BDAT = FALSE; + tctx.good_RCPT = ok; + tctx.completed_address = &completed_address; + tctx.cmd_count = 0; + tctx.buffer = buffer; + } + else + tctx.options |= topt_end_dot; + + /* Save the first address of the next batch. */ + first_addr = addr; + + /* Responses from CHUNKING commands go in buffer. Otherwise, + there has not been a response. */ + + buffer[0] = 0; + sigalrm_seen = FALSE; transport_write_timeout = ob->data_timeout; smtp_command = US"sending data block"; /* For error messages */