2

我在我的应用程序中使用 ASIHTTPRequest 来处理我的应用程序中的 Google 登录。

在我的一个请求中,我得到了重定向,这就是我所做的:

- (void)request:(ASIHTTPRequest *)request willRedirectToURL:(NSURL *)newURL{
    ASIHTTPRequest *redirect = [[ASIHTTPRequest alloc] initWithURL:newURL];
    [redirect setTimeOutSeconds:30];
    [redirect setValidatesSecureCertificate:NO];
    [redirect setDelegate:self]; 
    [redirect startAsynchronous];

    NSLog(@"Redirect - %@",url);
}

当我发出这个请求时,没有调用 ASIHTTPRequest 委托方法,这是我进行重定向的 url:

https://accounts.google.com/Logout2?service=sj&ilo=1&ils=s.IL&ilc=0&continue=http%3A%2F%2Fmusic.google.com%2Fmusic%2Flisten&zx=-834167044

知道为什么会这样吗?

编辑

newURL 等于:

https://accounts.google.com/Logout2?service=sj&ilo=1&ils=s.IL&ilc=0&continue=http%3A%2F%2Fmusic.google.com%2Fmusic%2Flisten&zx=835989037

但是当我尝试获取 html 时,我得到的重定向 url 是:

https://accounts.google.com/Logout2?service=sj&ilo=1&ils=s.IL&ilc=0&continue=http%3A%2F%2Fmusic.google.com%2Fmusic%2Flisten&zx=835989037

两者之间存在差异。知道为什么吗?

4

1 回答 1

1

ASIHTTPRequest当原始请求将打开相同的 URL 时,为什么要使用新的重定向?当您不使用新请求重定向时会发生什么?

我认为您最好停止原始请求,然后创建新请求。

于 2012-04-29T12:06:49.877 回答