Skip to content

Commit

Permalink
Expose the CURLOPT_HTTP09_ALLOWED libcurl option (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbangelo authored May 5, 2022
1 parent 27663a8 commit 16133f7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions curl-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ pub const CURLOPT_PROXY_SSLKEY: CURLoption = CURLOPTTYPE_OBJECTPOINT + 256;
pub const CURLOPT_DOH_URL: CURLoption = CURLOPTTYPE_OBJECTPOINT + 279;
pub const CURLOPT_UPLOAD_BUFFERSIZE: CURLoption = CURLOPTTYPE_LONG + 280;

pub const CURLOPT_HTTP09_ALLOWED: CURLoption = CURLOPTTYPE_LONG + 285;

pub const CURLOPT_MAXAGE_CONN: CURLoption = CURLOPTTYPE_LONG + 288;

pub const CURLOPT_SSLCERT_BLOB: CURLoption = CURLOPTTYPE_BLOB + 291;
Expand Down
5 changes: 5 additions & 0 deletions src/easy/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,11 @@ impl Easy {
self.inner.pipewait(wait)
}

/// Same as [`Easy2::http_09_allowed`](struct.Easy2.html#method.http_09_allowed)
pub fn http_09_allowed(&mut self, allow: bool) -> Result<(), Error> {
self.inner.http_09_allowed(allow)
}

// =========================================================================
// Other methods

Expand Down
11 changes: 11 additions & 0 deletions src/easy/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2944,6 +2944,17 @@ impl<H> Easy2<H> {
self.setopt_long(curl_sys::CURLOPT_PIPEWAIT, wait as c_long)
}

/// Allow HTTP/0.9 compliant responses
///
/// Set allow to `true` to tell libcurl to allow HTTP/0.9 responses. A HTTP/0.9
/// response is a server response entirely without headers and only a body.
///
/// By default this option is not set and corresponds to
/// `CURLOPT_HTTP09_ALLOWED`.
pub fn http_09_allowed(&mut self, allow: bool) -> Result<(), Error> {
self.setopt_long(curl_sys::CURLOPT_HTTP09_ALLOWED, allow as c_long)
}

// =========================================================================
// Other methods

Expand Down
1 change: 1 addition & 0 deletions systest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ fn main() {
"CURLE_SSL_INVALIDCERTSTATUS" => return true,
"CURLE_HTTP2_STREAM" => return true,
"CURLE_RECURSIVE_API_CALL" => return true,
"CURLOPT_HTTP09_ALLOWED" => return true,
_ => {}
}
}
Expand Down

0 comments on commit 16133f7

Please sign in to comment.