Objective c ASIHTTPRequest和NSURLRequest的结果不同

Objective c ASIHTTPRequest和NSURLRequest的结果不同,objective-c,ios,asihttprequest,nsurlrequest,Objective C,Ios,Asihttprequest,Nsurlrequest,我使用ASIHTTPRequest将请求发送到某个url,并且总是得到不同HTML主体的奇怪响应。若我从浏览器或NSURLRequest类发出相同的请求,我会得到正确的HTML正文的正确响应 //Here is code of NSURLRequest. I'm getting correct response; NSURLRequest *request = [NSURLRequest requestWithURL:url]; NSURLResponse *resp = nil; NSErro

我使用ASIHTTPRequest将请求发送到某个url,并且总是得到不同HTML主体的奇怪响应。若我从浏览器或NSURLRequest类发出相同的请求,我会得到正确的HTML正文的正确响应

//Here is code of NSURLRequest. I'm getting correct response;
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSURLResponse *resp = nil;
NSError *err = nil;
NSData *responseData = [NSURLConnection sendSynchronousRequest: request returningResponse: &resp error: &err];
NSString *theString = [[NSString alloc] initWithData:responseData encoding:NSASCIIStringEncoding];
NSLog(@"%@",theString);

//Here is code of ASIHTTPRequest. I'm getting different response. The html body is shorter than original and different;
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setCompletionBlock:^{      
    NSString *responseString = [request responseString];
}];
[request startAsynchronous];

我还尝试用ASIHTTPRequest发送简单的同步请求,但结果相同。可能是什么?

可能是服务器对不同的请求头有不同的逻辑

使用wireshark或charlesproxy来比较请求,您很快就会发现不同之处。