discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Basic HTTP Authentication with Objective-C


From: Dr. H. Nikolaus Schaller
Subject: Re: Basic HTTP Authentication with Objective-C
Date: Tue, 13 Aug 2013 20:49:47 +0200

Hi Andreas,

Am 13.08.2013 um 15:52 schrieb Andreas Höschler:

Hi all,

I need an Objective-C (GNUstep) wrapper for accessing the OpenStreetMap API, basically an Objective-C replacement for 

curl -v -H 'Authorization: Basic bXl1c2VybmFtZTpteXBhc3N3b3Jk' 'http://api.openstreetmap.org/path'

I do successfully access the API for read only calls that do not require authentication like so

   #define IPADDRESS @"api.openstreetmap.org"

   SRFileHandle *handle = [[SRFileHandle alloc] initAsClientAtAddress:IPADDRESS port:80];
   NSString *request = @"GET /api/capabilities\n";
   [handle writeData:[request dataUsingEncoding:NSUTF8StringEncoding]];
   NSData *data = "" readDataToEndOfFile];
   NSString *xmlString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
   [handle closeFile];
   [handle release];

   NSLog(@"xmlString: %@", xmlString);

Any idea how this could be extended to include Basic HTTP Authentication for PUT calls like 

PUT /api/0.6/changeset/create

Googling got me lots of NSURL, addRequestHeader,... stuff, but I don't have all these fancy new classes in my (rather old) GNUstep tree. Anyone?

Your tree must be really old. I think I did write some NSURLConnection stuff more than 5 years ago and Richard did integrate, test and update it in Base also for several years.

BR,
Nikolaus


reply via email to

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