Re: Translate curl command to NSURLRequest

2015-07-05 Thread Jens Alfke
, at 4:45 PM, Michael David Crawford mdcrawf...@gmail.com wrote: Would it work to use libcurl instead? I dont know but would be unsurprised were that to be what NSURLRequest actually does. -- Michael David Crawford, Consulting Software Engineer mdcrawf...@gmail.com http

Translate curl command to NSURLRequest

2015-07-04 Thread Antonio Nunes
/user 'https://example.com/api/v1/endpoint The -d and xml-string are mandatory for this GET command. I haven’t been able to translate this into an equivalent NSURLRequest that gets accepted by the server. I tried this: NSURLCredential *credential = [[WRTSServerEngine sharedServerEngine

Re: Translate curl command to NSURLRequest

2015-07-04 Thread Rick Mann
this into an equivalent NSURLRequest that gets accepted by the server. I tried this: NSURLCredential *credential = [[WRTSServerEngine sharedServerEngine] savedCredentialsForHost:@“example.com port

Re: Translate curl command to NSURLRequest

2015-07-04 Thread Jens Alfke
On Jul 4, 2015, at 11:04 AM, Rick Mann rm...@latencyzero.com wrote: FWIW, you're setting the Accept header, not Content-Type (nor Accept-Language). Yup. And I’m pretty sure you [the OP] don’t want to add that Accept header to all requests, since it’s telling the server to give up (with a

Re: Translate curl command to NSURLRequest

2015-07-04 Thread Antonio Nunes
/emailpasswordSomePassWord/password/account_attributes/user 'https://example.com/api/v1/endpoint The -d and xml-string are mandatory for this GET command. I haven’t been able to translate this into an equivalent NSURLRequest that gets accepted by the server. I tried this: NSURLCredential *credential

Re: Translate curl command to NSURLRequest

2015-07-04 Thread Michael David Crawford
Would it work to use libcurl instead? I dont know but would be unsurprised were that to be what NSURLRequest actually does. -- Michael David Crawford, Consulting Software Engineer mdcrawf...@gmail.com http://www.warplife.com/mdc/ Available for Software Development in the Portland, Oregon

Re: Translate curl command to NSURLRequest

2015-07-04 Thread Antonio Nunes
On 04 Jul 2015, at 22:03, Jens Alfke j...@mooseyard.com wrote: (Sending a GET request with a body is pretty unusual, but I assume that’s what the server wants since you say the curl command works…) Yes, I’m not happy about this, and I think this is also what is causing the issue, since it

Re: Translate curl command to NSURLRequest

2015-07-04 Thread Antonio Nunes
Thanks for the pointer to macnetworkprog Jerry, and for the link to Charles. I should probably have mentioned in my post that this is an iOS app, not a Mac app. Would that matter for macnetworkprog, or is the list appropriate for iOS too? António On 04 Jul 2015, at 13:59, Jerry Krinock

Re: Translate curl command to NSURLRequest

2015-07-04 Thread Antonio Nunes
On 05 Jul 2015, at 00:45, Michael David Crawford mdcrawf...@gmail.com wrote: Would it work to use libcurl instead? I dont know but would be unsurprised were that to be what NSURLRequest actually does. Probably, but this is on iOS, so I would have to package a libcurl build into the app

Re: Translate curl command to NSURLRequest

2015-07-04 Thread Jerry Krinock
On 2015 Jul 04, at 02:52, Antonio Nunes devli...@sintraworks.com wrote: Is there a way to see exactly what the request looks like when it goes out? Search for “OS X Packet Sniffer” and you will find many apps for this, and even some stuff built into OS X, which are quite fun to use. My

Re: NSURLRequest returning bizarre page

2013-06-11 Thread Manoah F. Adams
) === Try setting the NSURLRequest to request *only* text/plain, (Noticing how safari gets back text/plain mime type, but your cocoa app got back a (garbled) HTML. The result you got looks like untested code in the server for wrapping plain text into html format. I did some experimenting... Try

Re: NSURLRequest returning bizarre page

2013-06-11 Thread Greg Parker
On Jun 10, 2013, at 5:32 PM, Trygve Inda cocoa...@xericdesign.com wrote: http://www.celestrak.com/NORAD/elements/stations.txt The JavaScript redirect you showed earlier appears to be that server's broken attempt to display a page not found error. Note the Content-Location header with 404 in

NSURLRequest returning bizarre page

2013-06-10 Thread Trygve Inda
I am using the following code (url changed, but it is a .txt file) NSString* tleAddress = @http://www.somesite.com/somefile.txt;; NSURLRequest* tleRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:tleAddress] cachePolicy:0 timeoutInterval:5.0]; NSURLResponse* tleResponse = nil

Re: NSURLRequest returning bizarre page

2013-06-10 Thread Alex Zavatone
What is the header of the file being fetched set to? On Jun 10, 2013, at 8:06 PM, Trygve Inda wrote: I am using the following code (url changed, but it is a .txt file) NSString* tleAddress = @http://www.somesite.com/somefile.txt;; NSURLRequest* tleRequest = [NSURLRequest requestWithURL

Re: NSURLRequest returning bizarre page

2013-06-10 Thread Trygve Inda
What is the header of the file being fetched set to? On Jun 10, 2013, at 8:06 PM, Trygve Inda wrote: I believe it is just a plain text file. Safari will not allow me to view source on the page and FireFox says: text/plain ISO-8859-1 FireFox also says: The character encoding of the plain

Re: NSURLRequest returning bizarre page

2013-06-10 Thread Alex Zavatone
Well, that's it, isn't it? On Jun 10, 2013, at 8:32 PM, Trygve Inda wrote: What is the header of the file being fetched set to? On Jun 10, 2013, at 8:06 PM, Trygve Inda wrote: I believe it is just a plain text file. Safari will not allow me to view source on the page and FireFox says:

Re: NSURLRequest returning bizarre page

2013-06-10 Thread Trygve Inda
Well, that's it, isn't it? On Jun 10, 2013, at 8:32 PM, Trygve Inda wrote: What is the header of the file being fetched set to? On Jun 10, 2013, at 8:06 PM, Trygve Inda wrote: I believe it is just a plain text file. Safari will not allow me to view source on the page and FireFox

Re: NSURLRequest returning bizarre page

2013-06-10 Thread Jens Alfke
On Jun 10, 2013, at 5:06 PM, Trygve Inda cocoa...@xericdesign.com wrote: However, on some customer's systems, despite NSError not showing anything wrong, I get: That’s a web page with a pretty clumsy way of redirecting to `/redirect.asp?loc=` followed by the actual URL. I have no idea why

NSURLRequest timing

2011-09-14 Thread lcerveau
Hi I have a question regarding time a NSURLRequest/NSURLConnection is taking : I do the following - When creating/launching the request I take a timestamp, in the delegate method  - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response I take another one

Re: NSURLRequest timing

2011-09-14 Thread Jerry Krinock
On 2011 Sep 14, at 10:21, lcerveau wrote: - At the same time I use a software like HTTPScoop to look on how it is timing all this. Time are always différent like 0.05 seconds. I'm not familiar with HTTPScoop, but 50 milliseconds is typical for a single ping on the internet. So nearly

Re: Why are properties access through NSURLProtocol class method rather than NSURLRequest instance method?

2011-05-16 Thread Mike Abdullah
On 16 May 2011, at 03:57, Larry Campbell wrote: Seems odd to me that setting and getting properties of an NSURLRequest involve an NSURLProtocol class method: +[NSURLProtocol setProperty:forKey:inRequest:] rather than what seems to me the much more straightforward

Why are properties access through NSURLProtocol class method rather than NSURLRequest instance method?

2011-05-15 Thread Larry Campbell
Seems odd to me that setting and getting properties of an NSURLRequest involve an NSURLProtocol class method: +[NSURLProtocol setProperty:forKey:inRequest:] rather than what seems to me the much more straightforward: -[NSMutableURLRequest setProperty:forKey:] Is there a reason

Re: NSURLRequest and NSOperationQueue

2010-01-18 Thread Clint Shryock
I had the same issue in the past using NSOperationQueue and NSURLConnection, and I resolved it by simply telling NSURLConnection to send using synchronously using sendSynchronousRequest:returningResponse:error: Would that not take care of the issue? +Clint On Sun, Jan 17, 2010 at 1:55 PM, J.

Re: NSURLRequest and NSOperationQueue

2010-01-18 Thread Keith Duncan
On 18 Jan 2010, at 16:37, Clint Shryock wrote: I had the same issue in the past using NSOperationQueue and NSURLConnection, and I resolved it by simply telling NSURLConnection to send using synchronously using sendSynchronousRequest:returningResponse:error: Would that not take care of the

Re: NSURLRequest and NSOperationQueue

2010-01-17 Thread J. Scott Tury
runUntilDate:dateLimit]; } // 3. Report your results to your main thread! ... } Scott Tury On Jan 17, 2010, at 12:08 AM, cocoa-dev-requ...@lists.apple.com wrote: Subject: NSURLRequest and NSOperationQueue Hi everyone, I'm building an object that communicates

Re: NSURLRequest and NSOperationQueue

2010-01-17 Thread Keith Duncan
Solution 1 would be to have you do a synchronous NSURLConnection in your main method. This will show you everything is working in that thread and that you do indeed get data back from your server. This isn't a good idea since it limits the cancelabilty of your operation. NSRunLoop*

Re: NSURLRequest and NSOperationQueue

2010-01-17 Thread Dave DeLong
Thanks for the responses! It hadn't occurred to me to spin the runloop myself. My main reason for using an NSOperationQueue for the connections was because the spawner of the connections was also the connection delegate, and it would've taken some interesting code dancing to handle the

Re: NSURLRequest and NSOperationQueue

2010-01-17 Thread J. Scott Tury
The issue that Dave has run into is that when you call the asynchronous NSURLConnection call, NSURLConnection looks to see what thread you are calling it on, and it will only call your delegate back on that Thread (if it exists). If you exit your NSOperation main method, your thread is going

NSURLRequest and NSOperationQueue

2010-01-16 Thread Dave DeLong
Hi everyone, I'm building an object that communicates with a server. For various reasons, I'd like to queue up all the NSURLRequests in an NSOperationQueue so that I never have more than one connection open at a time. However, I'm running into a weird issue. If I create my NSURLRequest

NSURLRequest SSL Mac vs iPhone

2009-10-16 Thread Greg Hoover
I have the same piece of code making a secure request to a server in a Mac application and in an iPhone app. Both use an NSURLRequest with exactly the same settings, message, body, etc. On the Mac, the request succeeds, returning the data expected. On the iPhone however, the request

Re: NSURLRequest SSL Mac vs iPhone

2009-10-16 Thread Andrew Farmer
On 16 Oct 2009, at 00:48, Greg Hoover wrote: I have the same piece of code making a secure request to a server in a Mac application and in an iPhone app. Both use an NSURLRequest with exactly the same settings, message, body, etc. On the Mac, the request succeeds, returning the data

Re: NSURLRequest SSL Mac vs iPhone

2009-10-16 Thread Greg Hoover
On Oct 16, 2009, at 1:13 AM, Andrew Farmer wrote: On 16 Oct 2009, at 00:48, Greg Hoover wrote: I have the same piece of code making a secure request to a server in a Mac application and in an iPhone app. Both use an NSURLRequest with exactly the same settings, message, body, etc

Re: NSURLRequest SSL Mac vs iPhone

2009-10-16 Thread Jens Alfke
On Oct 16, 2009, at 7:52 AM, Greg Hoover wrote: It's signed by Verisign. Where does NSURLRequest and its supporting routines find the CA root certs? In the Keychain. You can see the list of pre-installed root certs by launching Keychain Access and selecting System Roots from

Re: NSURLRequest SSL Mac vs iPhone

2009-10-16 Thread Alastair Houghton
On 16 Oct 2009, at 15:52, Greg Hoover wrote: It's signed by Verisign. Where does NSURLRequest and its supporting routines find the CA root certs? Are you sure it's the root certificate that it needs and not some certificate beneath that? Some CAs sign their SSL certs with certificates

Re: NSURLRequest

2009-10-11 Thread Mike Abdullah
arrayWithContentsOfURL:url]; which has been working just fine so far. But now I'm reading through the URL Loading System docs, and wondering if I should be using all the NSURLRequest stuff instead. It's more complicated, so are there any advantages it would have over what I'm doing now? Advantages

NSURLRequest

2009-10-10 Thread DKJ
fine so far. But now I'm reading through the URL Loading System docs, and wondering if I should be using all the NSURLRequest stuff instead. It's more complicated, so are there any advantages it would have over what I'm doing now? dkj ___ Cocoa

Re: NSURLRequest

2009-10-10 Thread Michael Dautermann
arrayWithContentsOfURL:url]; which has been working just fine so far. But now I'm reading through the URL Loading System docs, and wondering if I should be using all the NSURLRequest stuff instead. It's more complicated, so are there any advantages it would have over what I'm doing now? if it's working well

Re: NSURLRequest

2009-10-10 Thread Ricky Sharp
arrayWithContentsOfURL:url]; which has been working just fine so far. But now I'm reading through the URL Loading System docs, and wondering if I should be using all the NSURLRequest stuff instead. It's more complicated, so are there any advantages it would have over what I'm doing now

Can't set header on NSURLRequest

2009-06-02 Thread Chris
Hello, I'm having an issue with setting two headers for my NSURLRequest: [theRequest setValue: [NSString stringWithFormat:@/principals/ __uids__/%@/\r\n,self.userGUID] forHTTPHeaderField:@Originator]; [theRequest setValue: [NSString stringWithFormat:@/principals/ __uids__/%@/\r\n

Re: Can't set header on NSURLRequest

2009-06-02 Thread Andrew Farmer
On 1 Jun 2009, at 23:44, Chris wrote: I'm having an issue with setting two headers for my NSURLRequest: [theRequest setValue: [NSString stringWithFormat:@/principals/ __uids__/%@/\r\n,self.userGUID] forHTTPHeaderField:@Originator]; [theRequest setValue: [NSString stringWithFormat

Re: Can't set header on NSURLRequest

2009-06-02 Thread Doug Knowles
Hi, Chris, I had a similar problem the other day. Are you using an NSMutableURLRequest? Doug K; On Tue, Jun 2, 2009 at 2:44 AM, Chris haroldthehun...@mac.com wrote: Hello, I'm having an issue with setting two headers for my NSURLRequest: [theRequest setValue: [NSString

NSURLRequest- setHTTPMethod to REPORT

2009-05-29 Thread Chris Purcell
Hello, I'm trying to issue a REPORT request to a server, the HTTP Method header needs to look like this: REPORT /bernard/work/ HTTP/1.1 So I use setHTTPMethod to set the HTTP Method: [theRequest setHTTPMethod:@REPORT /bernard/work/]; But when I issue the request, the server returns an

Different result with NSURLRequest then with curl (or browser)

2008-11-23 Thread Tobias Tom
/]; NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:30]; NSData *urlData; NSURLResponse *response; NSError *error; urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:response error:error

Different result with NSURLRequest then with curl (or browser)

2008-11-23 Thread Tobias Tom
/]; NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:30]; NSData *urlData; NSURLResponse *response; NSError *error; urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:response error:error

NSURL, NSURLRequest, and NSURLConnection

2008-10-20 Thread Robert Mullen
When sending a NSURLRequest to an secure website via NSURLConnection will the initial URL be encrypted or only the response? I have looked around at Apple's docs and am unclear. Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please

Re: NSURL, NSURLRequest, and NSURLConnection

2008-10-20 Thread Stephen J. Butler
On Mon, Oct 20, 2008 at 2:19 PM, Robert Mullen [EMAIL PROTECTED] wrote: When sending a NSURLRequest to an secure website via NSURLConnection will the initial URL be encrypted or only the response? I have looked around at Apple's docs and am unclear. An HTTPS URL? Everything but the server name

Re: NSURLRequest conditional GET

2008-06-19 Thread Jens Alfke
a NSURLRequest with a NSURLRequestUseProtocolCachePolicy is adding the If-None-Match header. Fortunately it adds the Last-Modified header automatically so I've tweaked my server-side to be able to work just with this header for caching. Is this a bug in NSURLRequestUseProtocolCachePolicy

NSURLRequest conditional GET

2008-06-18 Thread Marc Monguio
Some weird things seem to happen with NSURLRequest when used with NSURLRequestUseProtocolCachePolicy : 1) The documentation I've found about Conditional GET in the web says I should be sending If-Modified-Since and If-None-Match headers with the contents of Last-Modified and ETag headers

Re: NSURLRequest : Unable to Quit App after Syn call to Server.

2008-05-17 Thread Dominik Pich
// --- // 4) Convert Synchronous Data into Human-Readable String (Unicode 8) format: NSString *serverDataString = [[[NSString alloc] initWithData:serverData encoding:NSUTF8StringEncoding] retain]; This is an extra retain. [[soapResponse

Re: NSURLRequest : Unable to Quit App after Syn call to Server.

2008-05-16 Thread fclee
is the source... Does NSURLRequest need to be CLOSED before exit? I don't remember seeing NSURLRequest closer in the doc. Any ideas/remedies for the EXC_BAD_ACCESS (SIGBUS)? Ric. On 05/15/2008 17:56 Jens Alfke wrote .. On 15 May '08, at 2:21 PM, [EMAIL PROTECTED] wrote: The Cocoa code

Re: NSURLRequest : Unable to Quit App after Syn call to Server. SOLVED???

2008-05-16 Thread fclee
I needed to modify the default 'GET' Response of the NSURLRequest to a 'POST'... So I changed 'NSURLRequest' to a 'NSMutableURLRequest' to modify the HTTPMethod: // --- // 2) Create the request. NSMutableURLRequest *theRequest=[NSMutableURLRequest

NSURLRequest : Unable to Quit App after Syn call to Server.

2008-05-15 Thread fclee
. NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:theServerURL] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0

Re: NSURLRequest : Unable to Quit App after Syn call to Server.

2008-05-15 Thread Jens Alfke
On 15 May '08, at 2:21 PM, [EMAIL PROTECTED] wrote: The Cocoa code below works. I get data back from the server. However, I'm unable to QUIT this application after this particular routine passes through. I checked the Activity Monitor and can see a bunch of threads still in session:

Re: File upload with NSURLRequest fails

2008-03-14 Thread Ben Lachman
I do this with a perl script on the back end. My experience was that its was more cajoling the perl script into working that the PHP side, but that may be because I'm not much of a perl wizard (maybe only level 8 or so :-). I found it was important to declare a filename if you're

Re: File upload with NSURLRequest fails

2008-03-14 Thread Tom Harrington
On Fri, Mar 14, 2008 at 12:43 AM, Ben Lachman [EMAIL PROTECTED] wrote: I do this with a perl script on the back end. My experience was that its was more cajoling the perl script into working that the PHP side, but that may be because I'm not much of a perl wizard (maybe only level 8 or so

Re: File upload with NSURLRequest fails

2008-03-13 Thread Tom Harrington
On Thu, Mar 13, 2008 at 2:50 PM, Tom Harrington [EMAIL PROTECTED] wrote: [postBody appendData:[[NSString stringWithString:@Content-Type: null\r\n\r\n] dataUsingEncoding:NSUTF8StringEncoding]]; Someone asked about this. FYI, null is what the other clients use, but if I use image/jpeg

Re: File upload with NSURLRequest fails

2008-03-13 Thread Tom Harrington
Also, for what it's worth, I can hit the server just fine at the command line with: curl -F [EMAIL PROTECTED];filename=7195554321_1_20080311132327_jpg http://server:8080/php/post.php ...yet for some reason the NSURLRequest approach fails. Any/all tips are welcome. On Thu, Mar 13, 2008 at 3:02