From 401c0ad809bd27cc251ac91b2e8e6206e2129f1f Mon Sep 17 00:00:00 2001 From: Glade Miller Date: Tue, 13 Mar 2018 13:17:55 -0600 Subject: [PATCH 1/3] https://github.com/actix/actix-web/issues/120 - Send Query Parameters in client requests --- src/client/writer.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/writer.rs b/src/client/writer.rs index 7cd522113..18c74af8d 100644 --- a/src/client/writer.rs +++ b/src/client/writer.rs @@ -110,9 +110,10 @@ impl HttpClientWriter { self.flags.insert(Flags::UPGRADE); } + let path = msg.uri().path_and_query().map(|u| u.as_str()).unwrap_or(""); // status line let _ = write!(buffer, "{} {} {:?}\r\n", - msg.method(), msg.uri().path(), msg.version()); + msg.method(), path, msg.version()); // write headers for (key, value) in msg.headers() { From 08504e0892b855e7106360ca2896df695aaabe7d Mon Sep 17 00:00:00 2001 From: Glade Miller Date: Tue, 13 Mar 2018 13:26:13 -0600 Subject: [PATCH 2/3] Move path call inline into write --- src/client/writer.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client/writer.rs b/src/client/writer.rs index 18c74af8d..20a743c63 100644 --- a/src/client/writer.rs +++ b/src/client/writer.rs @@ -110,10 +110,11 @@ impl HttpClientWriter { self.flags.insert(Flags::UPGRADE); } - let path = msg.uri().path_and_query().map(|u| u.as_str()).unwrap_or(""); // status line let _ = write!(buffer, "{} {} {:?}\r\n", - msg.method(), path, msg.version()); + msg.method(), + msg.uri().path_and_query().map(|u| u.as_str()).unwrap_or(""), + msg.version()); // write headers for (key, value) in msg.headers() { From 38080f67b38fb4cddd11d0b3bde4159957979b27 Mon Sep 17 00:00:00 2001 From: Glade Miller Date: Tue, 13 Mar 2018 13:35:11 -0600 Subject: [PATCH 3/3] If no path is available from the URI request / --- src/client/writer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/writer.rs b/src/client/writer.rs index 20a743c63..a3692358f 100644 --- a/src/client/writer.rs +++ b/src/client/writer.rs @@ -113,7 +113,7 @@ impl HttpClientWriter { // status line let _ = write!(buffer, "{} {} {:?}\r\n", msg.method(), - msg.uri().path_and_query().map(|u| u.as_str()).unwrap_or(""), + msg.uri().path_and_query().map(|u| u.as_str()).unwrap_or("/"), msg.version()); // write headers