Skip to content

Bind the libcurl multi interface #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ curl-sys = { path = "curl-sys", version = "0.2.0" }
# Unix platforms use OpenSSL for now to provide SSL functionality
[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
openssl-sys = "0.7.0"

[dev-dependencies]
mio = "0.5"
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ fn main() {
}
```

## Multiple requests

The libcurl library provides support for sending multiple requests
simultaneously through the "multi" interface. This is currently bound in the
`multi` module of this crate and provides the ability to execute multiple
transfers simultaneously. For more information, see that module.

## Version Support

The bindings have been developed using curl version 7.24.0. They should
Expand Down
3 changes: 3 additions & 0 deletions curl-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,9 @@ pub const CURL_POLL_IN: c_int = 1;
pub const CURL_POLL_OUT: c_int = 2;
pub const CURL_POLL_INOUT: c_int = 3;
pub const CURL_POLL_REMOVE: c_int = 4;
pub const CURL_CSELECT_IN: c_int = 1;
pub const CURL_CSELECT_OUT: c_int = 2;
pub const CURL_CSELECT_ERR: c_int = 4;
pub const CURL_SOCKET_TIMEOUT: curl_socket_t = CURL_SOCKET_BAD;

pub type curl_socket_callback = extern fn(*mut CURL,
Expand Down
5 changes: 5 additions & 0 deletions src/easy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,11 @@ impl<'a> Easy<'a> {
}
}

/// Get a pointer to the raw underlying CURL handle.
pub fn raw(&self) -> *mut curl_sys::CURL {
self.handle
}

#[cfg(unix)]
fn setopt_path(&mut self,
opt: curl_sys::CURLoption,
Expand Down
5 changes: 5 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,11 @@ impl MultiError {
self.code == curl_sys::CURLM_UNKNOWN_OPTION
}

/// Returns whether this error corresponds to CURLM_CALL_MULTI_PERFORM.
pub fn is_call_perform(&self) -> bool {
self.code == curl_sys::CURLM_CALL_MULTI_PERFORM
}

// /// Returns whether this error corresponds to CURLM_ADDED_ALREADY.
// pub fn is_added_already(&self) -> bool {
// self.code == curl_sys::CURLM_ADDED_ALREADY
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ mod version;

mod panic;
pub mod easy;
pub mod multi;

/// Initializes the underlying libcurl library.
///
Expand Down
Loading