file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
tests/dns_test.py
Python
from ipaddress import IPv4Address import pytest from rnet import Client from rnet.exceptions import ConnectionError from rnet.dns import ResolverOptions, LookupIpStrategy @pytest.mark.asyncio @pytest.mark.flaky(reruns=3, reruns_delay=2) async def test_dns_resolve_override(): dns_options = ResolverOptions(lookup_i...
0x676e67/rnet
1,216
An ergonomic Python HTTP Client with TLS fingerprint
Rust
0x676e67
tests/error_test.py
Python
import pytest import rnet import rnet.exceptions as exceptions @pytest.mark.asyncio @pytest.mark.flaky(reruns=3, reruns_delay=2) async def test_proxy_connection_error(): invalid_proxies = [ "http://invalid.proxy:8080", "https://invalid.proxy:8080", "socks4://invalid.proxy:8080", "s...
0x676e67/rnet
1,216
An ergonomic Python HTTP Client with TLS fingerprint
Rust
0x676e67
tests/header_test.py
Python
import pytest from rnet.header import OrigHeaderMap, HeaderMap @pytest.mark.flaky(reruns=3, reruns_delay=2) def test_construction_and_is_empty(): h = HeaderMap() assert h.is_empty() assert len(h) == 0 assert h.keys_len() == 0 @pytest.mark.flaky(reruns=3, reruns_delay=2) def test_insert_and_get(): ...
0x676e67/rnet
1,216
An ergonomic Python HTTP Client with TLS fingerprint
Rust
0x676e67
tests/redirect_test.py
Python
import pytest import rnet from rnet import redirect client = rnet.Client(redirect=redirect.Policy.limited(10)) @pytest.mark.asyncio @pytest.mark.flaky(reruns=3, reruns_delay=2) async def test_request_disable_redirect(): response = await client.get( "https://google.com", redirect=redirect.Policy.n...
0x676e67/rnet
1,216
An ergonomic Python HTTP Client with TLS fingerprint
Rust
0x676e67
tests/request_test.py
Python
import pytest import rnet from rnet import Version from rnet.header import HeaderMap client = rnet.Client(tls_info=True) @pytest.mark.asyncio @pytest.mark.flaky(reruns=3, reruns_delay=2) async def test_gzip(): url = "http://localhost:8080/gzip" resp = await client.get(url) async with resp: text =...
0x676e67/rnet
1,216
An ergonomic Python HTTP Client with TLS fingerprint
Rust
0x676e67
tests/response_test.py
Python
import pytest import rnet from pathlib import Path from rnet import Version, Multipart, Part client = rnet.Client(tls_info=True) @pytest.mark.asyncio @pytest.mark.flaky(reruns=3, reruns_delay=2) async def test_multiple_requests(): async def file_to_bytes_stream(file_path): with open(file_path, "rb") as f...
0x676e67/rnet
1,216
An ergonomic Python HTTP Client with TLS fingerprint
Rust
0x676e67
tests/tls_test.py
Python
import pytest import rnet from rnet.emulation import Emulation from rnet.tls import CertStore @pytest.mark.asyncio @pytest.mark.flaky(reruns=3, reruns_delay=2) async def test_badssl(): client = rnet.Client(verify=False) resp = await client.get("https://self-signed.badssl.com/") async with resp: as...
0x676e67/rnet
1,216
An ergonomic Python HTTP Client with TLS fingerprint
Rust
0x676e67
bench/http1.rs
Rust
//! This example runs a server that responds to any request with "Hello, world!" mod support; use std::time::Duration; use support::{HttpMode, bench}; use criterion::{Criterion, criterion_group, criterion_main}; const HTTP_MODE: HttpMode = HttpMode::Http1; const ADDR: &str = "127.0.0.1:5928"; #[inline] fn bench_se...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
bench/http2.rs
Rust
//! This example runs a server that responds to any request with "Hello, world!" mod support; use std::time::Duration; use support::{HttpMode, bench}; use criterion::{Criterion, criterion_group, criterion_main}; const HTTP_MODE: HttpMode = HttpMode::Http2; const ADDR: &str = "127.0.0.1:6928"; #[inline] fn bench_se...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
bench/support.rs
Rust
pub mod bench; pub mod client; pub mod server; use std::fmt; #[allow(unused)] #[derive(Clone, Copy, Debug)] pub enum HttpMode { Http1, Http2, } impl fmt::Display for HttpMode { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let value = match self { HttpMode::Http1 => "http...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
bench/support/bench.rs
Rust
use std::error::Error; use criterion::{BenchmarkGroup, Criterion, measurement::WallTime}; use crate::support::client::bench_both_clients; use crate::support::server::{spawn_multi_thread_server, spawn_single_thread_server, with_server}; use crate::support::{HttpMode, build_current_thread_runtime, build_multi_thread_ru...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
bench/support/client.rs
Rust
use std::{convert::Infallible, error::Error, sync::Arc}; use super::HttpMode; use bytes::Bytes; use criterion::{BenchmarkGroup, measurement::WallTime}; use tokio::{runtime::Runtime, sync::Semaphore}; const STREAM_CHUNK_SIZE: usize = 8 * 1024; #[inline] fn box_err<E: Error + Send + 'static>(e: E) -> Box<dyn Error + S...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
bench/support/server.rs
Rust
use std::{convert::Infallible, error::Error, time::Duration}; use http::{Request, Response}; use hyper::{body::Incoming, service::service_fn}; use hyper_util::{ rt::{TokioExecutor, TokioIo}, server::conn::auto::Builder, }; use tokio::{ net::{TcpListener, TcpStream}, sync::oneshot, }; use super::{HttpM...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/cert_store.rs
Rust
use std::time::Duration; use wreq::{ Client, tls::{CertStore, TlsInfo}, }; /// Certificate Store Example /// /// In most cases, you don't need to manually configure certificate stores. wreq automatically /// uses appropriate default certificates: /// - With `webpki-roots` feature enabled: Uses Mozilla's maint...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/connect_via_lower_priority_tokio_runtime.rs
Rust
// This example demonstrates how to delegate the connect calls, which contain TLS handshakes, // to a secondary tokio runtime of lower OS thread priority using a custom tower layer. // This helps to ensure that long-running futures during handshake crypto operations don't block // other I/O futures. // // This does int...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/emulation.rs
Rust
use wreq::{ Client, Emulation, header::{self, HeaderMap, HeaderValue, OrigHeaderMap}, http2::{Http2Options, PseudoId, PseudoOrder}, tls::{AlpnProtocol, TlsOptions, TlsVersion}, }; macro_rules! join { ($sep:expr, $first:expr $(, $rest:expr)*) => { concat!($first $(, $sep, $rest)*) }; } ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/form.rs
Rust
// Short example of a POST request with form data. // // This is using the `tokio` runtime. You'll need the following dependency: // // `tokio = { version = "1", features = ["full"] }` #[tokio::main] async fn main() { let response = wreq::post("http://www.baidu.com") .form(&[("one", "1")]) .send() ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/http1_websocket.rs
Rust
use futures_util::{SinkExt, StreamExt, TryStreamExt}; use wreq::{header, ws::message::Message}; #[tokio::main] async fn main() -> wreq::Result<()> { // Use the API you're already familiar with let resp = wreq::websocket("wss://echo.websocket.org") .header(header::USER_AGENT, env!("CARGO_PKG_NAME")) ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/http2_websocket.rs
Rust
//! Run websocket server //! //! ```not_rust //! git clone https://github.com/tokio-rs/axum && cd axum //! cargo run -p example-websockets-http2 //! ``` use futures_util::{SinkExt, StreamExt, TryStreamExt}; use wreq::{header, ws::message::Message}; #[tokio::main] async fn main() -> wreq::Result<()> { // Use the A...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/json_dynamic.rs
Rust
//! This example illustrates the way to send and receive arbitrary JSON. //! //! This is useful for some ad-hoc experiments and situations when you don't //! really care about the structure of the JSON and just need to display it or //! process it at runtime. // This is using the `tokio` runtime. You'll need the follo...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/json_typed.rs
Rust
//! This example illustrates the way to send and receive statically typed JSON. //! //! In contrast to the arbitrary JSON example, this brings up the full power of //! Rust compile-time type system guaranties though it requires a little bit //! more code. // These require the `serde` dependency. use serde::{Deserializ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/keylog.rs
Rust
use wreq::tls::KeyLog; #[tokio::main] async fn main() -> wreq::Result<()> { // Build a client let client = wreq::Client::builder() .keylog(KeyLog::from_file("keylog.txt")) .cert_verification(false) .build()?; // Use the API you're already familiar with let resp = client.get("ht...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/request_with_emulation.rs
Rust
use wreq::{ Emulation, header::{self, HeaderMap, HeaderValue, OrigHeaderMap}, http2::{Http2Options, PseudoId, PseudoOrder}, tls::{AlpnProtocol, TlsOptions, TlsVersion}, }; macro_rules! join { ($sep:expr, $first:expr $(, $rest:expr)*) => { concat!($first $(, $sep, $rest)*) }; } #[tokio:...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/request_with_interface.rs
Rust
#[cfg(any( target_os = "android", target_os = "fuchsia", target_os = "illumos", target_os = "ios", target_os = "linux", target_os = "macos", target_os = "solaris", target_os = "tvos", target_os = "visionos", target_os = "watchos", ))] #[tokio::main] async fn main() -> wreq::Resul...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/request_with_local_address.rs
Rust
use std::net::IpAddr; use wreq::redirect::Policy; #[tokio::main] async fn main() -> wreq::Result<()> { // Use the API you're already familiar with let resp = wreq::get("http://www.baidu.com") .redirect(Policy::default()) .local_address(IpAddr::from([192, 168, 1, 226])) .send() ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/request_with_proxy.rs
Rust
use wreq::Proxy; #[tokio::main] async fn main() -> wreq::Result<()> { // Use the API you're already familiar with let resp = wreq::get("https://api.ip.sb/ip") .proxy(Proxy::all("socks5h://localhost:6153")?) .send() .await?; println!("{}", resp.text().await?); Ok(()) }
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/request_with_redirect.rs
Rust
use wreq::redirect::Policy; #[tokio::main] async fn main() -> wreq::Result<()> { // Use the API you're already familiar with let resp = wreq::get("https://google.com/") .redirect(Policy::custom(|attempt| { // we can inspect the redirect attempt println!( "Redirec...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/request_with_version.rs
Rust
use http::Version; #[tokio::main] async fn main() -> wreq::Result<()> { // Use the API you're already familiar with let resp = wreq::get("https://www.google.com") .version(Version::HTTP_11) .send() .await?; assert_eq!(resp.version(), Version::HTTP_11); println!("{}", resp.text(...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/tor_socks.rs
Rust
#![deny(warnings)] // This is using the `tokio` runtime. You'll need the following dependency: // // `tokio = { version = "1", features = ["full"] }` #[tokio::main] async fn main() -> wreq::Result<()> { // Make sure you are running tor and this is your socks port let proxy = wreq::Proxy::all("socks5h://127.0.0...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
examples/unix_socket.rs
Rust
#[cfg(unix)] #[tokio::main] async fn main() -> wreq::Result<()> { // Create a Unix socket proxy let proxy = wreq::Proxy::unix("/var/run/docker.sock")?; // Build a client let client = wreq::Client::builder() // Specify the Unix socket path .proxy(proxy.clone()) .timeout(std::time...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client.rs
Rust
mod body; mod conn; mod core; mod emulation; mod http; mod request; mod response; pub mod layer; #[cfg(feature = "multipart")] pub mod multipart; #[cfg(feature = "ws")] pub mod ws; pub use self::{ body::Body, core::{http1, http2, upgrade::Upgraded}, emulation::{Emulation, EmulationBuilder, EmulationFactor...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/body.rs
Rust
use std::{ pin::Pin, task::{Context, Poll, ready}, }; use bytes::Bytes; use http_body::{Body as HttpBody, SizeHint}; use http_body_util::{BodyExt, Either, combinators::BoxBody}; use pin_project_lite::pin_project; #[cfg(feature = "stream")] use {tokio::fs::File, tokio_util::io::ReaderStream}; use crate::error:...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/conn.rs
Rust
#[allow(clippy::module_inception)] mod conn; mod connector; mod http; mod proxy; mod tls_info; #[cfg(unix)] mod uds; mod verbose; use std::{ fmt::{self, Debug, Formatter}, sync::{ Arc, atomic::{AtomicBool, Ordering}, }, }; use ::http::{Extensions, HeaderMap, HeaderValue}; use tokio::io::{A...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/conn/conn.rs
Rust
use std::{ io::{self, IoSlice}, pin::Pin, task::{Context, Poll}, }; use pin_project_lite::pin_project; #[cfg(unix)] use tokio::net::UnixStream; use tokio::{ io::{AsyncRead, AsyncWrite, ReadBuf}, net::TcpStream, }; use tokio_boring2::SslStream; use super::{AsyncConnWithInfo, Connected, Connection, ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/conn/connector.rs
Rust
#[cfg(unix)] use std::path::Path; use std::{ future::Future, pin::Pin, sync::Arc, task::{Context, Poll}, time::Duration, }; use http::Uri; use tokio::io::{AsyncRead, AsyncWrite}; use tokio_boring2::SslStream; use tower::{ Service, ServiceBuilder, ServiceExt, timeout::TimeoutLayer, util:...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/conn/http.rs
Rust
use std::{ error::Error as StdError, fmt, future::Future, io, marker::PhantomData, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}, pin::Pin, sync::Arc, task::{self, Poll}, time::Duration, }; use futures_util::future::Either; use http::uri::{Scheme, Uri}; use pin_project_lite::pin...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/conn/proxy.rs
Rust
//! Proxy helpers #[cfg(feature = "socks")] pub mod socks; pub mod tunnel; use std::{ marker::PhantomData, pin::Pin, task::{Context, Poll}, }; use pin_project_lite::pin_project; pin_project! { // Not publicly exported (so missing_docs doesn't trigger). // // We return this `Future` instead o...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/conn/proxy/socks.rs
Rust
use std::{ borrow::Cow, task::{Context, Poll}, }; use bytes::Bytes; use http::Uri; use tokio::io::{AsyncRead, AsyncWrite}; use tokio_socks::{ TargetAddr, tcp::{Socks4Stream, Socks5Stream}, }; use tower::Service; use super::Tunneling; use crate::{ dns::{GaiResolver, InternalResolve, Name}, erro...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/conn/proxy/tunnel.rs
Rust
use std::{ io, marker::{PhantomData, Unpin}, pin::Pin, task::{self, Poll, ready}, }; use http::{HeaderMap, HeaderValue, Uri}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use tower::Service; use super::Tunneling; use crate::{error::BoxError, ext::UriExt}; /// Tunnel Proxy via HTTP CONNECT /// ///...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/conn/tls_info.rs
Rust
use bytes::Bytes; use tokio::net::TcpStream; #[cfg(unix)] use tokio::net::UnixStream; use tokio_boring2::SslStream; use crate::tls::{TlsInfo, conn::MaybeHttpsStream}; /// A trait for extracting TLS information from a connection. /// /// Implementors can provide access to peer certificate data or other TLS-related met...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/conn/uds.rs
Rust
use std::{ io, path::Path, pin::Pin, sync::Arc, task::{Context, Poll}, }; use http::Uri; use tokio::net::UnixStream; use super::{Connected, Connection}; type ConnectResult = io::Result<UnixStream>; type BoxConnecting = Pin<Box<dyn Future<Output = ConnectResult> + Send>>; #[derive(Clone)] pub str...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/conn/verbose.rs
Rust
use super::AsyncConnWithInfo; /// Controls whether to enable verbose tracing for connections. /// /// When enabled (with the `tracing` feature), connections are wrapped to log I/O operations for /// debugging. #[derive(Clone, Copy)] pub struct Verbose(pub(super) bool); impl Verbose { pub const OFF: Verbose = Verb...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core.rs
Rust
//! HTTP Client protocol implementation and low level utilities. mod common; mod dispatch; mod error; mod proto; pub mod body; pub mod conn; pub mod ext; pub mod http1; pub mod http2; pub mod rt; pub mod upgrade; pub use self::error::{Error, Result};
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/body.rs
Rust
//! Streaming bodies for Requests and Responses //! //! For both [Clients](crate::client), requests and //! responses use streaming bodies, instead of complete buffering. This //! allows applications to not use memory they don't need, and allows exerting //! back-pressure on connections by only reading when asked. //! ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/body/incoming.rs
Rust
use std::{ fmt, future::Future, pin::Pin, task::{Context, Poll, ready}, }; use bytes::Bytes; use futures_channel::{mpsc, oneshot}; use futures_util::{Stream, stream::FusedStream}; use http::HeaderMap; use http_body::{Body, Frame, SizeHint}; use super::DecodedLength; use crate::client::core::{self, Err...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/body/length.rs
Rust
use std::fmt; use crate::client::core::error::Parse; #[derive(Clone, Copy, PartialEq, Eq)] pub(crate) struct DecodedLength(u64); impl From<Option<u64>> for DecodedLength { fn from(len: Option<u64>) -> Self { len.and_then(|len| { // If the length is u64::MAX, oh well, just reported chunked. ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/common.rs
Rust
pub(crate) mod buf; pub(crate) mod rewind; pub(crate) mod watch;
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/common/buf.rs
Rust
use std::{collections::VecDeque, io::IoSlice}; use bytes::{Buf, BufMut, Bytes, BytesMut}; pub(crate) struct BufList<T> { bufs: VecDeque<T>, } impl<T: Buf> BufList<T> { pub(crate) fn new() -> BufList<T> { BufList { bufs: VecDeque::new(), } } #[inline] pub(crate) fn pus...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/common/rewind.rs
Rust
use std::{ cmp, io, pin::Pin, task::{Context, Poll}, }; use bytes::{Buf, Bytes}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; /// Combine a buffer with an IO, rewinding reads to use the buffer. #[derive(Debug)] pub(crate) struct Rewind<T> { pre: Option<Bytes>, inner: T, } impl<T> Rewind<T> { ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/common/watch.rs
Rust
//! An SPSC broadcast channel. //! //! - The value can only be a `usize`. //! - The consumer is only notified if the value is different. //! - The value `0` is reserved for closed. use std::{ sync::{ Arc, atomic::{AtomicUsize, Ordering}, }, task, }; use futures_util::task::AtomicWaker; ty...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/conn.rs
Rust
//! Lower-level client connection API. //! //! The types in this module are to provide a lower-level API based around a //! single connection. Connecting to a host, pooling connections, and the like //! are not handled at this level. This module provides the building blocks to //! customize those things externally. pu...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/conn/http1.rs
Rust
//! HTTP/1 client connections use std::{ future::Future, pin::Pin, task::{Context, Poll, ready}, }; use bytes::Bytes; use http::{Request, Response}; use http_body::Body; use httparse::ParserConfig; use tokio::io::{AsyncRead, AsyncWrite}; use crate::client::core::{ Error, Result, body::Incoming as...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/conn/http2.rs
Rust
//! HTTP/2 client connections use std::{ future::Future, marker::PhantomData, pin::Pin, task::{Context, Poll, ready}, }; use http::{Request, Response}; use http_body::Body; use tokio::io::{AsyncRead, AsyncWrite}; use crate::{ client::core::{ Result, body::Incoming as IncomingBody,...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/dispatch.rs
Rust
use std::{ future::Future, pin::Pin, task::{Context, Poll}, }; use http::{Request, Response}; use http_body::Body; use pin_project_lite::pin_project; use tokio::sync::{mpsc, oneshot}; use super::{Error, body::Incoming, proto::h2::client::ResponseFutMap}; pub(crate) type RetryPromise<T, U> = oneshot::Rece...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/error.rs
Rust
//! Error and Result module. use std::{error::Error as StdError, fmt}; /// Result type often returned from methods that can have crate::core: `Error`s. pub type Result<T> = std::result::Result<T, Error>; pub type BoxError = Box<dyn StdError + Send + Sync>; type Cause = BoxError; /// Represents errors that can occur...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/ext.rs
Rust
//! HTTP extensions. use bytes::Bytes; /// A reason phrase in an HTTP/1 response. /// /// # Clients /// /// For clients, a `ReasonPhrase` will be present in the extensions of the `http::Response` returned /// for a request if the reason phrase is different from the canonical reason phrase for the /// response's statu...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/http1.rs
Rust
//! HTTP/1 connection configuration. /// Builder for `Http1Options`. #[must_use] #[derive(Debug)] pub struct Http1OptionsBuilder { opts: Http1Options, } /// HTTP/1 protocol options for customizing connection behavior. /// /// These options allow you to customize the behavior of HTTP/1 connections, /// such as ena...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/http2.rs
Rust
//! HTTP/2 connection configuration. use std::time::Duration; pub use http2::frame::{ ExperimentalSettings, Priorities, PrioritiesBuilder, Priority, PseudoId, PseudoOrder, Setting, SettingId, SettingsOrder, SettingsOrderBuilder, StreamDependency, StreamId, }; use super::proto; // Our defaults are chosen for...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto.rs
Rust
//! Pieces pertaining to the HTTP message protocol. mod headers; pub(crate) mod h1; pub(crate) mod h2; pub(crate) use self::h1::{Conn, dispatch}; use crate::client::core::upgrade; /// An Incoming Message head. Includes request/status line, and headers. #[derive(Debug, Default)] pub(crate) struct MessageHead<S> { ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto/h1.rs
Rust
mod conn; mod decode; pub(crate) mod dispatch; mod encode; mod io; mod role; use bytes::BytesMut; use http::{HeaderMap, Method}; use httparse::ParserConfig; pub(crate) use self::{ conn::Conn, decode::Decoder, dispatch::Dispatcher, encode::{EncodedBuf, Encoder}, io::MINIMUM_MAX_BUFFER_SIZE, }; use ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto/h1/conn.rs
Rust
use std::{ fmt, io, marker::{PhantomData, Unpin}, pin::Pin, task::{Context, Poll, ready}, }; use bytes::{Buf, Bytes}; use http::{ HeaderMap, Method, Version, header::{CONNECTION, HeaderValue, TE}, }; use http_body::Frame; use httparse::ParserConfig; use tokio::io::{AsyncRead, AsyncWrite}; use ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto/h1/decode.rs
Rust
use std::{ error::Error as StdError, fmt, io, task::{Context, Poll, ready}, }; use bytes::{BufMut, Bytes, BytesMut}; use http::{HeaderMap, HeaderName, HeaderValue}; use http_body::Frame; use self::Kind::{Chunked, Eof, Length}; use super::{DecodedLength, io::MemRead, role::DEFAULT_MAX_HEADERS}; /// Maximu...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto/h1/dispatch.rs
Rust
use std::{ future::Future, marker::Unpin, pin::Pin, task::{Context, Poll, ready}, }; use bytes::{Buf, Bytes}; use http::Request; use http_body::Body; use tokio::io::{AsyncRead, AsyncWrite}; use super::{Http1Transaction, Wants}; use crate::client::core::{ Error, Result, body::{self, DecodedLeng...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto/h1/encode.rs
Rust
use std::{collections::HashSet, fmt, io::IoSlice}; use bytes::{ Buf, Bytes, buf::{Chain, Take}, }; use http::{ HeaderMap, HeaderName, header::{ AUTHORIZATION, CACHE_CONTROL, CONTENT_ENCODING, CONTENT_LENGTH, CONTENT_RANGE, CONTENT_TYPE, HOST, MAX_FORWARDS, SET_COOKIE, TE, TRAILER, TRANS...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto/h1/io.rs
Rust
use std::{ cmp, fmt, io::{self, IoSlice}, pin::Pin, task::{Context, Poll, ready}, }; use bytes::{Buf, BufMut, Bytes, BytesMut}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use super::{Http1Transaction, ParseContext, ParsedMessage}; use crate::client::core::{self, Error, common::buf::BufList}; //...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto/h1/role.rs
Rust
use std::{ fmt::{self, Write as _}, mem::MaybeUninit, }; use bytes::{Bytes, BytesMut}; use http::{ Method, StatusCode, Version, header::{self, Entry, HeaderMap, HeaderName, HeaderValue}, }; use smallvec::{SmallVec, smallvec, smallvec_inline}; use crate::{ client::core::{ self, Error, ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto/h2.rs
Rust
pub(crate) mod client; pub(crate) mod ping; use std::{ future::Future, io::{self, Cursor, IoSlice}, pin::Pin, task::{Context, Poll, ready}, }; use bytes::{Buf, Bytes}; use http::{ HeaderMap, header::{CONNECTION, HeaderName, TE, TRANSFER_ENCODING, UPGRADE}, }; use http_body::Body; use http2::{R...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto/h2/client.rs
Rust
use std::{ convert::Infallible, future::Future, marker::PhantomData, pin::Pin, task::{Context, Poll, ready}, }; use bytes::Bytes; use futures_channel::{ mpsc, mpsc::{Receiver, Sender}, oneshot, }; use futures_util::{ future::{Either, FusedFuture}, stream::{FusedStream, Stream}, ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto/h2/ping.rs
Rust
//! HTTP2 Ping usage //! //! core uses HTTP2 pings for two purposes: //! //! 1. Adaptive flow control using BDP //! 2. Connection keep-alive //! //! Both cases are optional. //! //! # BDP Algorithm //! //! 1. When receiving a DATA frame, if a BDP ping isn't outstanding: 1a. Record current time. 1b. //! Send a BDP pi...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/proto/headers.rs
Rust
use bytes::BytesMut; use http::{ HeaderMap, Method, header::{CONTENT_LENGTH, HeaderValue, ValueIter}, }; pub(super) fn connection_keep_alive(value: &HeaderValue) -> bool { connection_has(value, "keep-alive") } pub(super) fn connection_close(value: &HeaderValue) -> bool { connection_has(value, "close")...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/rt.rs
Rust
//! Runtime components //! //! The traits and types within this module are used to allow plugging in //! runtime types. These include: //! //! - Executors //! - Timers //! - IO transports pub mod bounds; mod timer; mod tokio; pub use self::{ timer::{ArcTimer, Sleep, Time, Timer}, tokio::{TokioExecutor, TokioT...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/rt/bounds.rs
Rust
//! Trait aliases //! //! Traits in this module ease setting bounds and usually automatically //! implemented by implementing another trait. pub use self::h2_client::Http2ClientConnExec; mod h2_client { use std::future::Future; use tokio::io::{AsyncRead, AsyncWrite}; use crate::client::core::{error::Box...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/rt/timer.rs
Rust
//! Provides a timer trait with timer-like functions use std::{ any::TypeId, future::Future, pin::Pin, sync::Arc, time::{Duration, Instant}, }; /// A timer which provides timer-like functions. pub trait Timer { /// Return a future that resolves in `duration` time. fn sleep(&self, duration:...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/rt/tokio.rs
Rust
//! Tokio IO integration for core. use std::{ future::Future, pin::Pin, task::{Context, Poll}, time::{Duration, Instant}, }; use pin_project_lite::pin_project; use super::{Executor, Sleep, Timer}; /// Future executor that utilises `tokio` threads. #[non_exhaustive] #[derive(Default, Debug, Clone)] pu...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/core/upgrade.rs
Rust
//! HTTP Upgrades //! //! This module deals with managing [HTTP Upgrades][mdn] in crate::core:. Since //! several concepts in HTTP allow for first talking HTTP, and then converting //! to a different protocol, this module conflates them into a single API. //! Those include: //! //! - HTTP/1.1 Upgrades //! - HTTP `CONNE...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/emulation.rs
Rust
use http::HeaderMap; use super::{ core::{http1::Http1Options, http2::Http2Options}, layer::config::TransportOptions, }; use crate::{header::OrigHeaderMap, tls::TlsOptions}; /// Factory trait for creating emulation configurations. /// /// This trait allows different types (enums, structs, etc.) to provide /// ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/http.rs
Rust
pub mod client; pub mod future; use std::{ borrow::Cow, collections::HashMap, convert::TryInto, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}, num::NonZeroUsize, sync::Arc, task::{Context, Poll}, time::Duration, }; use http::header::{HeaderMap, HeaderValue, USER_AGENT}; use tower::{ ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/http/client.rs
Rust
#[macro_use] pub mod error; mod exec; pub mod extra; mod lazy; mod pool; mod util; use std::{ future::Future, num::NonZeroUsize, pin::Pin, sync::Arc, task::{self, Poll}, time::Duration, }; use bytes::Bytes; use futures_util::future::{Either, FutureExt, TryFutureExt}; use http::{ HeaderValu...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/http/client/error.rs
Rust
use std::{error::Error as StdError, fmt}; use http::Request; use super::pool; #[cfg(feature = "socks")] use crate::client::conn::socks; use crate::{ client::{ conn::{Connected, tunnel}, core::{self}, }, error::{BoxError, ProxyConnect}, }; #[derive(Debug)] pub struct Error { pub(super)...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/http/client/exec.rs
Rust
use std::{future::Future, pin::Pin, sync::Arc}; use crate::client::core::rt::Executor; pub(crate) type BoxSendFuture = Pin<Box<dyn Future<Output = ()> + Send>>; // Either the user provides an executor for background tasks, or we use `tokio::spawn`. #[derive(Clone)] pub struct Exec(Arc<dyn Executor<BoxSendFuture> + S...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/http/client/extra.rs
Rust
use std::sync::Arc; use http::{Uri, Version}; use crate::{ client::{ conn::TcpConnectOptions, layer::config::{RequestOptions, TransportOptions}, }, hash::HashMemo, proxy::Matcher as ProxyMacher, tls::{AlpnProtocol, TlsOptions}, }; /// Unique identity for a reusable connection. pub...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/http/client/lazy.rs
Rust
use std::{ future::Future, pin::Pin, task::{self, Poll}, }; use pin_project_lite::pin_project; pub(crate) trait Started: Future { fn started(&self) -> bool; } pub(crate) fn lazy<F, R>(func: F) -> Lazy<F, R> where F: FnOnce() -> R, R: Future + Unpin, { Lazy { inner: Inner::Init { f...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/http/client/pool.rs
Rust
use std::{ collections::VecDeque, convert::Infallible, error::Error as StdError, fmt::{self, Debug}, future::Future, hash::Hash, num::NonZeroUsize, ops::{Deref, DerefMut}, pin::Pin, sync::{Arc, Weak}, task::{self, Poll, ready}, time::{Duration, Instant}, }; use futures_c...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/http/client/util.rs
Rust
use http::{ Request, Uri, uri::{Authority, PathAndQuery, Scheme}, }; use super::error::{Error, ErrorKind}; pub(super) fn origin_form(uri: &mut Uri) { let path = match uri.path_and_query() { Some(path) if path.as_str() != "/" => { let mut parts = ::http::uri::Parts::default(); ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/http/future.rs
Rust
use std::{ pin::Pin, task::{Context, Poll, ready}, }; use http::{Request, Uri}; use pin_project_lite::pin_project; use tower::util::Oneshot; use super::{Body, ClientRef, Response}; use crate::{Error, ext::RequestUri}; type ResponseFuture = Oneshot<ClientRef, Request<Body>>; pin_project! { /// [`Pending`...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer.rs
Rust
//! Middleware for the client. pub mod config; #[cfg(feature = "cookies")] pub mod cookie; #[cfg(any( feature = "gzip", feature = "zstd", feature = "brotli", feature = "deflate", ))] pub mod decoder; pub mod redirect; pub mod retry; pub mod timeout;
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/config.rs
Rust
mod options; use std::{ sync::Arc, task::{Context, Poll}, }; use futures_util::future::{self, Either, Ready}; use http::{HeaderMap, Request, Response}; use tower::{Layer, Service}; pub use self::options::{RequestOptions, TransportOptions}; use crate::{Error, config::RequestConfig, ext::UriExt, header::OrigHe...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/config/options.rs
Rust
use http::Version; use crate::{ client::{ conn::TcpConnectOptions, core::{http1::Http1Options, http2::Http2Options}, }, proxy::Matcher, tls::TlsOptions, }; /// Per-request configuration for proxy, protocol, and transport options. /// Overrides client defaults for a single request. #[de...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/cookie.rs
Rust
//! Middleware to use Cookie. use std::{ future::Future, pin::Pin, sync::Arc, task::{Context, Poll, ready}, }; use http::{Request, Response, Uri, header::COOKIE}; use pin_project_lite::pin_project; use tower::{Layer, Service}; use crate::{ config::RequestConfig, cookie::{CookieStore, Cookies}...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/decoder.rs
Rust
//! Middleware for decoding use std::task::{Context, Poll}; use http::{Request, Response}; use http_body::Body; use tower::{Layer, Service}; use tower_http::decompression::{self, DecompressionBody, ResponseFuture}; use crate::config::RequestConfig; /// Configuration for supported content-encoding algorithms. /// //...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/redirect.rs
Rust
//! Middleware for following redirections. mod future; mod policy; use std::{ mem, task::{Context, Poll}, }; use futures_util::future::Either; use http::{Request, Response}; use http_body::Body; use tower::{Layer, Service}; use self::future::ResponseFuture; pub use self::policy::{Action, Attempt, Policy}; u...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/redirect/future.rs
Rust
use std::{ future::Future, pin::Pin, str, task::{Context, Poll, ready}, }; use futures_util::future::Either; use http::{ HeaderMap, Method, Request, Response, StatusCode, Uri, header::{CONTENT_ENCODING, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, TRANSFER_ENCODING}, request::Parts, }; use http_...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/redirect/policy.rs
Rust
//! Tools for customizing the behavior of a [`FollowRedirect`][super::FollowRedirect] middleware. use std::{fmt, pin::Pin}; use http::{HeaderMap, Request, Response, StatusCode, Uri}; use crate::error::BoxError; /// Trait for the policy on handling redirection responses. pub trait Policy<B, E> { /// Invoked when...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/retry.rs
Rust
//! Middleware for retrying requests. mod classify; mod scope; use std::{error::Error as StdError, future::Ready, sync::Arc, time::Duration}; use http::{Request, Response}; use tower::retry::{ Policy, budget::{Budget, TpsBudget}, }; pub(crate) use self::{ classify::{Action, Classifier, ClassifyFn, ReqRe...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/retry/classify.rs
Rust
use std::{error::Error as StdError, sync::Arc}; use http::{Method, StatusCode, Uri}; use super::{Req, Res}; use crate::error::BoxError; pub trait Classify: Send + Sync + 'static { fn classify(&self, req_rep: ReqRep<'_>) -> Action; } // For Future Whoever: making a blanket impl for any closure sounds nice, // bu...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/retry/scope.rs
Rust
use std::sync::Arc; use super::Req; pub trait Scope: Send + Sync + 'static { fn applies_to(&self, req: &super::Req) -> bool; } // I think scopes likely make the most sense being to hosts. // If that's the case, then it should probably be easiest to check for // the host. Perhaps also considering the ability to a...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/timeout.rs
Rust
//! Middleware for setting a timeout on the response. mod body; mod future; use std::{ task::{Context, Poll}, time::Duration, }; use http::{Request, Response}; use tower::{Layer, Service}; pub use self::body::TimeoutBody; use self::future::{ResponseBodyTimeoutFuture, ResponseFuture}; use crate::{config::Req...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/timeout/body.rs
Rust
use std::{ future::Future, pin::Pin, task::{Context, Poll, ready}, time::Duration, }; use http_body::Body; use pin_project_lite::pin_project; use tokio::time::{Sleep, sleep}; use crate::{ Error, error::{BoxError, TimedOut}, }; pin_project! { /// A wrapper body that applies timeout strateg...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/layer/timeout/future.rs
Rust
use std::{ future::Future, pin::Pin, task::{Context, Poll, ready}, time::Duration, }; use http::Response; use pin_project_lite::pin_project; use tokio::time::Sleep; use super::body::TimeoutBody; use crate::error::{BoxError, Error, TimedOut}; pin_project! { /// [`Timeout`] response future pub ...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67
src/client/multipart.rs
Rust
//! multipart/form-data use std::{borrow::Cow, pin::Pin}; use bytes::Bytes; use futures_util::{Stream, StreamExt, future, stream}; use http_body_util::BodyExt; use mime_guess::Mime; use percent_encoding::{self, AsciiSet, NON_ALPHANUMERIC}; #[cfg(feature = "stream")] use {std::io, std::path::Path, tokio::fs::File}; u...
0x676e67/wreq
630
An ergonomic Rust HTTP Client with TLS fingerprint
Rust
0x676e67