gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURLConnection and SSL


From: Richard Frith-Macdonald
Subject: Re: NSURLConnection and SSL
Date: Thu, 11 Apr 2013 14:55:23 +0100

On 11 Apr 2013, at 13:51, Maxthon Chan wrote:

> #import <Foundation/Foundation.h>
> 
> int main(void)
> {
>       @autoreleasepool
>       {
>               NSURL *URL = [NSURL URLWithString:@"https://www.google.com/";];
>               NSURLRequest *request = [NSURLRequest requestWithURL:URL];
>               NSHTTPURLResponse *response = nil;
>               NSError *err = nil;
>               NSData *data = [NSURLConnection sendSynchronousRequest:request 
> returningResponse:&response error:&err];
>               NSLog(@"%@, %@, %@", response, err, data);
>       }
>       return 0;
> }
> 
> The data should never be empty.
> 
> 在 2013-4-11,下午8:12,Richard Frith-Macdonald <address@hidden> 写道:
> 
>> 
>> On 11 Apr 2013, at 10:17, Maxthon Chan wrote:
>> 
>>> Well I checked again, the current NSURLCnnection does not seem to work on 
>>> my Ubuntu VM at all. I built it from scratch. What did I miss? 
>> 
>> I don't know ... you would need to provide a sample test program to look at 
>> / try out.
>> It would be great if you could provide testcases for the regression test 
>> suite.
>> There's a little one in NSURL/test00.m

Thanks ...

An https connection to google works from my systems.  So if you mean that this 
program doesn't work on your system, I guess it means you have some 
system-specific problem and will need to debug/diagnose it.

A few observations:

1. test programs should be written in Objective-C so that they can run on all 
systems (unless you are specifically testing ObjC-2 features, in which case 
they shold be in a test set which is skipped in non-ObjC-2 installations). 
2. test programs should include Testing.h and perform one or more tests which 
actually pass or fail (use the PASS macro).  In this case, perhaps PASS(nil != 
data, "https request to google returns data")
3. In an ideal world testcase should be self contained (have a helper process 
accepting the connection rather than connecting out to the internet).  I 
realise that's probably too much to ask for in this case though :-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]