Skip to content

Commit 16133f7

Browse files
authored
Expose the CURLOPT_HTTP09_ALLOWED libcurl option (#447)
1 parent 27663a8 commit 16133f7

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

curl-sys/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,8 @@ pub const CURLOPT_PROXY_SSLKEY: CURLoption = CURLOPTTYPE_OBJECTPOINT + 256;
598598
pub const CURLOPT_DOH_URL: CURLoption = CURLOPTTYPE_OBJECTPOINT + 279;
599599
pub const CURLOPT_UPLOAD_BUFFERSIZE: CURLoption = CURLOPTTYPE_LONG + 280;
600600

601+
pub const CURLOPT_HTTP09_ALLOWED: CURLoption = CURLOPTTYPE_LONG + 285;
602+
601603
pub const CURLOPT_MAXAGE_CONN: CURLoption = CURLOPTTYPE_LONG + 288;
602604

603605
pub const CURLOPT_SSLCERT_BLOB: CURLoption = CURLOPTTYPE_BLOB + 291;

src/easy/handle.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,11 @@ impl Easy {
12801280
self.inner.pipewait(wait)
12811281
}
12821282

1283+
/// Same as [`Easy2::http_09_allowed`](struct.Easy2.html#method.http_09_allowed)
1284+
pub fn http_09_allowed(&mut self, allow: bool) -> Result<(), Error> {
1285+
self.inner.http_09_allowed(allow)
1286+
}
1287+
12831288
// =========================================================================
12841289
// Other methods
12851290

src/easy/handler.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2944,6 +2944,17 @@ impl<H> Easy2<H> {
29442944
self.setopt_long(curl_sys::CURLOPT_PIPEWAIT, wait as c_long)
29452945
}
29462946

2947+
/// Allow HTTP/0.9 compliant responses
2948+
///
2949+
/// Set allow to `true` to tell libcurl to allow HTTP/0.9 responses. A HTTP/0.9
2950+
/// response is a server response entirely without headers and only a body.
2951+
///
2952+
/// By default this option is not set and corresponds to
2953+
/// `CURLOPT_HTTP09_ALLOWED`.
2954+
pub fn http_09_allowed(&mut self, allow: bool) -> Result<(), Error> {
2955+
self.setopt_long(curl_sys::CURLOPT_HTTP09_ALLOWED, allow as c_long)
2956+
}
2957+
29472958
// =========================================================================
29482959
// Other methods
29492960

systest/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ fn main() {
141141
"CURLE_SSL_INVALIDCERTSTATUS" => return true,
142142
"CURLE_HTTP2_STREAM" => return true,
143143
"CURLE_RECURSIVE_API_CALL" => return true,
144+
"CURLOPT_HTTP09_ALLOWED" => return true,
144145
_ => {}
145146
}
146147
}

0 commit comments

Comments
 (0)