]> Repositorios git - scryer-prolog.git/commitdiff
Add close handling of http stream
authorAdrián Arroyo Calle <[email protected]>
Mon, 28 Mar 2022 19:04:46 +0000 (21:04 +0200)
committerAdrián Arroyo Calle <[email protected]>
Mon, 28 Mar 2022 19:04:46 +0000 (21:04 +0200)
src/machine/streams.rs

index a0dc83f5aee7b93f2df4ead67a661a926fe6a7d1..072aa1f8a6035ac17cacddf4738b203cc51f5625 100644 (file)
@@ -1050,6 +1050,14 @@ impl Stream {
             Stream::NamedTls(ref mut tls_stream) => {
                 tls_stream.inner_mut().tls_stream.shutdown()
             }
+            Stream::NamedHttpClient(ref mut http_stream) => {
+                unsafe {
+                    http_stream.set_tag(ArenaHeaderTag::Dropped);
+                    std::ptr::drop_in_place(&mut http_stream.inner_mut().body_reader as *mut _);
+                }
+                
+                Ok(())
+            }
             Stream::InputFile(mut file_stream) => {
                 // close the stream by dropping the inner File.
                 unsafe {