File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 11use anyhow:: { anyhow, ensure} ;
22use clap:: { Parser , Subcommand } ;
33use std:: { fs:: File , net:: SocketAddr , path:: PathBuf } ;
4+ use tokio:: io:: AsyncWriteExt ;
45use tokio_rustls:: rustls:: pki_types:: { CertificateDer , PrivateKeyDer } ;
56use tracing:: level_filters:: LevelFilter ;
67
@@ -328,17 +329,22 @@ async fn main() -> anyhow::Result<()> {
328329 None => None ,
329330 } ;
330331
331- let response = attested_get (
332+ let mut response = attested_get (
332333 target_addr,
333334 & url_path. unwrap_or_default ( ) ,
334335 attestation_verifier,
335336 remote_tls_cert,
336337 )
337338 . await ?;
338339
339- // TODO how to handle binary response
340- let text = response. text ( ) . await ?;
341- println ! ( "{text}" ) ;
340+ // Write response body to standard output
341+ let mut stdout = tokio:: io:: stdout ( ) ;
342+
343+ while let Some ( chunk) = response. chunk ( ) . await ? {
344+ stdout. write_all ( & chunk) . await ?;
345+ }
346+
347+ stdout. flush ( ) . await ?;
342348 }
343349 }
344350
You can’t perform that action at this time.
0 commit comments