discuss-gnustep
[Top][All Lists]
Advanced

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

Windows HTTPS Issue


From: danieljboyd
Subject: Windows HTTPS Issue
Date: Wed, 13 May 2020 14:37:59 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

I'm having a strange issue with an Restful Api client class I'm trying
to write. Currently, I'm trying to get it to work with Microsoft's
oauth2 endpoints.

I'm trying to make a HTTP post request using [NSURLConnection
sendSynchronousRequest: returningResponse: error:]. I'm just doing a
basic application/x-www-form-urlencoded request with a query string in
the body of the request.

When I send the request to Microsoft's end point, it times out. If I
send the same request to postman echo (an endpoint that just echoes
back your request), it works fine. Both endpoints use https.

Moreover, when I compile and run the code in Linux, *everything* works
fine, including contacting Microsoft's servers.

My actual code would be difficult to follow here, but this is
essentially what I'm doing:

NSMutableURLRequest * req = [[NSMutableURLRequest alloc] initWithURL:
    [NSURL
    //times out with this
    URLWithString:@"https://login.microsoftonline.com/XXX/oauth2/";]];
    //works fine with this
    //URLWithString:@"https://postman-echo.com/post";]];

//where XXX is my Office 365 tenant GUID

[req addValue:@"application/x-www-form-urlencoded"
    forHTTPHeaderField:@"Content-Type"];

//all of this is property escaped with 
//stringByAddingPercentEncodingWithAllowedCharacters:
NSData * query = [@"value1=key1&value2=key2, etc" dataUsingEncoding:
    NSUTF8StringEncoding];

[req addValue:[NSString stringWithFormat:@"%d", [query length]
     forHTTPHeaderField: @"Content-Length"];
[req setHTTPBody:query];

NSURLResponse * httpResponse;
NSError * error;
NSData * response = [NSURLConnection sendSynchronousRequest: req
                                     returningResponse: &httpResponse
                                                 error: &error];
                                

So, yeah... works fine in Linux. Works in Windows with a different URL.
Times out with this URL in Windows. Is this an SSL issue? How would I
even go about troubleshooting it?



reply via email to

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