• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSURLConnection POST issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURLConnection POST issues


  • Subject: Re: NSURLConnection POST issues
  • From: Damien Cooke <email@hidden>
  • Date: Sun, 10 Jan 2010 15:31:09 +1030

Thanks Jason,
I knew it would be simple.  Thank you so much.

Regards
Damien

On 10/01/2010, at 2:35 PM, Jason Foreman wrote:

>
> On Jan 9, 2010, at 9:31 PM, Damien Cooke wrote:
>
>> here is my code to send this data
>>
>
>> 	[appendedData appendData:[[[NSString stringWithFormat:@"ProdName=%@",[self applicationName]] stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding] dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]];
>> 	[appendedData appendData:[[[NSString stringWithFormat:@"ProdVersion=%@",[self productVersion]] stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding]dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]];
>
> Review the info for the application/x-www-form-urlencoded Form content type here: <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4>
>
> In brief, you aren't separating your form variables with an "&" character.
>
> You're doing this:
>
> 	"ProdName=FooProdVersion=Bar"
>
> whereas you want this:
>
> 	"ProdName=Foo&ProdVersion=Bar"
>
>
>
>> 	NSString *dataLength = [[NSString alloc] initWithFormat:@"%d", [appendedData length]];
>
>> 	[request setValue:dataLength forHTTPHeaderField:@"Content-Length"];
>
> I believe this is unnecessary, as it will be calculated automatically from the data passed to -setHTTPBody.
>
>
> Regards,
>
> Jason
>
>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSURLConnection POST issues (From: Damien Cooke <email@hidden>)
 >Re: NSURLConnection POST issues (From: Jason Foreman <email@hidden>)

  • Prev by Date: Re: Enabling NSZombieEnabled programatically
  • Next by Date: [self frame].size.width reporting incorrectly
  • Previous by thread: Re: NSURLConnection POST issues
  • Next by thread: Re: NSURLConnection POST issues
  • Index(es):
    • Date
    • Thread