From c4835c506d465a036fa294db275df27095104045 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Mon, 26 Jun 2017 11:14:57 -0700 Subject: [PATCH] refactor(http): grab io.write_buf_mut only once in write_head --- src/http/conn.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/http/conn.rs b/src/http/conn.rs index 56a49889..7b91efc9 100644 --- a/src/http/conn.rs +++ b/src/http/conn.rs @@ -248,14 +248,15 @@ where I: AsyncRead + AsyncWrite, let wants_keep_alive = head.should_keep_alive(); self.state.keep_alive &= wants_keep_alive; + let mut buf = self.io.write_buf_mut(); // if a 100-continue has started but not finished sending, tack the // remainder on to the start of the buffer. if let Writing::Continue(ref pending) = self.state.writing { if pending.has_started() { - self.io.write_buf_mut().extend_from_slice(pending.buf()); + buf.extend_from_slice(pending.buf()); } } - let encoder = T::encode(head, self.io.write_buf_mut()); + let encoder = T::encode(head, buf); self.state.writing = if body { Writing::Body(encoder, None) } else {