/commonlibrary/rust/ylong_http/ylong_http/src/response/ |
H A D | mod.rs | 29 /// The body can be saved in the user-defined type. 39 body: T, 59 pub fn body(&self) -> &T { in body() functions 60 &self.body in body() 65 &mut self.body in body_mut() 70 (self.part, self.body) in into_parts() 74 pub fn from_raw_parts(part: ResponsePart, body: T) -> Response<T> { in from_raw_parts() 75 Self { part, body } in from_raw_parts() 81 Self::from_raw_parts(self.part.clone(), self.body.clone()) in clone() 125 body in ut_response_version() [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/async_impl/downloader/ |
H A D | builder.rs | 27 /// # async fn create_a_downloader(body: Response) { 28 /// let downloader = DownloaderBuilder::new().body(body).console().build(); 35 /// A state indicates that `DownloaderBuilder` wants a body that needs to be 53 /// Sets a body part that needs to be downloaded by the downloader. 62 /// # async fn set_body(body: Response) { 63 /// let builder = DownloaderBuilder::new().body(body); 66 pub fn body(self, body functions [all...] |
H A D | mod.rs | 28 /// A downloader that can help you download the response body. 30 /// A `Downloader` provides a template method for downloading the body and 32 /// the body. 37 /// - `download` methods are responsible for reading and copying the body to 100 /// .body(response) 110 body: Response, 131 Self::builder().body(response).console().build() in console() 168 .body 178 // Downloads response body with speed limitation. 187 let data_size = match self.body [all...] |
/commonlibrary/rust/ylong_http/ylong_http/src/body/ |
H A D | text.rs | 21 use crate::body::origin::FromAsyncBody; 24 /// `TextBody` is used to represent the body of plain text type. 36 /// use ylong_http::body::TextBody; 39 /// let body = TextBody::from_bytes(text.as_bytes()); 52 /// use ylong_http::body::TextBody; 56 /// let body = TextBody::from_reader(reader.as_bytes()); 68 /// use ylong_http::body::TextBody; 73 /// let body = TextBody::from_async_reader(reader.as_bytes()); 88 /// use ylong_http::body::sync_impl::Body; 89 /// use ylong_http::body 498 let mut body = TextBody::from_bytes(bytes); ut_text_body_from_bytes_syn_data() variables 534 let mut body = TextBody::from_bytes(bytes); global() variables 560 let mut body = TextBody::from_reader(reader); ut_text_body_from_reader_syn_data() variables 597 let mut body = TextBody::from_async_reader(reader); global() variables [all...] |
H A D | mod.rs | 23 //! extracted from the message framing. For example, an `HTTP/1.1` message body 34 //! This module provides following body types: 36 //! - [`EmptyBody`]: `EmptyBody` represents an empty body. 37 //! - [`TextBody`]: `TextBody` represents a plain-text body. 65 /// The `sync_impl::Body` trait allows for reading body data synchronously. 72 /// use ylong_http::body::sync_impl::Body; 73 /// use ylong_http::body::TextBody; 76 /// let mut body = TextBody::from_bytes(b"Hello"); 83 /// let read = body.data(&mut buf).unwrap(); 89 /// let read = body 561 let mut body = EmptyBody::new(); ut_syn_body_mut_syn_body_data() variables 587 let mut body = EmptyBody::new(); global() variables [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/async_impl/conn/ |
H A D | http1.rs | 18 use ylong_http::body::async_impl::Body; 19 use ylong_http::body::{ChunkBody, TextBody}; 116 let body = request.body_mut(); 120 let body = ChunkBody::from_async_reader(body); 121 encode_body(conn, body, buf).await?; 124 let body = TextBody::from_async_reader(body); 125 encode_body(conn, body, buf).await?; 128 let body [all...] |
/commonlibrary/rust/ylong_http/ylong_http/src/request/ |
H A D | mod.rs | 38 //! .body(()) 64 use crate::body::{MultiPart, MultiPartBase}; 69 /// HTTP `Request`. A `Request` consists of a request line and a body. 76 /// let request = Request::new("this is a body"); 77 /// assert_eq!(request.body(), &"this is a body"); 81 body: T, 105 /// let request = Request::get("www.example.com").body(()).unwrap(); 123 /// let request = Request::head("www.example.com").body(()).unwrap(); 141 /// let request = Request::post("www.example.com").body(()) 408 pub fn body(&self) -> &T { body() functions 636 pub fn body<T>(self, body: T) -> Result<Request<T>, HttpError> { body() functions [all...] |
/commonlibrary/rust/ylong_http/ylong_http/src/body/mime/ |
H A D | simple.rs | 22 use crate::body::async_impl::{Body, ReusableReader}; 30 /// # use ylong_http::body::{MultiPart, Part}; 33 /// .part(Part::new().name("name").body("xiaoming")) 34 /// .part(Part::new().name("password").body("123456789")); 48 /// # use ylong_http::body::MultiPart; 65 /// # use ylong_http::body::{MultiPart, Part}; 67 /// let multipart = MultiPart::new().part(Part::new().name("name").body("xiaoming")); 79 /// # use ylong_http::body::MultiPart; 94 /// # use ylong_http::body::{MultiPart, Part}; 96 /// let multipart = MultiPart::new().part(Part::new().name("name").body("xiaomin 379 pub fn body<T: AsRef<[u8]>>(mut self, body: T) -> Self { body() functions [all...] |
/commonlibrary/rust/ylong_http/ylong_http/tests/ |
H A D | sdv_http_body.rs | 16 use ylong_http::body::{async_impl, ChunkBody, ChunkBodyDecoder, EmptyBody}; 54 /// 2. Encodes chunk body by calling `ChunkBody::data` 58 use ylong_http::body::sync_impl::Body as SyncBody; in sdv_chunk_body_encode() 61 let mut body = ChunkBody::from_reader(content.as_slice()); in sdv_chunk_body_encode() variables 67 size = body.data(buf.as_mut_slice()).unwrap(); in sdv_chunk_body_encode() 77 /// 2. Encodes chunk body by calling `async_impl::Body::data` 104 /// 2. Encodes chunk body by calling `async_impl::Body::data` 131 /// 2. Encodes chunk body by calling `ChunkBody::data` 135 use ylong_http::body::sync_impl::Body as SyncBody; in sdv_chunk_body_encode_trailer_0() 155 /// 2. Decodes chunk body b 214 let mut body = EmptyBody; sdv_empty_body_async_impl_data() variables [all...] |
H A D | sdv_http_error.rs | 16 use ylong_http::body::EmptyBody; 31 .body(EmptyBody::new()) in sdv_client_send_request_repeatedly()
|
/commonlibrary/rust/ylong_http/ylong_http_client/src/util/ |
H A D | data_ref.rs | 23 body: Option<RequestArc>, 29 body: Some(request), 34 self.body = None; 42 let request = if let Some(ref mut request) = self.body {
|
/commonlibrary/rust/ylong_http/ylong_http/src/body/mime/common/ |
H A D | part.rs | 18 use crate::body::mime::{MixFrom, CR, LF}; 23 /// `MimePart` is a body part of a Composite MIME body which is defined in 24 /// [`RFC2046`]: The body must then contain one or more body parts, each 26 /// closing boundary delimiter line. Each body part then consists of a header 27 /// area, a blank line, and a body area. 29 /// `MimePart` can be built by [`MimePartBuilder`], then sets headers and body. 36 /// use ylong_http::body::MimePart; 47 // | Headers [CRLF Field-body] | 183 pub fn body(&self) -> Option<&Vec<u8>> { body() functions [all...] |
H A D | mix.rs | 19 use crate::body::async_impl::{self, DataFuture}; 20 use crate::body::mime::common::{data_copy, SizeResult, TokenStatus}; 21 use crate::body::sync_impl; 220 use crate::body::mime::common::mix::MixFrom; 221 use crate::body::{async_impl, sync_impl};
|
/commonlibrary/rust/ylong_http/ylong_http/src/body/mime/encode/ |
H A D | part.rs | 19 use crate::body::async_impl::Body; 20 use crate::body::mime::common::{data_copy, SizeResult, TokenStatus}; 21 use crate::body::mime::{EncodeHeaders, MixFrom, PartStatus}; 22 use crate::body::{async_impl, sync_impl, MimePart}; 34 /// use ylong_http::body::{sync_impl, MimePart, MimePartEncoder}; 63 body: Option<MixFrom<'a>>, 78 /// use ylong_http::body::{MimePart, MimePartEncoder}; 84 let body = (!part.body.is_empty()).then_some(part.body); in from_part() [all...] |
H A D | multi.rs | 18 use crate::body::mime::common::{data_copy, SizeResult}; 19 use crate::body::mime::EncodeHeaders; 20 use crate::body::{async_impl, sync_impl, MimeMulti, MimePartEncoder, TokenStatus, XPart}; 31 /// use ylong_http::body::{sync_impl, MimeMulti, MimeMultiEncoder, MimePart}; 112 /// use ylong_http::body::{MimeMulti, MimeMultiEncoder}; 335 // complete async read body in poll_data() 370 use crate::body::{async_impl, sync_impl, MimeMulti, MimeMultiEncoder, MimePart}; 439 /// 2. Creates several `MimePart`, sets headers, sets body, builds. 477 /// 2. Creates several `MimePart`, sets headers, sets body, builds. 540 /// 2. Creates several `MimePart`, sets headers, sets body, build [all...] |
/commonlibrary/rust/ylong_http/ylong_http/src/body/mime/decode/ |
H A D | part.rs | 16 use crate::body::mime::common::{get_crlf_contain, trim_back_lwsp_if_end_with_lf, trim_front_lwsp}; 17 use crate::body::mime::decode::BoundaryTag; 18 use crate::body::mime::{DecodeHeaders, MimePart, PartStatus}; 19 use crate::body::TokenStatus; 118 // Writes to the part body and checks boundary. 128 let body = match self.part.body() { in body_decode() 132 let line = &body[self.src_idx..]; in body_decode() 152 self.src_idx = body.len(); in body_decode() 172 use crate::body [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/async_impl/ |
H A D | request.rs | 22 use ylong_http::body::async_impl::ReusableReader; 23 use ylong_http::body::MultiPartBase; 33 /// some HTTP headers and a HTTP body. 45 /// let request = Request::builder().body(Body::empty()); 99 /// .body(Body::empty()); 195 /// Tries to create a `Request` based on the incoming `body`. 202 /// let request = RequestBuilder::new().body(Body::empty()); 204 pub fn body(self, body: Body) -> Result<Request, HttpClientError> { in body() functions 206 match body in body() [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/tests/ |
H A D | sdv_async_http2.rs | 24 use hyper::body::HttpBody; 26 use ylong_http::body::async_impl::Body as RespBody; 46 let (parts, mut body) = req.into_parts(); 60 match body.data().await { 68 panic!("server read request body data occurs error"); 75 "Assert request body data length failed" 82 .body(hyper::Body::from(body_data)) 179 .body(Body::slice(body_date)) in sdv_async_h2_client_send_request() 193 .expect("Response body read failed"); in sdv_async_h2_client_send_request() 202 "Assert response body dat in sdv_async_h2_client_send_request() [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/sync_impl/ |
H A D | mod.rs | 40 pub use ylong_http::body::sync_impl::Body; 41 pub use ylong_http::body::{EmptyBody, TextBody};
|
H A D | reader.rs | 23 /// A reader used to read all the body data to a specified location and provide 51 /// let mut body = TextBody::from_bytes(b"HelloWorld"); 56 /// let _ = BodyReader::new(&mut processor).read_all(&mut body); 85 /// Sets body read timeout. 100 /// Reads all the body data. During the read process, 112 /// let mut body = TextBody::from_bytes(b"HelloWorld"); 113 /// let _ = BodyReader::default().read_all(&mut body); 115 pub fn read_all<B: Body>(&mut self, body: &mut B) -> Result<(), HttpClientError> { in read_all() 116 // Use buffers up to 16K in size to read body. in read_all() 124 let read_len = body in read_all() 250 let mut body = TextBody::from_bytes(b"HelloWorld"); ut_body_reader_read_all() variables [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/tests/common/ |
H A D | mod.rs | 236 .body(ylong_http::body::TextBody::from_bytes($req_body.as_bytes())) 260 .body(ylong_http_client::async_impl::Body::slice($req_body.as_bytes())) 313 let body = hyper::body::to_bytes(request.into_body()).await 314 .expect("Get request body failed"); 315 assert_eq!($req_body.as_bytes(), body, "Assert request body failed"); 321 .body($resp_body.into()) 376 let body [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/async_impl/uploader/ |
H A D | mod.rs | 23 use ylong_http::body::async_impl::ReusableReader; 24 use ylong_http::body::{MultiPart, MultiPartBase}; 28 /// An uploader that can help you upload the request body. 32 /// the file or the slice and convert it into request body. 203 use ylong_http::body::{MultiPart, Part}; 242 let multipart = MultiPart::new().part(Part::new().name("name").body("xiaoming"));
|
/commonlibrary/rust/ylong_http/ylong_http_client/examples/ |
H A D | sync_proxy_http.rs | 28 .body(EmptyBody) in main() 33 // Reads the body of `Response` by using `BodyReader`. in main()
|
H A D | sync_redirect_http.rs | 27 .body("".as_bytes()) in main() 33 // Reads the body of `Response` by using `BodyReader`. in main()
|
H A D | sync_http.rs | 27 .body("".as_bytes()) in main() 33 // Reads the body of `Response` by using `BodyReader`. in main()
|