Skip to content

Commit 04f4c95

Browse files
committed
fix(mbuild): upload size now taken properly
Previously, it would query the size from the wrong dict and obtain the value 0 all the time. This would have made every upload fail with `UploadSizeLimitExeeded`. Now we obtain the actual size limit, and will ignore it if unset/0 for some reason. Patch += 1
1 parent 3bc930a commit 04f4c95

287 files changed

Lines changed: 1134 additions & 1648 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

etc/api/shared.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ api:
2828
- source: lib.rs
2929
output_dir: src
3030
cargo:
31-
build_version: "0.1.0"
31+
build_version: "0.1.1"
3232
repo_base_url: https://github.com/Byron/google-apis-rs
3333
doc_base_url: http://byron.github.io/google-apis-rs
3434
authors:

gen/adexchangebuyer1d3/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[package]
55

66
name = "google-adexchangebuyer1d3"
7-
version = "0.1.0+20150218"
7+
version = "0.1.1+20150218"
88
authors = ["Sebastian Thiel <byronimo@gmail>"]
99
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)"
1010
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d3"

gen/adexchangebuyer1d3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DO NOT EDIT !
55
-->
66
The `google-adexchangebuyer1d3` library allows access to all features of the *Google Ad Exchange Buyer* service.
77

8-
This documentation was generated from *Ad Exchange Buyer* crate version *0.1.0+20150218*, where *20150218* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.0*.
8+
This documentation was generated from *Ad Exchange Buyer* crate version *0.1.1+20150218*, where *20150218* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
99

1010
Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the
1111
[official documentation site](https://developers.google.com/ad-exchange/buyer-rest).

gen/adexchangebuyer1d3/src/cmn.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,14 @@ impl<'a> MultiPartReader<'a> {
274274
/// Add a new part to the queue of parts to be read on the first `read` call.
275275
///
276276
/// # Arguments
277+
///
277278
/// `headers` - identifying the body of the part. It's similar to the header
278279
/// in an ordinary single-part call, and should thus contain the
279280
/// same information.
280281
/// `reader` - a reader providing the part's body
281282
/// `size` - the amount of bytes provided by the reader. It will be put onto the header as
282283
/// content-size.
283284
/// `mime` - It will be put onto the content type
284-
/// # Panics
285-
///
286-
/// If this method is called after the first `read` call, it will panic
287285
pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> {
288286
let mut headers = Headers::new();
289287
headers.set(ContentType(mime_type));
@@ -462,22 +460,17 @@ impl Header for RangeResponseHeader {
462460
}
463461

464462
fn parse_header(raw: &[Vec<u8>]) -> Option<RangeResponseHeader> {
465-
match raw {
466-
[ref v] => {
467-
if let Ok(s) = std::str::from_utf8(v) {
468-
const PREFIX: &'static str = "bytes=";
469-
if s.starts_with(PREFIX) {
470-
let c: Chunk = match FromStr::from_str(&s[PREFIX.len()..]) {
471-
Ok(c) => c,
472-
_ => return None
473-
};
463+
if let [ref v] = raw {
464+
if let Ok(s) = std::str::from_utf8(v) {
465+
const PREFIX: &'static str = "bytes=";
466+
if s.starts_with(PREFIX) {
467+
if let Ok(c) = <Chunk as FromStr>::from_str(&s[PREFIX.len()..]) {
474468
return Some(RangeResponseHeader(c))
475469
}
476470
}
477-
None
478-
},
479-
_ => None
471+
}
480472
}
473+
None
481474
}
482475
}
483476

@@ -557,13 +550,13 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
557550
_ => MIN_CHUNK_SIZE
558551
};
559552

553+
self.reader.seek(SeekFrom::Start(start)).unwrap();
560554
loop {
561555
let request_size = match self.content_length - start {
562556
rs if rs > chunk_size => chunk_size,
563557
rs => rs
564558
};
565559

566-
self.reader.seek(SeekFrom::Start(start)).unwrap();
567560
let mut section_reader = self.reader.take(request_size);
568561
let range_header = ContentRange {
569562
range: Some(Chunk {first: start, last: start + request_size - 1}),

gen/adexchangebuyer1d3/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated automatically from 'src/mako/lib.rs.mako'
33
// DO NOT EDIT !
44

5-
//! This documentation was generated from *Ad Exchange Buyer* crate version *0.1.0+20150218*, where *20150218* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.0*.
5+
//! This documentation was generated from *Ad Exchange Buyer* crate version *0.1.1+20150218*, where *20150218* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
66
//!
77
//! Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the
88
//! [official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
@@ -314,7 +314,7 @@ impl<'a, C, NC, A> AdExchangeBuyer<C, NC, A>
314314
AdExchangeBuyer {
315315
client: RefCell::new(client),
316316
auth: RefCell::new(authenticator),
317-
_user_agent: "google-api-rust-client/0.1.0".to_string(),
317+
_user_agent: "google-api-rust-client/0.1.1".to_string(),
318318
_m: PhantomData
319319
}
320320
}
@@ -342,7 +342,7 @@ impl<'a, C, NC, A> AdExchangeBuyer<C, NC, A>
342342
}
343343

344344
/// Set the user-agent header field to use in all requests to the server.
345-
/// It defaults to `google-api-rust-client/0.1.0`.
345+
/// It defaults to `google-api-rust-client/0.1.1`.
346346
///
347347
/// Returns the previously set user-agent.
348348
pub fn user_agent(&mut self, agent_name: String) -> String {

gen/adexchangeseller2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[package]
55

66
name = "google-adexchangeseller2"
7-
version = "0.1.0+20150313"
7+
version = "0.1.1+20150313"
88
authors = ["Sebastian Thiel <byronimo@gmail>"]
99
description = "A complete library to interact with Ad Exchange Seller (protocol v2.0)"
1010
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangeseller2"

gen/adexchangeseller2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DO NOT EDIT !
55
-->
66
The `google-adexchangeseller2` library allows access to all features of the *Google Ad Exchange Seller* service.
77

8-
This documentation was generated from *Ad Exchange Seller* crate version *0.1.0+20150313*, where *20150313* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.0*.
8+
This documentation was generated from *Ad Exchange Seller* crate version *0.1.1+20150313*, where *20150313* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
99

1010
Everything else about the *Ad Exchange Seller* *v2* API can be found at the
1111
[official documentation site](https://developers.google.com/ad-exchange/seller-rest/).

gen/adexchangeseller2/src/cmn.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,14 @@ impl<'a> MultiPartReader<'a> {
274274
/// Add a new part to the queue of parts to be read on the first `read` call.
275275
///
276276
/// # Arguments
277+
///
277278
/// `headers` - identifying the body of the part. It's similar to the header
278279
/// in an ordinary single-part call, and should thus contain the
279280
/// same information.
280281
/// `reader` - a reader providing the part's body
281282
/// `size` - the amount of bytes provided by the reader. It will be put onto the header as
282283
/// content-size.
283284
/// `mime` - It will be put onto the content type
284-
/// # Panics
285-
///
286-
/// If this method is called after the first `read` call, it will panic
287285
pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> {
288286
let mut headers = Headers::new();
289287
headers.set(ContentType(mime_type));
@@ -462,22 +460,17 @@ impl Header for RangeResponseHeader {
462460
}
463461

464462
fn parse_header(raw: &[Vec<u8>]) -> Option<RangeResponseHeader> {
465-
match raw {
466-
[ref v] => {
467-
if let Ok(s) = std::str::from_utf8(v) {
468-
const PREFIX: &'static str = "bytes=";
469-
if s.starts_with(PREFIX) {
470-
let c: Chunk = match FromStr::from_str(&s[PREFIX.len()..]) {
471-
Ok(c) => c,
472-
_ => return None
473-
};
463+
if let [ref v] = raw {
464+
if let Ok(s) = std::str::from_utf8(v) {
465+
const PREFIX: &'static str = "bytes=";
466+
if s.starts_with(PREFIX) {
467+
if let Ok(c) = <Chunk as FromStr>::from_str(&s[PREFIX.len()..]) {
474468
return Some(RangeResponseHeader(c))
475469
}
476470
}
477-
None
478-
},
479-
_ => None
471+
}
480472
}
473+
None
481474
}
482475
}
483476

@@ -557,13 +550,13 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
557550
_ => MIN_CHUNK_SIZE
558551
};
559552

553+
self.reader.seek(SeekFrom::Start(start)).unwrap();
560554
loop {
561555
let request_size = match self.content_length - start {
562556
rs if rs > chunk_size => chunk_size,
563557
rs => rs
564558
};
565559

566-
self.reader.seek(SeekFrom::Start(start)).unwrap();
567560
let mut section_reader = self.reader.take(request_size);
568561
let range_header = ContentRange {
569562
range: Some(Chunk {first: start, last: start + request_size - 1}),

gen/adexchangeseller2/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated automatically from 'src/mako/lib.rs.mako'
33
// DO NOT EDIT !
44

5-
//! This documentation was generated from *Ad Exchange Seller* crate version *0.1.0+20150313*, where *20150313* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.0*.
5+
//! This documentation was generated from *Ad Exchange Seller* crate version *0.1.1+20150313*, where *20150313* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
66
//!
77
//! Everything else about the *Ad Exchange Seller* *v2* API can be found at the
88
//! [official documentation site](https://developers.google.com/ad-exchange/seller-rest/).
@@ -322,7 +322,7 @@ impl<'a, C, NC, A> AdExchangeSeller<C, NC, A>
322322
AdExchangeSeller {
323323
client: RefCell::new(client),
324324
auth: RefCell::new(authenticator),
325-
_user_agent: "google-api-rust-client/0.1.0".to_string(),
325+
_user_agent: "google-api-rust-client/0.1.1".to_string(),
326326
_m: PhantomData
327327
}
328328
}
@@ -332,7 +332,7 @@ impl<'a, C, NC, A> AdExchangeSeller<C, NC, A>
332332
}
333333

334334
/// Set the user-agent header field to use in all requests to the server.
335-
/// It defaults to `google-api-rust-client/0.1.0`.
335+
/// It defaults to `google-api-rust-client/0.1.1`.
336336
///
337337
/// Returns the previously set user-agent.
338338
pub fn user_agent(&mut self, agent_name: String) -> String {

gen/admin1_directory/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[package]
55

66
name = "google-admin1_directory"
7-
version = "0.1.0+20150123"
7+
version = "0.1.1+20150123"
88
authors = ["Sebastian Thiel <byronimo@gmail>"]
99
description = "A complete library to interact with directory (protocol directory_v1)"
1010
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_directory"

0 commit comments

Comments
 (0)