gnustep-dev
[Top][All Lists]
Advanced

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

Re: NSURLConnection and SSL


From: Chan Maxthon
Subject: Re: NSURLConnection and SSL
Date: Thu, 11 Apr 2013 02:31:06 +0800

Okay?

发自我的 iPad

在 2013-4-11,1:18,Fred Kiefer <address@hidden> 写道:

> You should rather reply back to the mailing list, as I wont be looking
> into this any further.
> 
> On 10.04.2013 09:49, Maxthon Chan wrote:
>> Well you can just try grab data from https://www.google.com/ using 
>> NSURLConnection. It should return an HTML page with status code 200 (the 
>> Google homepage). I got empty responses and I am now rebuilding everything 
>> on a fresh Ubuntu 12.10 VM using everything from trunk (trunk llvm with 
>> libc++ and C++11 and lldb, trunk GNUstep with libobjc2 and Apple layout.)
>> 
>> 在 2013-4-10,下午3:38,Fred Kiefer <address@hidden> 写道:
>> 
>>> On 09.04.2013 18:05, Maxthon Chan wrote:
>>>> Hi Everyone:
>>>> 
>>>> I am writing a project for OS X, iOS and Linux, and a cross-platform lore 
>>>> library is called for. This following code works fine under both OS X and 
>>>> iOS, but are very problematic under Linux using GNUstep:
>>>> 
>>>> - (NSData *)dataWithData:(NSData *)data fromMethod:(NSString *)method 
>>>> error:(NSError *__autoreleasing *)error
>>>> {
>>>>     NSURL *methodURL = [NSURL URLWithString:method 
>>>> relativeToURL:self.serverRoot];
>>>> 
>>>>     NSMutableURLRequest *request = [NSMutableURLRequest 
>>>> requestWithURL:methodURL];
>>>> 
>>>>     if ([data length])
>>>>     {
>>>>         [request setHTTPMethod:@"POST"];
>>>>         [request setHTTPBody:data];
>>>>     }
>>>> 
>>>>     [request setValue:[self userAgent] forHTTPHeaderField:@"User-Agent"];
>>>> 
>>>>     NSError *err = nil;
>>>>     NSHTTPURLResponse *response = nil;
>>>> 
>>>>     NSData *responseData = [NSURLConnection sendSynchronousRequest:request
>>>>                                                  
>>>> returningResponse:&response
>>>>                                                              error:&err];
>>>> 
>>>>     if (![responseData length])
>>>>     {
>>>>         WFAssignPointer(error, err);
>>>>         return nil;
>>>>     }
>>>> 
>>>>     if ([response statusCode] >= 400)
>>>>     {
>>>>         NSDictionary *userInfo = @{
>>>>                                    NSLocalizedDescriptionKey:
>>>>                                        
>>>> NSLocalizedStringFromTableInBundle(WFSTR(@"http%ld", [response 
>>>> statusCode]),
>>>>                                                                           
>>>> @"error",
>>>>                                                                           
>>>> WFThisBundle,
>>>>                                                                           
>>>> @"")
>>>>                                    };
>>>>         err = [NSError errorWithDomain:WFErrorDoamin
>>>>                                   code:[response statusCode]
>>>>                               userInfo:userInfo];
>>>>         WFAssignPointer(error, err);
>>>>         return nil;
>>>>     }
>>>> 
>>>>     return responseData;
>>>> }
>>>> 
>>>> The methodURL is a HTTPS URL.
>>>> 
>>>> The call to [NSURLConnection 
>>>> sendSynchronousRequest:returningResponse:error] failed silently, making 
>>>> this code very confused.
>>>> 
>>>> Would anyone tell me what happened?
>>> 
>>> You understand that you will have to provide a full working example which 
>>> allows somebody else to reproduce your problem? The best thing to do is 
>>> write a very simple example that reproduces the issue.
>>> 
>>> And please, make sure that you are using a current version of base.
> 



reply via email to

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