From: Ian Jackson Date: Sat, 31 Jul 2021 17:29:38 +0000 (+0100) Subject: wip request mime X-Git-Tag: hippotat/1.0.0~414 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=513339f44040cecbbf84f17e8e8d403be2ed235d;p=hippotat.git wip request mime Signed-off-by: Ian Jackson --- diff --git a/macros/macros.rs b/macros/macros.rs index 5f684a2..cfd7e06 100644 --- a/macros/macros.rs +++ b/macros/macros.rs @@ -109,3 +109,10 @@ pub fn resolve(input: proc_macro::TokenStream) -> proc_macro::TokenStream { //eprintln!("{}", &output); output.into() } + +#[proc_macro] +pub fn into_crlfs(input: proc_macro::TokenStream) -> proc_macro::TokenStream { + let input: proc_macro2::TokenStream = input.into(); + dbg!(&input); + input.into() +} diff --git a/src/bin/client.rs b/src/bin/client.rs index a138ca4..40d1f62 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -3,6 +3,7 @@ // There is NO WARRANTY. use hippotat::prelude::*; +use hippotat_macros::into_crlfs; type OutstandingRequest<'r> = Pin> + Send + 'r @@ -24,6 +25,38 @@ fn submit_request<'r, 'c:'r, C:HCC>( reqs: &mut Vec>, upbound: FramesData, ) { + let show_timeout = c.ic.http_timeout + .saturating_add(Duration::from_nanos(999_999_999)) + .as_secs(); + + let prefix = format!(into_crlfs!( + r#"-- + Content-Type: text/plain; charset="utf-8" + Content-Disposition: form-data; name="m" + + {} + {} + {} + {}"#), + &c.ic.link.client, + "xxx token goes here", + c.ic.target_requests_outstanding, + show_timeout, + ); + + let prefix2 = format!(into_crlfs!( + r#" + -- + Content-Type: application/octet-stream + Content-Disposition: form-data; name="d" + "#), + ); + let suffix = format!(into_crlfs!( + r#" + --b-- + "#), + ); + let body = hyper::body::Body::wrap_stream( futures::stream::iter( Itertools::intersperse(