{"record":{"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/4d435abc281842f3cbee165b6cde739e001d3a25/awc/src/client/connector.rs#L323-L359","documentation":"This is a runtime panic (via `unimplemented!`) that occurs when `Connector::max_http_version()` is called with an HTTP version other than HTTP/1.1 or HTTP/2. The match at line 337-343 only handles `HTTP_11` and `HTTP_2`; any other variant falls into the wildcard arm and panics. The awc client connector does not support HTTP/3 or other protocol versions.","triggerScenarios":"Calling `Connector::new().max_http_version(http::Version::HTTP_3)` or `max_http_version(http::Version::HTTP_09)` or `max_http_version(http::Version::HTTP_10)`. Any `http::Version` variant besides `HTTP_11` and `HTTP_2` triggers the panic.","commonSituations":"Developers who try to enable HTTP/3 support (not yet implemented), or who accidentally pass `HTTP_10` thinking it will enable HTTP/1.0 (use `HTTP_11` instead). Misuse of the `http` crate's version constants.","solutions":["Use `http::Version::HTTP_2` for HTTP/2 with ALPN upgrade, or `http::Version::HTTP_11` for HTTP/1.1 only","HTTP/3 is not supported; do not pass `HTTP_3` to `max_http_version`","Remove the `.max_http_version(...)` call entirely if you want the default (which supports both HTTP/1.1 and HTTP/2)"],"exampleFix":"// before\nlet connector = awc::Connector::new()\n    .max_http_version(http::Version::HTTP_3)\n    .finish();\n\n// after\nlet connector = awc::Connector::new()\n    .max_http_version(http::Version::HTTP_2)\n    .finish();","handlingStrategy":"validation","validationCode":"// Before calling max_http_version, verify the version is supported.\nfn build_connector(version: http::Version) -> Result<awc::Connector<...>, &'static str> {\n    match version {\n        http::Version::HTTP_11 | http::Version::HTTP_2 => {\n            Ok(awc::Connector::new().max_http_version(version).finish())\n        }\n        _ => Err(\"awc only supports HTTP/1.1 and HTTP/2\"),\n    }\n}","typeGuard":"fn is_supported_version(v: http::Version) -> bool {\n    matches!(v, http::Version::HTTP_11 | http::Version::HTTP_2)\n}","tryCatchPattern":"// Avoid calling max_http_version with unsupported versions.\n// The default connector already supports both HTTP/1.1 and HTTP/2.\n// Only call max_http_version if you need to restrict to one version.\n// Do not wrap in try-catch; this is unimplemented!() and cannot be caught in Rust.","preventionTips":["Only pass http::Version::HTTP_11 or http::Version::HTTP_2 to max_http_version","Omit the max_http_version call entirely to get default dual-protocol support","HTTP/3 is not supported by awc; do not attempt to enable it"],"tags":["rust","awc","http-client","runtime-panic","configuration","network"],"backgroundTag":null,"analyzedSha":"4d435abc281842f3cbee165b6cde739e001d3a25","analyzedAt":"2026-08-09T01:01:40.926Z","contentChangedAt":"2026-08-09T01:01:40.926Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}