{"id":"0f4d534b6d2e1518","repo":"actix/actix-web","slug":"actix-http-client-only-supports-versions-http-1-1","errorCode":null,"errorMessage":"actix-http client only supports versions http/1.1 & http/2","messagePattern":"actix-http client only supports versions http/1\\.1 & http/2","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"awc/src/client/connector.rs","lineNumber":341,"sourceCode":"    /// ```\n    #[cfg(feature = \"rustls-0_23\")]\n    pub fn rustls_0_23(\n        mut self,\n        connector: std::sync::Arc<actix_tls::connect::rustls_0_23::reexports::ClientConfig>,\n    ) -> Self {\n        self.tls = OurTlsConnector::Rustls023(connector);\n        self\n    }\n\n    /// Sets maximum supported HTTP major version.\n    ///\n    /// Supported versions are HTTP/1.1 and HTTP/2.\n    pub fn max_http_version(mut self, val: http::Version) -> Self {\n        let versions = match val {\n            http::Version::HTTP_11 => vec![b\"http/1.1\".to_vec()],\n            http::Version::HTTP_2 => vec![b\"h2\".to_vec(), b\"http/1.1\".to_vec()],\n            _ => {\n                unimplemented!(\"actix-http client only supports versions http/1.1 & http/2\")\n            }\n        };\n        self.tls = Connector::build_tls(versions);\n        self\n    }\n\n    /// Sets the initial window size (in bytes) for HTTP/2 stream-level flow control for received\n    /// data.\n    ///\n    /// The default value is 65,535 and is good for APIs, but not for big objects.\n    pub fn initial_window_size(mut self, size: u32) -> Self {\n        self.config.stream_window_size = size;\n        self\n    }\n\n    /// Sets the initial window size (in bytes) for HTTP/2 connection-level flow control for\n    /// received data.\n    ///","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/actix/actix-web/blob/937960ca67f20e14ffe2a075bf6d4593502be12c/awc/src/client/connector.rs#L323-L359","documentation":"The AWC client `Connector::max_http_version()` only accepts `HTTP_11` or `HTTP_2`. At awc/src/client/connector.rs:336-343 any other `http::Version` (e.g. `HTTP_09`, `HTTP_10`, `HTTP_3`) hits `unimplemented!()` and panics during connector construction. This is a builder-time panic, so it typically crashes at startup.","triggerScenarios":"Calling `.max_http_version(http::Version::HTTP_10)` or `HTTP_3` on a client `Connector`.","commonSituations":"Assuming the client supports HTTP/1.0 or HTTP/3, or passing a version constant by mistake.","solutions":["Use `http::Version::HTTP_11` (HTTP/1.1 only) or `http::Version::HTTP_2` (HTTP/2 with HTTP/1.1 fallback).","If you need HTTP/3, note that AWC does not support it; choose a different client crate."],"exampleFix":"// before\nlet connector = Connector::new()\n    .max_http_version(http::Version::HTTP_10);\n\n// after\nlet connector = Connector::new()\n    .max_http_version(http::Version::HTTP_2);","handlingStrategy":"validation","validationCode":"// Guard before calling max_http_version.\nfn assert_supported_version(v: http::Version) {\n    assert!(\n        matches!(v, http::Version::HTTP_11 | http::Version::HTTP_2),\n        \"AWC only supports HTTP/1.1 and HTTP/2\"\n    );\n}\n// assert_supported_version(http::Version::HTTP_2);","typeGuard":"fn is_supported_version(v: http::Version) -> bool {\n    matches!(v, http::Version::HTTP_11 | http::Version::HTTP_2)\n}","tryCatchPattern":null,"preventionTips":["Only pass HTTP_11 or HTTP_2 to max_http_version.","Remember AWC has no HTTP/3 support."],"tags":["rust","actix","awc","runtime","panic","http-client","configuration"],"analyzedSha":"937960ca67f20e14ffe2a075bf6d4593502be12c","analyzedAt":"2026-08-06T01:15:46.978Z","schemaVersion":2}