changeset 7454:053ec63146cb HEAD

Send the success reply in one write. Based on patch by Onno Molenkamp.
author Timo Sirainen <tss@iki.fi>
date Thu, 24 Apr 2008 16:08:25 +0300
parents 3353ddd8ac9f
children 0dbf10f4493a
files src/imap-login/imap-proxy.c src/pop3-login/pop3-proxy.c
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap-login/imap-proxy.c	Thu Apr 24 15:48:01 2008 +0300
+++ b/src/imap-login/imap-proxy.c	Thu Apr 24 16:08:25 2008 +0300
@@ -46,9 +46,12 @@
 		return 0;
 	} else if (strncmp(line, "P OK ", 5) == 0) {
 		/* Login successful. Send this line to client. */
-		(void)o_stream_send_str(client->output, client->cmd_tag);
-		(void)o_stream_send_str(client->output, line + 1);
-		(void)o_stream_send(client->output, "\r\n", 2);
+		str = t_str_new(128);
+		str_append(str, client->cmd_tag);
+		str_append(str, line + 1);
+		str_append(str, "\r\n");
+		(void)o_stream_send(client->output,
+				    str_data(str), str_len(str));
 
 		msg = t_strdup_printf("proxy(%s): started proxying to %s:%u",
 				      client->common.virtual_user,
--- a/src/pop3-login/pop3-proxy.c	Thu Apr 24 15:48:01 2008 +0300
+++ b/src/pop3-login/pop3-proxy.c	Thu Apr 24 16:08:25 2008 +0300
@@ -99,8 +99,8 @@
 			break;
 
 		/* Login successful. Send this line to client. */
+		line = t_strconcat(line, "\r\n", NULL);
 		(void)o_stream_send_str(client->output, line);
-		(void)o_stream_send(client->output, "\r\n", 2);
 
 		msg = t_strdup_printf("proxy(%s): started proxying to %s:%u",
 				      client->common.virtual_user,