http_request/
lib.rs

1pub(crate) mod body;
2pub(crate) mod cfg;
3pub(crate) mod common;
4pub(crate) mod r#const;
5pub(crate) mod request;
6pub(crate) mod response;
7pub(crate) mod utils;
8pub(crate) mod websocket;
9
10pub use request::*;
11pub use response::*;
12pub use websocket::*;
13
14pub use http_type::{
15    HashMapXxHash3_64, JsonDeserializer, JsonError, JsonMap, JsonNumber, JsonResult,
16    JsonSerializer, JsonStreamDeserializer, JsonValue, hash_map_xx_hash3_64, json_from_reader,
17    json_from_slice, json_from_str, json_from_value, json_to_string, json_to_string_pretty,
18    json_to_value, json_to_vec, json_to_vec_pretty, json_to_writer, json_to_writer_pretty,
19    json_value,
20};
21
22pub(crate) use body::*;
23pub(crate) use common::*;
24pub(crate) use r#const::*;
25pub(crate) use utils::*;
26
27pub(crate) use futures::{Future, Sink, SinkExt, Stream, StreamExt};
28pub(crate) use http_type::{
29    ACCEPT, ACCEPT_ANY, BR_BYTES, CONNECTION, CONTENT_LENGTH, CONTENT_TYPE, Compress, ContentType,
30    DEFAULT_BUFFER_SIZE, DEFAULT_HTTP_PATH, DEFAULT_MAX_REDIRECT_TIMES, DEFAULT_TIMEOUT, EMPTY_STR,
31    HOST, HTTP_BR_BYTES, HttpStatus, HttpUrlComponents, HttpVersion, LOCATION, Method, Protocol,
32    QUERY_SYMBOL, RequestBody, RequestBodyString, RequestError, RequestHeaders, ResponseHeaders,
33    ResponseStatusCode, SEC_WEBSOCKET_KEY, SEC_WEBSOCKET_VERSION, SPACE_U8, TAB_U8, UPGRADE,
34    USER_AGENT,
35};
36pub(crate) use rustls::{
37    ClientConfig, ClientConnection, RootCertStore, StreamOwned, pki_types::ServerName,
38};
39pub(crate) use serde::{Serialize, Serializer};
40pub(crate) use std::{
41    borrow::Cow,
42    collections::HashSet,
43    fmt::{self, Debug, Display, Formatter},
44    io::{Read, Write},
45    net::{Ipv4Addr, Ipv6Addr, TcpStream},
46    pin::Pin,
47    str::from_utf8,
48    sync::{
49        Arc, RwLock,
50        atomic::{AtomicBool, Ordering},
51    },
52    task::{Context, Poll},
53    time::{Duration, SystemTime, UNIX_EPOCH},
54    vec::IntoIter,
55};
56pub(crate) use tokio::{
57    io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt},
58    net::TcpStream as AsyncTcpStream,
59    sync::{Mutex as AsyncMutex, MutexGuard as AsyncMutexGuard},
60    time::timeout,
61};
62pub(crate) use tokio_rustls::{TlsConnector, client::TlsStream};
63pub(crate) use tokio_tungstenite::{
64    MaybeTlsStream, WebSocketStream, client_async_with_config, connect_async_with_config,
65    tungstenite::Message, tungstenite::handshake::client::Request,
66};
67pub(crate) use webpki_roots::TLS_SERVER_ROOTS;
68
69#[cfg(test)]
70use std::{
71    sync::{Mutex, MutexGuard},
72    thread::{JoinHandle, spawn},
73    time::Instant,
74};