After looking more into it, it seems that the reason why PDF file
downloads don't work through ObjC API anymore is because the download
URLs have changed to HTTPS and we aren't getting authenticated with
www.googleusercontent.com domain.
Here is an example URL that I get as sourceURL for an entry
corresponding to a PDF file:
https://doc-0k-bc-docs.googleusercontent.com/docs/secure/XXX&e=download&gd=true
If I change the URL to plain HTTP, downloads do work. I tried
explicitly setting sign-in domain and performing downloads using code
similar to the one below, but it still fails with 403.
So the question becomes: Is it possible to download PDF files using
the current top-of-trunk code - or are there some changes necessary?
Will plain HTTP download URL continue to work or will Google force
HTTPS?
Thanks,
Christoph
8< ---
self.service = [Utilities docsService];
[service setSignInDomain:@"
www.googleusercontent.com"];
[service authenticateWithDelegate:self
didAuthenticateSelector:@selector(ticket:authenticatedWithError:)];
...
NSURL *exportURL = [[feedEntry content] sourceURL];
GDataQuery *query = [GDataQuery queryWithFeedURL:exportURL];
[query addCustomParameterWithName:@"exportFormat" value:@"pdf"];
NSURL *downloadURL = [query URL];
NSURLRequest *request = [self.service requestForURL:downloadURL
ETag:nil httpMethod:nil];
self.fetcher = [GDataHTTPFetcher httpFetcherWithRequest:request];
[fetcher setUserData:savePath];
[fetcher beginFetchWithDelegate:self didFinishSelector:@selector
(fetcher:finishedWithData:)
didFailSelector:@selector(fetcher:failedWithError:)];
8< ---
On Sep 22, 9:35 am, Daily Tracker Admin <
christop...@gmail.com> wrote:
> The response from the server is Forbidden/Error 403. I've attached the
> request/response. The GET URL seems correct based onhttp://
code.google.com/apis/documents/docs/3.0/developers_guide_proto...
> . So I suspect something is wrong with the auth-token.
>
> The key things to point out are: downloading PDF files worked for the
> past couple of weeks; the code hasn't changed (it repros with top-of-
> trunk DocsSample) and the same code works for file types other than
> PDF. I also tried different Google accounts to make sure it's not
> specific to one. Seems like there was some protocol change introduced
> yesterday or a day before that regressed Objective-C API. Could anyone
> from Google possibly take a look?
>
> Thanks,
> Christoph
>
> -------
>
> request: GET URL:
https://doc-0c-bc-docs.googleusercontent.com/docs/secure/94m9lerav91b...