404 Error when downloading PDF files

82 views
Skip to first unread message

Christoph Z.

unread,
Sep 22, 2009, 3:35:01 AM9/22/09
to Google Data APIs Objective-C Client Library Discussion
I noticed this afternoon that PDF file downloads through Objective-C
client started to fail with a 404 error.

Everything worked just fine for the last couple of weeks and this
morning.

To reproduce the problem: launch DocsSample and try to download a PDF
file.

The following error ends up in the log:

Domain=com.google.HTTPStatus Code=403 UserInfo=0x17911c00 "Operation
could not be completed. (com.google.HTTPStatus error 403.)"

I tried other files types (.txt for example) and downloads worked. Is
this a know issue?

Just to make sure there were no breaking changes, I verified today's
top of the trunk bits, but this problem still occurs.

Thanks,
Christoph

Thomas Van Lenten

unread,
Sep 22, 2009, 7:50:35 AM9/22/09
to gdata-objec...@googlegroups.com
I'd suggest turning on the logging to see what the server is saying and then posting on the Doc's group.

TVL

Daily Tracker Admin

unread,
Sep 22, 2009, 12:35:03 PM9/22/09
to Google Data APIs Objective-C Client Library Discussion
The response from the server is Forbidden/Error 403. I've attached the
request/response. The GET URL seems correct based on
http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html
. 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/94m9lerav91bujddcaagin29am87fd6c/geq5i14rohtm7e6kpd1m0bbkl8elgtnl/1253620800000/05627415927401721629/05627415927401721629/0B2KcmAEFPLoOYThlODc2OXUtYzVkMi00MzA5LWI4MWMtYTNjYjFhMjBiNGFm?h=16653014193614665626&e=download&gd=true
request headers (3)

{
Authorization = "GoogleLogin
auth=DQAAAIEAAAAfYMh8MXMR0gxxXLA7QeVCSPfSDLULMd6-
_Vjt3ecNXlXaiwTpk2fIAO8aGeyewaeamiMZ8FKsfcyCPRNnedqF-
rWkOcfeDkxHqpyHeQy-
avMG8m0eQDfHqnF3aqL290CGt345vq8kxQItkFtX3Mp9y4Oo1qXGaQojF4ykNYSqRX-
M8cgUjsLw6XzqKFkGSLM";
"Gdata-Version" = "3.0";
"User-Agent" = "com.mycompany.DocsSample GData-ObjectiveC/1.8
MacOSX/10.5.8 (gzip)";
}


response: status: 403 MIMEType: text/html
response headers (8)

{
"Cache-Control" = "private, max-age=0";
"Content-Encoding" = gzip;
"Content-Length" = 117;
"Content-Type" = "text/html; charset=UTF-8";
Date = "Tue, 22 Sep 2009 16:16:11 GMT";
Expires = "Tue, 22 Sep 2009 16:16:11 GMT";
Server = "GFE/2.0";
"X-Content-Type-Options" = nosniff;
}

Response data:

<HTML>
<HEAD>
<TITLE>Forbidden</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Forbidden</H1>
<H2>Error 403</H2>
</BODY>
</HTML>


On Sep 22, 4:50 am, Thomas Van Lenten <thoma...@gmail.com> wrote:
> I'd suggest turning on the logging to see what the server is saying and then
> posting on the Doc's group.
> TVL
>

Christoph Z.

unread,
Sep 23, 2009, 12:36:23 AM9/23/09
to Google Data APIs Objective-C Client Library Discussion
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...

Matthew Tonkin

unread,
Sep 23, 2009, 2:30:12 PM9/23/09
to Google Data APIs Objective-C Client Library Discussion
> 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?

I have current top of trunk and the DocsSample is working fine for me.
Simply changing the DocsSampleWindowController line 324 and 378 to PDF
works correctly for me.

Also note on line 811:
NSURL *feedURL = [GDataServiceGoogleDocs docsFeedURLUsingHTTPS:YES];

So you can choose if using HTTPS when the doc feed is created.

Note that this has all changed in the past couple of weeks when
switching to v 3.0 of the GDocs API, so be sure to have the latest
source.

Christoph Z.

unread,
Sep 24, 2009, 12:12:56 AM9/24/09
to Google Data APIs Objective-C Client Library Discussion
Hi Matthew,

Thank you for you help. I was able to get it to work as per your
suggestion, however, only when I set:

NSURL *feedURL = [GDataServiceGoogleDocs docsFeedURLUsingHTTPS:NO];

I asked about HTTPS on the protocol newsgroup, and someone pointed out
that there is an open bug about lack of HTTPS support for PDF files
(see bug: http://code.google.com/p/gdata-issues/issues/detail?id=1448
).

Just to confirm - where you able to get PDF downloads working using
HTTPS? Maybe there's an additional change I'm missing.

Thanks,
Christoph

Matthew Tonkin

unread,
Sep 24, 2009, 2:04:31 AM9/24/09
to Google Data APIs Objective-C Client Library Discussion
> Just to confirm - where you able to get PDF downloads working using
> HTTPS? Maybe there's an additional change I'm missing.

Yes, this is working fine for me with HTTPS enabled or disabled in
GDataServiceGoogleDocs docsFeedURLUsingHTTPS:
Reply all
Reply to author
Forward
0 new messages