Hi, [email protected] wrote: > 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? >
hard to say... what is your environment? how is it built? I have a client which connects to SOAP HTTPS. I have an "old" win environment which I patch and keep together by miracle based on gcc 3.4 and it connects to HTTPS fine (up to TLS 1.2, I updated the SSL library with great pain). Instead a current build environment on windows built on latest MSYS2/MINGW64 - it looks it never connects Riccardo
