repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/response/response.rs | actix-web/src/response/response.rs | use std::{
cell::{Ref, RefMut},
fmt,
};
use actix_http::{
body::{BoxBody, EitherBody, MessageBody},
header::HeaderMap,
Extensions, Response, ResponseHead, StatusCode,
};
#[cfg(feature = "cookies")]
use {
actix_http::{
error::HttpError,
header::{self, HeaderValue},
},
coo... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/response/responder.rs | actix-web/src/response/responder.rs | use std::borrow::Cow;
use actix_http::{
body::{BoxBody, EitherBody, MessageBody},
header::TryIntoHeaderPair,
StatusCode,
};
use bytes::{Bytes, BytesMut};
use super::CustomizeResponder;
use crate::{Error, HttpRequest, HttpResponse};
/// Trait implemented by types that can be converted to an HTTP response.... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/response/mod.rs | actix-web/src/response/mod.rs | mod builder;
mod customize_responder;
mod http_codes;
mod responder;
#[allow(clippy::module_inception)]
mod response;
pub use self::{
builder::HttpResponseBuilder, customize_responder::CustomizeResponder, responder::Responder,
response::HttpResponse,
};
| rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/response/customize_responder.rs | actix-web/src/response/customize_responder.rs | use actix_http::{
body::EitherBody,
error::HttpError,
header::{HeaderMap, TryIntoHeaderPair},
StatusCode,
};
use crate::{HttpRequest, HttpResponse, Responder};
/// Allows overriding status code and headers (including cookies) for a [`Responder`].
///
/// Created by calling the [`customize`](Responder:... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/response/http_codes.rs | actix-web/src/response/http_codes.rs | //! Status code based HTTP response builders.
use actix_http::StatusCode;
use crate::{HttpResponse, HttpResponseBuilder};
macro_rules! static_resp {
($name:ident, $status:expr) => {
#[allow(non_snake_case)]
#[doc = concat!("Creates a new response builder with the status code `", stringify!($statu... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/mod.rs | actix-web/src/http/mod.rs | //! Various HTTP related types.
pub mod header;
pub use actix_http::{uri, ConnectionType, Error, KeepAlive, Method, StatusCode, Uri, Version};
| rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/if_range.rs | actix-web/src/http/header/if_range.rs | use std::fmt::{self, Display, Write};
use super::{
from_one_raw_str, EntityTag, Header, HeaderName, HeaderValue, HttpDate, InvalidHeaderValue,
TryIntoHeaderValue, Writer,
};
use crate::{error::ParseError, http::header, HttpMessage};
/// `If-Range` header, defined
/// in [RFC 7233 §3.2](https://datatracker.iet... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/content_language.rs | actix-web/src/http/header/content_language.rs | use language_tags::LanguageTag;
use super::{common_header, QualityItem, CONTENT_LANGUAGE};
common_header! {
/// `Content-Language` header, defined
/// in [RFC 7231 §3.1.3.2](https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.3.2)
///
/// The `Content-Language` header field describes the natural... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/date.rs | actix-web/src/http/header/date.rs | use std::time::SystemTime;
use super::{HttpDate, DATE};
crate::http::header::common_header! {
/// `Date` header, defined
/// in [RFC 7231 §7.1.1.2](https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.1.2)
///
/// The `Date` header field represents the date and time at which the
/// message w... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/range.rs | actix-web/src/http/header/range.rs | use std::{
cmp,
fmt::{self, Display, Write},
str::FromStr,
};
use actix_http::{error::ParseError, header, HttpMessage};
use super::{Header, HeaderName, HeaderValue, InvalidHeaderValue, TryIntoHeaderValue, Writer};
/// `Range` header, defined
/// in [RFC 7233 §3.1](https://datatracker.ietf.org/doc/html/rf... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/entity.rs | actix-web/src/http/header/entity.rs | use std::{
fmt::{self, Display, Write},
str::FromStr,
};
use super::{HeaderValue, InvalidHeaderValue, TryIntoHeaderValue, Writer};
/// check that each char in the slice is either:
/// 1. `%x21`, or
/// 2. in the range `%x23` to `%x7E`, or
/// 3. above `%x80`
fn entity_validate_char(c: u8) -> bool {
c == 0... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/content_length.rs | actix-web/src/http/header/content_length.rs | use std::{convert::Infallible, str};
use derive_more::{Deref, DerefMut};
use crate::{
error::ParseError,
http::header::{
from_one_raw_str, Header, HeaderName, HeaderValue, TryIntoHeaderValue, CONTENT_LENGTH,
},
HttpMessage,
};
/// `Content-Length` header, defined in [RFC 9110 §8.6].
///
/// T... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/content_disposition.rs | actix-web/src/http/header/content_disposition.rs | //! The `Content-Disposition` header and associated types.
//!
//! # References
//! - "The Content-Disposition Header Field":
//! <https://datatracker.ietf.org/doc/html/rfc2183>
//! - "The Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)":
//! <https://datatracker.ietf.org/doc/html/rfc6266... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | true |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/accept.rs | actix-web/src/http/header/accept.rs | use std::cmp::Ordering;
use mime::Mime;
use super::{common_header, QualityItem};
use crate::http::header;
common_header! {
/// `Accept` header, defined in [RFC 7231 §5.3.2].
///
/// The `Accept` header field can be used by user agents to specify
/// response media types that are acceptable. Accept he... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/allow.rs | actix-web/src/http/header/allow.rs | use actix_http::Method;
use crate::http::header;
crate::http::header::common_header! {
/// `Allow` header, defined
/// in [RFC 7231 §7.4.1](https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1)
///
/// The `Allow` header field lists the set of methods advertised as
/// supported by the targ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/cache_control.rs | actix-web/src/http/header/cache_control.rs | use std::{fmt, str};
use super::common_header;
use crate::http::header;
common_header! {
/// `Cache-Control` header, defined
/// in [RFC 7234 §5.2](https://datatracker.ietf.org/doc/html/rfc7234#section-5.2).
///
/// The `Cache-Control` header field is used to specify directives for
/// caches alon... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/if_modified_since.rs | actix-web/src/http/header/if_modified_since.rs | use super::{HttpDate, IF_MODIFIED_SINCE};
crate::http::header::common_header! {
/// `If-Modified-Since` header, defined
/// in [RFC 7232 §3.3](https://datatracker.ietf.org/doc/html/rfc7232#section-3.3)
///
/// The `If-Modified-Since` header field makes a GET or HEAD request
/// method conditional o... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/content_range.rs | actix-web/src/http/header/content_range.rs | use std::{
fmt::{self, Display, Write},
str::FromStr,
};
use super::{HeaderValue, InvalidHeaderValue, TryIntoHeaderValue, Writer, CONTENT_RANGE};
use crate::error::ParseError;
crate::http::header::common_header! {
/// `Content-Range` header, defined
/// in [RFC 7233 §4.2](https://datatracker.ietf.org/... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/content_type.rs | actix-web/src/http/header/content_type.rs | use mime::Mime;
use super::CONTENT_TYPE;
crate::http::header::common_header! {
/// `Content-Type` header, defined in [RFC 9110 §8.3].
///
/// The `Content-Type` header field indicates the media type of the associated representation:
/// either the representation enclosed in the message payload or the ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/if_match.rs | actix-web/src/http/header/if_match.rs | use super::{common_header, EntityTag, IF_MATCH};
common_header! {
/// `If-Match` header, defined
/// in [RFC 7232 §3.1](https://datatracker.ietf.org/doc/html/rfc7232#section-3.1)
///
/// The `If-Match` header field makes the request method conditional on
/// the recipient origin server either havin... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/any_or_some.rs | actix-web/src/http/header/any_or_some.rs | use std::{
fmt::{self, Write as _},
str,
};
/// A wrapper for types used in header values where wildcard (`*`) items are allowed but the
/// underlying type does not support them.
///
/// For example, we use the `language-tags` crate for the [`AcceptLanguage`](super::AcceptLanguage)
/// typed header but it doe... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/macros.rs | actix-web/src/http/header/macros.rs | macro_rules! common_header_test_module {
($id:ident, $tm:ident{$($tf:item)*}) => {
#[cfg(test)]
mod $tm {
#![allow(unused_imports)]
use ::core::str;
use ::actix_http::{Method, test};
use ::mime::*;
use $crate::http::header::{self, *};
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/preference.rs | actix-web/src/http/header/preference.rs | use std::{
fmt::{self, Write as _},
str,
};
/// A wrapper for types used in header values where wildcard (`*`) items are allowed but the
/// underlying type does not support them.
///
/// For example, we use the `language-tags` crate for the [`AcceptLanguage`](super::AcceptLanguage)
/// typed header but it doe... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/mod.rs | actix-web/src/http/header/mod.rs | //! A Collection of Header implementations for common HTTP Headers.
//!
//! ## Mime Types
//! Several header fields use MIME values for their contents. Keeping with the strongly-typed theme,
//! the [mime] crate is used in such headers as [`ContentType`] and [`Accept`].
use std::fmt;
// re-export from actix-http
// -... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/accept_charset.rs | actix-web/src/http/header/accept_charset.rs | use super::{common_header, Charset, QualityItem, ACCEPT_CHARSET};
common_header! {
/// `Accept-Charset` header, defined in [RFC 7231 §5.3.3].
///
/// The `Accept-Charset` header field can be sent by a user agent to
/// indicate what charsets are acceptable in textual response content.
/// This fiel... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/last_modified.rs | actix-web/src/http/header/last_modified.rs | use super::{HttpDate, LAST_MODIFIED};
crate::http::header::common_header! {
/// `Last-Modified` header, defined
/// in [RFC 7232 §2.2](https://datatracker.ietf.org/doc/html/rfc7232#section-2.2)
///
/// The `Last-Modified` header field in a response provides a timestamp
/// indicating the date and t... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/if_unmodified_since.rs | actix-web/src/http/header/if_unmodified_since.rs | use super::{HttpDate, IF_UNMODIFIED_SINCE};
crate::http::header::common_header! {
/// `If-Unmodified-Since` header, defined
/// in [RFC 7232 §3.4](https://datatracker.ietf.org/doc/html/rfc7232#section-3.4)
///
/// The `If-Unmodified-Since` header field makes the request method
/// conditional on th... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/if_none_match.rs | actix-web/src/http/header/if_none_match.rs | use super::{EntityTag, IF_NONE_MATCH};
crate::http::header::common_header! {
/// `If-None-Match` header, defined
/// in [RFC 7232 §3.2](https://datatracker.ietf.org/doc/html/rfc7232#section-3.2)
///
/// The `If-None-Match` header field makes the request method conditional
/// on a recipient cache o... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/etag.rs | actix-web/src/http/header/etag.rs | use super::{EntityTag, ETAG};
crate::http::header::common_header! {
/// `ETag` header, defined in
/// [RFC 7232 §2.3](https://datatracker.ietf.org/doc/html/rfc7232#section-2.3)
///
/// The `ETag` header field in a response provides the current entity-tag
/// for the selected representation, as dete... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/accept_encoding.rs | actix-web/src/http/header/accept_encoding.rs | use std::collections::HashSet;
use super::{common_header, ContentEncoding, Encoding, Preference, Quality, QualityItem};
use crate::http::header;
common_header! {
/// `Accept-Encoding` header, defined
/// in [RFC 7231](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.4)
///
/// The `Accept-Enc... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/encoding.rs | actix-web/src/http/header/encoding.rs | use std::{fmt, str};
use actix_http::ContentEncoding;
/// A value to represent an encoding used in the `Accept-Encoding` and `Content-Encoding` header.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Encoding {
/// A supported content encoding. See [`ContentEncoding`] for variants.
Known(ContentEncoding... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/accept_language.rs | actix-web/src/http/header/accept_language.rs | use language_tags::LanguageTag;
use super::{common_header, Preference, Quality, QualityItem};
use crate::http::header;
common_header! {
/// `Accept-Language` header, defined
/// in [RFC 7231 §5.3.5](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.5)
///
/// The `Accept-Language` header field... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/src/http/header/expires.rs | actix-web/src/http/header/expires.rs | use super::{HttpDate, EXPIRES};
crate::http::header::common_header! {
/// `Expires` header, defined
/// in [RFC 7234 §5.3](https://datatracker.ietf.org/doc/html/rfc7234#section-5.3)
///
/// The `Expires` header field gives the date/time after which the
/// response is considered stale.
///
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/tests/test_streaming_response.rs | actix-web/tests/test_streaming_response.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use actix_web::{
http::header::{self, HeaderValue},
HttpResponse,
};
use bytes::Bytes;
use futures_core::Stream;
struct FixedSizeStream {
data: Vec<u8>,
yielded: bool,
}
impl FixedSizeStream {
fn new(size: usize) -> Self {
Self {
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/tests/weird_poll.rs | actix-web/tests/weird_poll.rs | //! Regression test for https://github.com/actix/actix-web/issues/1321
// use actix_http::body::{BodyStream, MessageBody};
// use bytes::Bytes;
// use futures_channel::oneshot;
// use futures_util::{
// stream::once,
// task::{noop_waker, Context},
// };
// #[test]
// fn weird_poll() {
// let (sender, rec... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/tests/test_server.rs | actix-web/tests/test_server.rs | #[cfg(feature = "openssl")]
extern crate tls_openssl as openssl;
#[cfg(feature = "rustls-0_23")]
extern crate tls_rustls as rustls;
use std::{
future::Future,
io::{Read, Write},
pin::Pin,
task::{Context, Poll},
time::Duration,
};
use actix_web::{
cookie::Cookie,
http::{header, StatusCode},... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/tests/test_weird_poll.rs | actix-web/tests/test_weird_poll.rs | //! Regression test for https://github.com/actix/actix-web/issues/1321
// use actix_http::body::{BodyStream, MessageBody};
// use bytes::Bytes;
// use futures_channel::oneshot;
// use futures_util::{
// stream::once,
// task::{noop_waker, Context},
// };
// #[test]
// fn weird_poll() {
// let (sender, rec... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/tests/test-macro-import-conflict.rs | actix-web/tests/test-macro-import-conflict.rs | //! Checks that test macro does not cause problems in the presence of imports named "test" that
//! could be either a module with test items or the "test with runtime" macro itself.
//!
//! Before actix/actix-net#399 was implemented, this macro was running twice. The first run output
//! `#[test]` and it got run again ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/tests/test_httpserver.rs | actix-web/tests/test_httpserver.rs | #[cfg(feature = "openssl")]
extern crate tls_openssl as openssl;
use std::{sync::mpsc, thread, time::Duration};
use actix_web::{web, App, HttpResponse, HttpServer};
#[actix_rt::test]
async fn test_start() {
let addr = actix_test::unused_addr();
let (tx, rx) = mpsc::channel();
thread::spawn(move || {
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/tests/test_error_propagation.rs | actix-web/tests/test_error_propagation.rs | use std::sync::Arc;
use actix_utils::future::{ok, Ready};
use actix_web::{
dev::{forward_ready, Service, ServiceRequest, ServiceResponse, Transform},
get,
test::{call_service, init_service, TestRequest},
ResponseError,
};
use futures_core::future::LocalBoxFuture;
use futures_util::lock::Mutex;
#[deriv... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/tests/utils.rs | actix-web/tests/utils.rs | // compiling some tests will trigger unused function warnings even though other tests use them
#![allow(dead_code)]
use std::io::{Read as _, Write as _};
pub mod gzip {
use flate2::{read::GzDecoder, write::GzEncoder, Compression};
use super::*;
pub fn encode(bytes: impl AsRef<[u8]>) -> Vec<u8> {
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/tests/compression.rs | actix-web/tests/compression.rs | use actix_http::ContentEncoding;
use actix_web::{
http::{header, StatusCode},
middleware::Compress,
web, App, HttpResponse,
};
use bytes::Bytes;
mod utils;
static LOREM: &[u8] = include_bytes!("fixtures/lorem.txt");
static LOREM_GZIP: &[u8] = include_bytes!("fixtures/lorem.txt.gz");
static LOREM_BR: &[u8]... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/benches/responder.rs | actix-web/benches/responder.rs | use std::{future::Future, time::Instant};
use actix_http::body::BoxBody;
use actix_utils::future::{ready, Ready};
use actix_web::{http::StatusCode, test::TestRequest, Error, HttpRequest, HttpResponse, Responder};
use criterion::{criterion_group, criterion_main, Criterion};
use futures_util::future::join_all;
// respo... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/benches/service.rs | actix-web/benches/service.rs | use std::{cell::RefCell, rc::Rc};
use actix_service::Service;
use actix_web::{
dev::{ServiceRequest, ServiceResponse},
test::{init_service, ok_service, TestRequest},
web, App, Error, HttpResponse,
};
use criterion::{criterion_main, Criterion};
/// Criterion Benchmark for async Service
/// Should be used f... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/benches/server.rs | actix-web/benches/server.rs | use actix_web::{web, App, HttpResponse};
use awc::Client;
use criterion::{criterion_group, criterion_main, Criterion};
use futures_util::future::join_all;
const STR: &str = "Hello World Hello World Hello World Hello World Hello World \
Hello World Hello World Hello World Hello World Hello World \
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/examples/on-connect.rs | actix-web/examples/on-connect.rs | //! This example shows how to use `actix_web::HttpServer::on_connect` to access a lower-level socket
//! properties and pass them to a handler through request-local data.
//!
//! For an example of extracting a client TLS certificate, see:
//! <https://github.com/actix/examples/tree/main/https-tls/rustls-client-cert>
u... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/examples/middleware_from_fn.rs | actix-web/examples/middleware_from_fn.rs | //! Shows a couple of ways to use the `from_fn` middleware.
use std::{collections::HashMap, io, rc::Rc, time::Duration};
use actix_web::{
body::MessageBody,
dev::{Service, ServiceRequest, ServiceResponse, Transform},
http::header::{self, HeaderValue, Range},
middleware::{from_fn, Logger, Next},
we... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/examples/worker-cpu-pin.rs | actix-web/examples/worker-cpu-pin.rs | use std::{
io,
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
},
thread,
};
use actix_web::{middleware, web, App, HttpServer};
async fn hello() -> &'static str {
"Hello world!"
}
#[actix_web::main]
async fn main() -> io::Result<()> {
env_logger::init_from_env(env_logger::Env::n... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/examples/from_fn.rs | actix-web/examples/from_fn.rs | //! Shows a few of ways to use the `from_fn` middleware.
use std::{collections::HashMap, io, rc::Rc, time::Duration};
use actix_web::{
body::MessageBody,
dev::{Service, ServiceRequest, ServiceResponse, Transform},
http::header::{self, HeaderValue, Range},
middleware::{from_fn, Logger, Next},
web::... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/examples/basic.rs | actix-web/examples/basic.rs | use actix_web::{get, middleware, web, App, HttpRequest, HttpResponse, HttpServer};
#[get("/resource1/{name}/index.html")]
async fn index(req: HttpRequest, name: web::Path<String>) -> String {
println!("REQ: {:?}", req);
format!("Hello: {}!\r\n", name)
}
async fn index_async(req: HttpRequest) -> &'static str {... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/examples/uds.rs | actix-web/examples/uds.rs | use actix_web::{get, web, HttpRequest};
#[cfg(unix)]
use actix_web::{middleware, App, Error, HttpResponse, HttpServer};
#[get("/resource1/{name}/index.html")]
async fn index(req: HttpRequest, name: web::Path<String>) -> String {
println!("REQ: {:?}", req);
format!("Hello: {}!\r\n", name)
}
#[cfg(unix)]
async ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-web/examples/macroless.rs | actix-web/examples/macroless.rs | use actix_web::{middleware, rt, web, App, HttpRequest, HttpServer};
async fn index(req: HttpRequest) -> &'static str {
println!("REQ: {:?}", req);
"Hello world!\r\n"
}
fn main() -> std::io::Result<()> {
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
rt::System::new().blo... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-test/src/lib.rs | actix-test/src/lib.rs | //! Integration testing tools for Actix Web applications.
//!
//! The main integration testing tool is [`TestServer`]. It spawns a real HTTP server on an
//! unused port and provides methods that use a real HTTP client. Therefore, it is much closer to
//! real-world cases than using `init_service`, which skips HTTP enc... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/config.rs | actix-http/src/config.rs | use std::{
net::SocketAddr,
rc::Rc,
time::{Duration, Instant},
};
use bytes::BytesMut;
use crate::{date::DateService, KeepAlive};
/// A builder for creating a [`ServiceConfig`]
#[derive(Default, Debug)]
pub struct ServiceConfigBuilder {
inner: Inner,
}
impl ServiceConfigBuilder {
/// Creates a n... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/test.rs | actix-http/src/test.rs | //! Various testing helpers for use in internal and app tests.
use std::{
cell::{Ref, RefCell, RefMut},
io::{self, Read, Write},
pin::Pin,
rc::Rc,
str::FromStr,
task::{Context, Poll},
};
use actix_codec::{AsyncRead, AsyncWrite, ReadBuf};
use bytes::{Bytes, BytesMut};
use http::{header, Method,... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/date.rs | actix-http/src/date.rs | use std::{
cell::Cell,
fmt::{self, Write},
rc::Rc,
time::{Duration, Instant, SystemTime},
};
use actix_rt::{task::JoinHandle, time::interval};
/// "Thu, 01 Jan 1970 00:00:00 GMT".len()
pub(crate) const DATE_VALUE_LENGTH: usize = 29;
#[derive(Clone, Copy)]
pub(crate) struct Date {
pub(crate) bytes... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/builder.rs | actix-http/src/builder.rs | use std::{fmt, marker::PhantomData, net, rc::Rc, time::Duration};
use actix_codec::Framed;
use actix_service::{IntoServiceFactory, Service, ServiceFactory};
use crate::{
body::{BoxBody, MessageBody},
h1::{self, ExpectHandler, H1Service, UpgradeHandler},
service::HttpService,
ConnectCallback, Extension... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/lib.rs | actix-http/src/lib.rs | //! HTTP types and services for the Actix ecosystem.
//!
//! ## Crate Features
//!
//! | Feature | Functionality |
//! | ------------------- | ------------------------------------------- |
//! | `http2` | HTTP/2 support via [h2]. |
//! | `openssl`... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/notify_on_drop.rs | actix-http/src/notify_on_drop.rs | /// Test Module for checking the drop state of certain async tasks that are spawned
/// with `actix_rt::spawn`
///
/// The target task must explicitly generate `NotifyOnDrop` when spawn the task
use std::cell::RefCell;
thread_local! {
static NOTIFY_DROPPED: RefCell<Option<bool>> = const { RefCell::new(None) };
}
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/helpers.rs | actix-http/src/helpers.rs | use std::io;
use bytes::BufMut;
use http::Version;
const DIGITS_START: u8 = b'0';
pub(crate) fn write_status_line<B: BufMut>(version: Version, n: u16, buf: &mut B) {
match version {
Version::HTTP_11 => buf.put_slice(b"HTTP/1.1 "),
Version::HTTP_10 => buf.put_slice(b"HTTP/1.0 "),
Version::... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/keep_alive.rs | actix-http/src/keep_alive.rs | use std::time::Duration;
/// Connection keep-alive config.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum KeepAlive {
/// Keep-alive duration.
///
/// `KeepAlive::Timeout(Duration::ZERO)` is mapped to `KeepAlive::Disabled`.
Timeout(Duration),
/// Rely on OS to shutdown TCP connection.
/... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/error.rs | actix-http/src/error.rs | //! Error and Result module
use std::{error::Error as StdError, fmt, io, str::Utf8Error, string::FromUtf8Error};
use derive_more::{Display, Error, From};
pub use http::{status::InvalidStatusCode, Error as HttpError};
use http::{uri::InvalidUri, StatusCode};
use crate::{body::BoxBody, Response};
pub struct Error {
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/service.rs | actix-http/src/service.rs | use std::{
fmt,
future::Future,
marker::PhantomData,
net,
pin::Pin,
rc::Rc,
task::{Context, Poll},
};
use actix_codec::{AsyncRead, AsyncWrite, Framed};
use actix_rt::net::TcpStream;
use actix_service::{
fn_service, IntoServiceFactory, Service, ServiceFactory, ServiceFactoryExt as _,
};
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | true |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/extensions.rs | actix-http/src/extensions.rs | use std::{
any::{Any, TypeId},
collections::HashMap,
fmt,
hash::{BuildHasherDefault, Hasher},
};
/// A hasher for `TypeId`s that takes advantage of its known characteristics.
///
/// Author of `anymap` crate has done research on the topic:
/// https://github.com/chris-morgan/anymap/blob/2e9a5704/src/li... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/payload.rs | actix-http/src/payload.rs | use std::{
mem,
pin::Pin,
task::{Context, Poll},
};
use bytes::Bytes;
use futures_core::Stream;
use pin_project_lite::pin_project;
use crate::error::PayloadError;
/// A boxed payload stream.
pub type BoxedPayloadStream = Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>>>>;
#[doc(hidden)]
#[deprecat... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/http_message.rs | actix-http/src/http_message.rs | use std::{
cell::{Ref, RefMut},
str,
};
use encoding_rs::{Encoding, UTF_8};
use http::header;
use mime::Mime;
use crate::{
error::{ContentTypeError, ParseError},
header::{Header, HeaderMap},
payload::Payload,
Extensions,
};
/// Trait that implements general purpose operations on HTTP messages... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/message.rs | actix-http/src/message.rs | use std::{cell::RefCell, ops, rc::Rc};
use bitflags::bitflags;
/// Represents various types of connection
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ConnectionType {
/// Close connection after response.
Close,
/// Keep connection alive after response.
KeepAlive,
/// Connection is upgr... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/encoding/encoder.rs | actix-http/src/encoding/encoder.rs | //! Stream encoders.
use std::{
error::Error as StdError,
future::Future,
io::{self, Write as _},
pin::Pin,
task::{Context, Poll},
};
use actix_rt::task::{spawn_blocking, JoinHandle};
use bytes::Bytes;
use derive_more::Display;
#[cfg(feature = "compress-gzip")]
use flate2::write::{GzEncoder, ZlibE... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/encoding/decoder.rs | actix-http/src/encoding/decoder.rs | //! Stream decoders.
use std::{
future::Future,
io::{self, Write as _},
pin::Pin,
task::{Context, Poll},
};
use actix_rt::task::{spawn_blocking, JoinHandle};
use bytes::Bytes;
#[cfg(feature = "compress-gzip")]
use flate2::write::{GzDecoder, ZlibDecoder};
use futures_core::{ready, Stream};
#[cfg(featur... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/encoding/mod.rs | actix-http/src/encoding/mod.rs | //! Content-Encoding support.
use std::io;
use bytes::{Bytes, BytesMut};
mod decoder;
mod encoder;
pub use self::{decoder::Decoder, encoder::Encoder};
/// Special-purpose writer for streaming (de-)compression.
///
/// Pre-allocates 8KiB of capacity.
struct Writer {
buf: BytesMut,
}
impl Writer {
fn new() ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/requests/mod.rs | actix-http/src/requests/mod.rs | //! HTTP requests.
mod head;
mod request;
pub use self::{
head::{RequestHead, RequestHeadType},
request::Request,
};
| rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/requests/head.rs | actix-http/src/requests/head.rs | use std::{net, rc::Rc};
use crate::{
header::{self, HeaderMap},
message::{Flags, Head, MessagePool},
ConnectionType, Method, Uri, Version,
};
thread_local! {
static REQUEST_POOL: MessagePool<RequestHead> = MessagePool::<RequestHead>::create()
}
#[derive(Debug, Clone)]
pub struct RequestHead {
pub... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/requests/request.rs | actix-http/src/requests/request.rs | //! HTTP requests.
use std::{
cell::{Ref, RefCell, RefMut},
fmt, mem, net,
rc::Rc,
str,
};
use http::{header, Method, Uri, Version};
use crate::{
header::HeaderMap, BoxedPayloadStream, Extensions, HttpMessage, Message, Payload, RequestHead,
};
/// An HTTP request.
pub struct Request<P = BoxedPay... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h2/dispatcher.rs | actix-http/src/h2/dispatcher.rs | use std::{
cmp,
error::Error as StdError,
future::Future,
marker::PhantomData,
net,
pin::{pin, Pin},
rc::Rc,
task::{Context, Poll},
};
use actix_codec::{AsyncRead, AsyncWrite};
use actix_rt::time::{sleep, Sleep};
use actix_service::Service;
use actix_utils::future::poll_fn;
use bytes::{... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h2/service.rs | actix-http/src/h2/service.rs | use std::{
future::Future,
marker::PhantomData,
mem, net,
pin::Pin,
rc::Rc,
task::{Context, Poll},
};
use actix_codec::{AsyncRead, AsyncWrite};
use actix_rt::net::TcpStream;
use actix_service::{
fn_factory, fn_service, IntoServiceFactory, Service, ServiceFactory, ServiceFactoryExt as _,
};
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h2/mod.rs | actix-http/src/h2/mod.rs | //! HTTP/2 protocol.
use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
};
use actix_codec::{AsyncRead, AsyncWrite};
use actix_rt::time::{sleep_until, Sleep};
use bytes::Bytes;
use futures_core::{ready, Stream};
use h2::{
server::{handshake, Connection, Handshake},
RecvStream,
};
use cra... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/ws/codec.rs | actix-http/src/ws/codec.rs | use bitflags::bitflags;
use bytes::{Bytes, BytesMut};
use bytestring::ByteString;
use tokio_util::codec::{Decoder, Encoder};
use tracing::error;
use super::{
frame::Parser,
proto::{CloseReason, OpCode},
ProtocolError,
};
/// A WebSocket message.
#[derive(Debug, PartialEq, Eq)]
pub enum Message {
/// T... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/ws/dispatcher.rs | actix-http/src/ws/dispatcher.rs | use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
};
use actix_codec::{AsyncRead, AsyncWrite, Framed};
use actix_service::{IntoService, Service};
use pin_project_lite::pin_project;
use super::{Codec, Frame, Message};
pin_project! {
pub struct Dispatcher<S, T>
where
S: Service<Fr... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/ws/mask.rs | actix-http/src/ws/mask.rs | //! This is code from [Tungstenite project](https://github.com/snapview/tungstenite-rs)
/// Mask/unmask a frame.
#[inline]
pub fn apply_mask(buf: &mut [u8], mask: [u8; 4]) {
apply_mask_fast32(buf, mask)
}
/// A safe unoptimized mask application.
#[inline]
fn apply_mask_fallback(buf: &mut [u8], mask: [u8; 4]) {
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/ws/mod.rs | actix-http/src/ws/mod.rs | //! WebSocket protocol implementation.
//!
//! To setup a WebSocket, first perform the WebSocket handshake then on success convert `Payload` into a
//! `WsStream` stream and then use `WsWriter` to communicate with the peer.
use std::io;
use derive_more::{Display, Error, From};
use http::{header, Method, StatusCode};
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/ws/frame.rs | actix-http/src/ws/frame.rs | use std::cmp::min;
use bytes::{Buf, BufMut, BytesMut};
use tracing::debug;
use super::{
mask::apply_mask,
proto::{CloseCode, CloseReason, OpCode},
ProtocolError,
};
/// A struct representing a WebSocket frame.
#[derive(Debug)]
pub struct Parser;
impl Parser {
fn parse_metadata(
src: &[u8],
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/ws/proto.rs | actix-http/src/ws/proto.rs | use std::fmt;
use base64::prelude::*;
use tracing::error;
/// Operation codes defined in [RFC 6455 §11.8].
///
/// [RFC 6455]: https://datatracker.ietf.org/doc/html/rfc6455#section-11.8
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
pub enum OpCode {
/// Indicates a continuation frame of a fragmented message.
C... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/body/none.rs | actix-http/src/body/none.rs | use std::{
convert::Infallible,
pin::Pin,
task::{Context, Poll},
};
use bytes::Bytes;
use super::{BodySize, MessageBody};
/// Body type for responses that forbid payloads.
///
/// This is distinct from an "empty" response which _would_ contain a `Content-Length` header.
/// For an "empty" body, use `()` ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/body/sized_stream.rs | actix-http/src/body/sized_stream.rs | use std::{
error::Error as StdError,
pin::Pin,
task::{Context, Poll},
};
use bytes::Bytes;
use futures_core::{ready, Stream};
use pin_project_lite::pin_project;
use super::{BodySize, MessageBody};
pin_project! {
/// Known sized streaming response wrapper.
///
/// This body implementation shou... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/body/either.rs | actix-http/src/body/either.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use bytes::Bytes;
use pin_project_lite::pin_project;
use super::{BodySize, BoxBody, MessageBody};
use crate::Error;
pin_project! {
/// An "either" type specialized for body types.
///
/// It is common, in middleware especially, to conditionally retur... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/body/utils.rs | actix-http/src/body/utils.rs | use std::task::Poll;
use actix_rt::pin;
use actix_utils::future::poll_fn;
use bytes::{Bytes, BytesMut};
use derive_more::{Display, Error};
use futures_core::ready;
use super::{BodySize, MessageBody};
/// Collects all the bytes produced by `body`.
///
/// Any errors produced by the body stream are returned immediatel... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/body/mod.rs | actix-http/src/body/mod.rs | //! Traits and structures to aid consuming and writing HTTP payloads.
//!
//! "Body" and "payload" are used somewhat interchangeably in this documentation.
// Though the spec kinda reads like "payload" is the possibly-transfer-encoded part of the message
// and the "body" is the intended possibly-decoded version of th... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/body/boxed.rs | actix-http/src/body/boxed.rs | use std::{
error::Error as StdError,
fmt,
pin::Pin,
task::{Context, Poll},
};
use bytes::Bytes;
use super::{BodySize, MessageBody, MessageBodyMapErr};
use crate::body;
/// A boxed message body with boxed errors.
#[derive(Debug)]
pub struct BoxBody(BoxBodyInner);
enum BoxBodyInner {
None(body::No... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/body/body_stream.rs | actix-http/src/body/body_stream.rs | use std::{
error::Error as StdError,
pin::Pin,
task::{Context, Poll},
};
use bytes::Bytes;
use futures_core::{ready, Stream};
use pin_project_lite::pin_project;
use super::{BodySize, MessageBody};
pin_project! {
/// Streaming response wrapper.
///
/// Response does not contain `Content-Length... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/body/message_body.rs | actix-http/src/body/message_body.rs | //! [`MessageBody`] trait and foreign implementations.
use std::{
convert::Infallible,
error::Error as StdError,
mem,
pin::Pin,
task::{Context, Poll},
};
use bytes::{Bytes, BytesMut};
use futures_core::ready;
use pin_project_lite::pin_project;
use super::{BodySize, BoxBody};
/// An interface for... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/body/size.rs | actix-http/src/body/size.rs | /// Body size hint.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BodySize {
/// Implicitly empty body.
///
/// Will omit the Content-Length header. Used for responses to certain methods (e.g., `HEAD`) or
/// with particular status codes (e.g., 204 No Content). Consumers that read this as a body... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/chunked.rs | actix-http/src/h1/chunked.rs | use std::{io, task::Poll};
use bytes::{Buf as _, Bytes, BytesMut};
use tracing::{debug, trace};
macro_rules! byte (
($rdr:ident) => ({
if $rdr.len() > 0 {
let b = $rdr[0];
$rdr.advance(1);
b
} else {
return Poll::Pending
}
})
);
#[derive... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/encoder.rs | actix-http/src/h1/encoder.rs | use std::{
cmp,
io::{self, Write as _},
marker::PhantomData,
ptr::copy_nonoverlapping,
slice::from_raw_parts_mut,
};
use bytes::{BufMut, BytesMut};
use crate::{
body::BodySize,
header::{
map::Value, HeaderMap, HeaderName, CONNECTION, CONTENT_LENGTH, DATE, TRANSFER_ENCODING,
},
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/codec.rs | actix-http/src/h1/codec.rs | use std::{fmt, io};
use bitflags::bitflags;
use bytes::BytesMut;
use http::{Method, Version};
use tokio_util::codec::{Decoder, Encoder};
use super::{
decoder::{self, PayloadDecoder, PayloadItem, PayloadType},
encoder, Message, MessageType,
};
use crate::{body::BodySize, error::ParseError, ConnectionType, Requ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/dispatcher.rs | actix-http/src/h1/dispatcher.rs | use std::{
collections::VecDeque,
fmt,
future::Future,
io, mem, net,
pin::Pin,
rc::Rc,
task::{Context, Poll},
};
use actix_codec::{Framed, FramedParts};
use actix_rt::time::sleep_until;
use actix_service::Service;
use bitflags::bitflags;
use bytes::{Buf, BytesMut};
use futures_core::ready;
... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | true |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/client.rs | actix-http/src/h1/client.rs | use std::{fmt, io};
use bitflags::bitflags;
use bytes::{Bytes, BytesMut};
use http::{Method, Version};
use tokio_util::codec::{Decoder, Encoder};
use super::{
decoder::{self, PayloadDecoder, PayloadItem, PayloadType},
encoder, reserve_readbuf, Message, MessageType,
};
use crate::{
body::BodySize,
erro... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/decoder.rs | actix-http/src/h1/decoder.rs | use std::{io, marker::PhantomData, mem::MaybeUninit, task::Poll};
use actix_codec::Decoder;
use bytes::{Bytes, BytesMut};
use http::{
header::{self, HeaderName, HeaderValue},
Method, StatusCode, Uri, Version,
};
use tracing::{debug, error, trace};
use super::chunked::ChunkedState;
use crate::{error::ParseErro... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | true |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/dispatcher_tests.rs | actix-http/src/h1/dispatcher_tests.rs | use std::{
future::Future,
pin::Pin,
str,
task::{Context, Poll},
time::Duration,
};
use actix_codec::Framed;
use actix_rt::{pin, time::sleep};
use actix_service::{fn_service, Service};
use actix_utils::future::{ready, Ready};
use bytes::{Buf, Bytes, BytesMut};
use futures_util::future::lazy;
use s... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/service.rs | actix-http/src/h1/service.rs | use std::{
fmt,
marker::PhantomData,
net,
rc::Rc,
task::{Context, Poll},
};
use actix_codec::{AsyncRead, AsyncWrite, Framed};
use actix_rt::net::TcpStream;
use actix_service::{
fn_service, IntoServiceFactory, Service, ServiceFactory, ServiceFactoryExt as _,
};
use actix_utils::future::ready;
us... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
actix/actix-web | https://github.com/actix/actix-web/blob/024addfc4063814ba9ddd5e0ac06992e74b98e5b/actix-http/src/h1/upgrade.rs | actix-http/src/h1/upgrade.rs | use actix_codec::Framed;
use actix_service::{Service, ServiceFactory};
use futures_core::future::LocalBoxFuture;
use crate::{h1::Codec, Error, Request};
pub struct UpgradeHandler;
impl<T> ServiceFactory<(Request, Framed<T, Codec>)> for UpgradeHandler {
type Response = ();
type Error = Error;
type Config ... | rust | Apache-2.0 | 024addfc4063814ba9ddd5e0ac06992e74b98e5b | 2026-01-04T15:37:59.021020Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.