Skip to content

Commit

Permalink
fix(curl): Do not loop the same data when sending with curl (seanmons…
Browse files Browse the repository at this point in the history
…tar#152)

Also bumps minimum Rust to 1.34.0 due to dependencies.
  • Loading branch information
jan-auer authored Jul 29, 2019
1 parent af4ffc7 commit 83f227f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ matrix:

# Minimum Rust
- env: SUITE=checkfast
rust: "1.31.0"
rust: "1.34.0"
- env: SUITE=testfast
rust: "1.31.0"
rust: "1.34.0"

# Build Docs
- env: SUITE=travis-push-docs
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ We currently only verify this crate against a recent version of Sentry hosted on
[sentry.io](https://sentry.io/) but it should work with on-prem Sentry versions
8.20 and later.

Additionally, the lowest Rust version we target is _1.31.0_.
Additionally, the lowest Rust version we target is _1.34.0_.

## Resources

Expand Down
2 changes: 1 addition & 1 deletion integrations/sentry-actix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ We currently only verify this crate against a recent version of Sentry hosted on
[sentry.io](https://sentry.io/) but it should work with on-prem Sentry versions
8.20 and later.

Additionally, the lowest Rust version we target is _1.31.0_.
Additionally, the lowest Rust version we target is _1.34.0_.

## Resources

Expand Down
9 changes: 6 additions & 3 deletions src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ use std::sync::{Arc, Condvar, Mutex};
use std::thread::{self, JoinHandle};
use std::time::{Duration, SystemTime};

#[cfg(feature = "with_curl_transport")]
use std::io::Cursor;

#[cfg(any(feature = "with_reqwest_transport", feature = "with_curl_transport"))]
use httpdate::parse_http_date;

Expand Down Expand Up @@ -377,16 +380,16 @@ implement_http_transport! {
_ => {}
}

let body = serde_json::to_vec(&event).unwrap();
let mut body = Cursor::new(serde_json::to_vec(&event).unwrap());
let mut retry_after = None;
let mut headers = curl::easy::List::new();
headers.append(&format!("X-Sentry-Auth: {}", dsn.to_auth(Some(&user_agent)))).unwrap();
headers.append("Expect:").unwrap();
headers.append("Content-Type: application/json").unwrap();
handle.http_headers(headers).unwrap();
handle.upload(true).unwrap();
handle.in_filesize(body.len() as u64).unwrap();
handle.read_function(move |buf| Ok((&body[..]).read(buf).unwrap_or(0))).unwrap();
handle.in_filesize(body.get_ref().len() as u64).unwrap();
handle.read_function(move |buf| Ok(body.read(buf).unwrap_or(0))).unwrap();
handle.verbose(true).unwrap();
handle.debug_function(move |info, data| {
let prefix = match info {
Expand Down

0 comments on commit 83f227f

Please sign in to comment.