Skip to content

Commit

Permalink
fix(mbuild): upload size now taken properly
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Byron committed Mar 22, 2015
1 parent 3bc930a commit 04f4c95
Show file tree
Hide file tree
Showing 287 changed files with 1,134 additions and 1,648 deletions.
2 changes: 1 addition & 1 deletion etc/api/shared.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ api:
- source: lib.rs
output_dir: src
cargo:
build_version: "0.1.0"
build_version: "0.1.1"
repo_base_url: https://github.com/Byron/google-apis-rs
doc_base_url: http://byron.github.io/google-apis-rs
authors:
Expand Down
2 changes: 1 addition & 1 deletion gen/adexchangebuyer1d3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[package]

name = "google-adexchangebuyer1d3"
version = "0.1.0+20150218"
version = "0.1.1+20150218"
authors = ["Sebastian Thiel <byronimo@gmail>"]
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)"
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d3"
Expand Down
2 changes: 1 addition & 1 deletion gen/adexchangebuyer1d3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DO NOT EDIT !
-->
The `google-adexchangebuyer1d3` library allows access to all features of the *Google Ad Exchange Buyer* service.

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*.
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*.

Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the
[official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
Expand Down
25 changes: 9 additions & 16 deletions gen/adexchangebuyer1d3/src/cmn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,14 @@ impl<'a> MultiPartReader<'a> {
/// Add a new part to the queue of parts to be read on the first `read` call.
///
/// # Arguments
///
/// `headers` - identifying the body of the part. It's similar to the header
/// in an ordinary single-part call, and should thus contain the
/// same information.
/// `reader` - a reader providing the part's body
/// `size` - the amount of bytes provided by the reader. It will be put onto the header as
/// content-size.
/// `mime` - It will be put onto the content type
/// # Panics
///
/// If this method is called after the first `read` call, it will panic
pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> {
let mut headers = Headers::new();
headers.set(ContentType(mime_type));
Expand Down Expand Up @@ -462,22 +460,17 @@ impl Header for RangeResponseHeader {
}

fn parse_header(raw: &[Vec<u8>]) -> Option<RangeResponseHeader> {
match raw {
[ref v] => {
if let Ok(s) = std::str::from_utf8(v) {
const PREFIX: &'static str = "bytes=";
if s.starts_with(PREFIX) {
let c: Chunk = match FromStr::from_str(&s[PREFIX.len()..]) {
Ok(c) => c,
_ => return None
};
if let [ref v] = raw {
if let Ok(s) = std::str::from_utf8(v) {
const PREFIX: &'static str = "bytes=";
if s.starts_with(PREFIX) {
if let Ok(c) = <Chunk as FromStr>::from_str(&s[PREFIX.len()..]) {
return Some(RangeResponseHeader(c))
}
}
None
},
_ => None
}
}
None
}
}

Expand Down Expand Up @@ -557,13 +550,13 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
_ => MIN_CHUNK_SIZE
};

self.reader.seek(SeekFrom::Start(start)).unwrap();
loop {
let request_size = match self.content_length - start {
rs if rs > chunk_size => chunk_size,
rs => rs
};

self.reader.seek(SeekFrom::Start(start)).unwrap();
let mut section_reader = self.reader.take(request_size);
let range_header = ContentRange {
range: Some(Chunk {first: start, last: start + request_size - 1}),
Expand Down
6 changes: 3 additions & 3 deletions gen/adexchangebuyer1d3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This file was generated automatically from 'src/mako/lib.rs.mako'
// DO NOT EDIT !

//! 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*.
//! 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*.
//!
//! Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the
//! [official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
Expand Down Expand Up @@ -314,7 +314,7 @@ impl<'a, C, NC, A> AdExchangeBuyer<C, NC, A>
AdExchangeBuyer {
client: RefCell::new(client),
auth: RefCell::new(authenticator),
_user_agent: "google-api-rust-client/0.1.0".to_string(),
_user_agent: "google-api-rust-client/0.1.1".to_string(),
_m: PhantomData
}
}
Expand Down Expand Up @@ -342,7 +342,7 @@ impl<'a, C, NC, A> AdExchangeBuyer<C, NC, A>
}

/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/0.1.0`.
/// It defaults to `google-api-rust-client/0.1.1`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
Expand Down
2 changes: 1 addition & 1 deletion gen/adexchangeseller2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[package]

name = "google-adexchangeseller2"
version = "0.1.0+20150313"
version = "0.1.1+20150313"
authors = ["Sebastian Thiel <byronimo@gmail>"]
description = "A complete library to interact with Ad Exchange Seller (protocol v2.0)"
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangeseller2"
Expand Down
2 changes: 1 addition & 1 deletion gen/adexchangeseller2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DO NOT EDIT !
-->
The `google-adexchangeseller2` library allows access to all features of the *Google Ad Exchange Seller* service.

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*.
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*.

Everything else about the *Ad Exchange Seller* *v2* API can be found at the
[official documentation site](https://developers.google.com/ad-exchange/seller-rest/).
Expand Down
25 changes: 9 additions & 16 deletions gen/adexchangeseller2/src/cmn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,14 @@ impl<'a> MultiPartReader<'a> {
/// Add a new part to the queue of parts to be read on the first `read` call.
///
/// # Arguments
///
/// `headers` - identifying the body of the part. It's similar to the header
/// in an ordinary single-part call, and should thus contain the
/// same information.
/// `reader` - a reader providing the part's body
/// `size` - the amount of bytes provided by the reader. It will be put onto the header as
/// content-size.
/// `mime` - It will be put onto the content type
/// # Panics
///
/// If this method is called after the first `read` call, it will panic
pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> {
let mut headers = Headers::new();
headers.set(ContentType(mime_type));
Expand Down Expand Up @@ -462,22 +460,17 @@ impl Header for RangeResponseHeader {
}

fn parse_header(raw: &[Vec<u8>]) -> Option<RangeResponseHeader> {
match raw {
[ref v] => {
if let Ok(s) = std::str::from_utf8(v) {
const PREFIX: &'static str = "bytes=";
if s.starts_with(PREFIX) {
let c: Chunk = match FromStr::from_str(&s[PREFIX.len()..]) {
Ok(c) => c,
_ => return None
};
if let [ref v] = raw {
if let Ok(s) = std::str::from_utf8(v) {
const PREFIX: &'static str = "bytes=";
if s.starts_with(PREFIX) {
if let Ok(c) = <Chunk as FromStr>::from_str(&s[PREFIX.len()..]) {
return Some(RangeResponseHeader(c))
}
}
None
},
_ => None
}
}
None
}
}

Expand Down Expand Up @@ -557,13 +550,13 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
_ => MIN_CHUNK_SIZE
};

self.reader.seek(SeekFrom::Start(start)).unwrap();
loop {
let request_size = match self.content_length - start {
rs if rs > chunk_size => chunk_size,
rs => rs
};

self.reader.seek(SeekFrom::Start(start)).unwrap();
let mut section_reader = self.reader.take(request_size);
let range_header = ContentRange {
range: Some(Chunk {first: start, last: start + request_size - 1}),
Expand Down
6 changes: 3 additions & 3 deletions gen/adexchangeseller2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This file was generated automatically from 'src/mako/lib.rs.mako'
// DO NOT EDIT !

//! 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*.
//! 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*.
//!
//! Everything else about the *Ad Exchange Seller* *v2* API can be found at the
//! [official documentation site](https://developers.google.com/ad-exchange/seller-rest/).
Expand Down Expand Up @@ -322,7 +322,7 @@ impl<'a, C, NC, A> AdExchangeSeller<C, NC, A>
AdExchangeSeller {
client: RefCell::new(client),
auth: RefCell::new(authenticator),
_user_agent: "google-api-rust-client/0.1.0".to_string(),
_user_agent: "google-api-rust-client/0.1.1".to_string(),
_m: PhantomData
}
}
Expand All @@ -332,7 +332,7 @@ impl<'a, C, NC, A> AdExchangeSeller<C, NC, A>
}

/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/0.1.0`.
/// It defaults to `google-api-rust-client/0.1.1`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
Expand Down
2 changes: 1 addition & 1 deletion gen/admin1_directory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[package]

name = "google-admin1_directory"
version = "0.1.0+20150123"
version = "0.1.1+20150123"
authors = ["Sebastian Thiel <byronimo@gmail>"]
description = "A complete library to interact with directory (protocol directory_v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_directory"
Expand Down
2 changes: 1 addition & 1 deletion gen/admin1_directory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DO NOT EDIT !
-->
The `google-admin1_directory` library allows access to all features of the *Google directory* service.

This documentation was generated from *directory* crate version *0.1.0+20150123*, where *20150123* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.0*.
This documentation was generated from *directory* crate version *0.1.1+20150123*, where *20150123* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.

Everything else about the *directory* *v1_directory* API can be found at the
[official documentation site](https://developers.google.com/admin-sdk/directory/).
Expand Down
25 changes: 9 additions & 16 deletions gen/admin1_directory/src/cmn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,14 @@ impl<'a> MultiPartReader<'a> {
/// Add a new part to the queue of parts to be read on the first `read` call.
///
/// # Arguments
///
/// `headers` - identifying the body of the part. It's similar to the header
/// in an ordinary single-part call, and should thus contain the
/// same information.
/// `reader` - a reader providing the part's body
/// `size` - the amount of bytes provided by the reader. It will be put onto the header as
/// content-size.
/// `mime` - It will be put onto the content type
/// # Panics
///
/// If this method is called after the first `read` call, it will panic
pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> {
let mut headers = Headers::new();
headers.set(ContentType(mime_type));
Expand Down Expand Up @@ -462,22 +460,17 @@ impl Header for RangeResponseHeader {
}

fn parse_header(raw: &[Vec<u8>]) -> Option<RangeResponseHeader> {
match raw {
[ref v] => {
if let Ok(s) = std::str::from_utf8(v) {
const PREFIX: &'static str = "bytes=";
if s.starts_with(PREFIX) {
let c: Chunk = match FromStr::from_str(&s[PREFIX.len()..]) {
Ok(c) => c,
_ => return None
};
if let [ref v] = raw {
if let Ok(s) = std::str::from_utf8(v) {
const PREFIX: &'static str = "bytes=";
if s.starts_with(PREFIX) {
if let Ok(c) = <Chunk as FromStr>::from_str(&s[PREFIX.len()..]) {
return Some(RangeResponseHeader(c))
}
}
None
},
_ => None
}
}
None
}
}

Expand Down Expand Up @@ -557,13 +550,13 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
_ => MIN_CHUNK_SIZE
};

self.reader.seek(SeekFrom::Start(start)).unwrap();
loop {
let request_size = match self.content_length - start {
rs if rs > chunk_size => chunk_size,
rs => rs
};

self.reader.seek(SeekFrom::Start(start)).unwrap();
let mut section_reader = self.reader.take(request_size);
let range_header = ContentRange {
range: Some(Chunk {first: start, last: start + request_size - 1}),
Expand Down
6 changes: 3 additions & 3 deletions gen/admin1_directory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This file was generated automatically from 'src/mako/lib.rs.mako'
// DO NOT EDIT !

//! This documentation was generated from *directory* crate version *0.1.0+20150123*, where *20150123* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.0*.
//! This documentation was generated from *directory* crate version *0.1.1+20150123*, where *20150123* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.
//!
//! Everything else about the *directory* *v1_directory* API can be found at the
//! [official documentation site](https://developers.google.com/admin-sdk/directory/).
Expand Down Expand Up @@ -441,7 +441,7 @@ impl<'a, C, NC, A> Directory<C, NC, A>
Directory {
client: RefCell::new(client),
auth: RefCell::new(authenticator),
_user_agent: "google-api-rust-client/0.1.0".to_string(),
_user_agent: "google-api-rust-client/0.1.1".to_string(),
_m: PhantomData
}
}
Expand Down Expand Up @@ -484,7 +484,7 @@ impl<'a, C, NC, A> Directory<C, NC, A>
}

/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/0.1.0`.
/// It defaults to `google-api-rust-client/0.1.1`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
Expand Down
2 changes: 1 addition & 1 deletion gen/admin1_reports/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[package]

name = "google-admin1_reports"
version = "0.1.0+20150115"
version = "0.1.1+20150115"
authors = ["Sebastian Thiel <byronimo@gmail>"]
description = "A complete library to interact with reports (protocol reports_v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_reports"
Expand Down
2 changes: 1 addition & 1 deletion gen/admin1_reports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DO NOT EDIT !
-->
The `google-admin1_reports` library allows access to all features of the *Google reports* service.

This documentation was generated from *reports* crate version *0.1.0+20150115*, where *20150115* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.0*.
This documentation was generated from *reports* crate version *0.1.1+20150115*, where *20150115* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.1*.

Everything else about the *reports* *v1_reports* API can be found at the
[official documentation site](https://developers.google.com/admin-sdk/reports/).
Expand Down
Loading

0 comments on commit 04f4c95

Please sign in to comment.