Skip to content

Commit 83f227f

Browse files
authored
fix(curl): Do not loop the same data when sending with curl (#152)
Also bumps minimum Rust to 1.34.0 due to dependencies.
1 parent af4ffc7 commit 83f227f

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ matrix:
2828

2929
# Minimum Rust
3030
- env: SUITE=checkfast
31-
rust: "1.31.0"
31+
rust: "1.34.0"
3232
- env: SUITE=testfast
33-
rust: "1.31.0"
33+
rust: "1.34.0"
3434

3535
# Build Docs
3636
- env: SUITE=travis-push-docs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ We currently only verify this crate against a recent version of Sentry hosted on
2525
[sentry.io](https://sentry.io/) but it should work with on-prem Sentry versions
2626
8.20 and later.
2727

28-
Additionally, the lowest Rust version we target is _1.31.0_.
28+
Additionally, the lowest Rust version we target is _1.34.0_.
2929

3030
## Resources
3131

integrations/sentry-actix/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ We currently only verify this crate against a recent version of Sentry hosted on
1818
[sentry.io](https://sentry.io/) but it should work with on-prem Sentry versions
1919
8.20 and later.
2020

21-
Additionally, the lowest Rust version we target is _1.31.0_.
21+
Additionally, the lowest Rust version we target is _1.34.0_.
2222

2323
## Resources
2424

src/transport.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ use std::sync::{Arc, Condvar, Mutex};
44
use std::thread::{self, JoinHandle};
55
use std::time::{Duration, SystemTime};
66

7+
#[cfg(feature = "with_curl_transport")]
8+
use std::io::Cursor;
9+
710
#[cfg(any(feature = "with_reqwest_transport", feature = "with_curl_transport"))]
811
use httpdate::parse_http_date;
912

@@ -377,16 +380,16 @@ implement_http_transport! {
377380
_ => {}
378381
}
379382

380-
let body = serde_json::to_vec(&event).unwrap();
383+
let mut body = Cursor::new(serde_json::to_vec(&event).unwrap());
381384
let mut retry_after = None;
382385
let mut headers = curl::easy::List::new();
383386
headers.append(&format!("X-Sentry-Auth: {}", dsn.to_auth(Some(&user_agent)))).unwrap();
384387
headers.append("Expect:").unwrap();
385388
headers.append("Content-Type: application/json").unwrap();
386389
handle.http_headers(headers).unwrap();
387390
handle.upload(true).unwrap();
388-
handle.in_filesize(body.len() as u64).unwrap();
389-
handle.read_function(move |buf| Ok((&body[..]).read(buf).unwrap_or(0))).unwrap();
391+
handle.in_filesize(body.get_ref().len() as u64).unwrap();
392+
handle.read_function(move |buf| Ok(body.read(buf).unwrap_or(0))).unwrap();
390393
handle.verbose(true).unwrap();
391394
handle.debug_function(move |info, data| {
392395
let prefix = match info {

0 commit comments

Comments
 (0)