Hi, Thank you so much! This is the first I heard of that behaviour and it works great every time for what I want.
Much appreciated, Adam On 21/07/06, Frank Mantek <[EMAIL PROTECTED]> wrote: > ok, there is an undocumented "feature"... > > If you set the: > > 'X-If-No-Redirect' header to true or 1, > > the the calendar server will respond with a 412 error code instead of a 302, > and have the > > 'X-Redirect-Location' header in the response. That header would be the URL > you want to access. > > Try that. > > Frank Mantek > > > > > On 7/21/06, Adam Medcalf <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > Thanks very much Frank, that answer makes good sense to me and I'm > > slightly reassured. It also explains somewhat why I didn't have to > > perform the 3rd step towards adding an event described on the calendar > > api page - involving the session token. > > > > I am indeed relying on wininet (/the internet transfer control) so > > that is very plausible. The only downside is that as you say the > > redirect happens automatically, so my application never gets to see > > the 302; but rather the resulting 401. > > > > I guess there's no especially simple way of dealing with this properly > > with the tools I'm using? I'm not writing anything massively important > > so I suppose I could just check for the 401 and if it happens, repeat > > the request :-). If it gives 401 several times there is obviously > > something wrong so it should quit and report the error. > > > > Thanks! > > > > Adam > > > > > > On 21/07/06, Frank Mantek < [EMAIL PROTECTED]> wrote: > > > What i am suspecting is that sharding might get in the way... > > > > > > Google servers will, normally on your first login, or periodically > pending > > > load, redirect your attempt to get to your data to the correct server > for > > > you. This is called sharding, and it results in a 302 return code. > > > > > > Now, pending on how you setup your connection, that 302 handling happens > > > underneath you - but you have to handle this yourself. If it happens > > > automatically (like wininet handles it), what happens is: > > > > > > - you send your auth header to server A > > > - server A returns a 302 > > > - wininet connects to Server B, but does not send the authheader > > > - you get a 401 back... > > > > > > You need to handle the 302 and then your good to go. > > > > > > Frank Mantek > > > guessing the heck... > > > > > > > > > On 7/20/06, Adam < [EMAIL PROTECTED]> wrote: > > > > > > > > Hi, > > > > > > > > I have just started experimenting with adding events to the Google > > > > Calendar from Visual Studio 6. As I am using VB6 to test I am manually > > > > sending Google the requisite XML to create events in the following > > > > manner: > > > > > > > > 1) POST login details to > > > https://www.google.com/accounts/ClientLogin > > > > 2) Parse the auth code from Google's response > > > > 3) POST the XML event details to > > > > > http://www.google.com/calendar/feeds/default/private/full > > > including the > > > > requisite Authorization (and code) and Content-Type. > > > > > > > > The strange thing is that most of the time this works fine, response > > > > codes are what you would expect, and the event is added to the Google > > > > calendar. > > > > > > > > However, if it is the first time I run the application, at step 3, > > > > instead of the 201 Created response I should get, I get: > > > > > > > > HTTP/1.1 401 Authorization required > > > > WWW-Authenticate: GoogleLogin realm="https://www.google.com/accounts" > > > > Cache-control: private > > > > Content-Length: 167 > > > > Date: <whatever> > > > > Content-Type: text/html > > > > Server: GFE/1.3 > > > > > > > > If I then go on to repeat the process right away without quitting my > > > > test app, get a new auth code, send the event, it is added as normal > > > > for as many times as I want to. If however I exit the program, start > it > > > > again, then again the first time I will always get the 401 response. > > > > > > > > Could anyone throw some light on this? I can't understand why if I > sent > > > > the same commands that gave me a 401 a second time it works, but the > > > > first time I always get a 401? Being an extreme novice, it's almost > > > > like the first Auth token google gives me when I load my test program > > > > is invalid. The same code works with the 2nd one though. I have > checked > > > > that the Auth code is definitely getting passed to the server every > > > > time. > > > > > > > > If I can give any more useful info just let me know. > > > > > > > > Many thanks, > > > > > > > > Adam > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi -~----------~----~----~----~------~----~------~--~---
