<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Playing with HTTP libraries</title>
	<atom:link href="http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/feed/" rel="self" type="application/rss+xml" />
	<link>http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/</link>
	<description>sin incertidumbre no hay novedad, sin novedad posible no hay más que repetición y, por lo tanto, negación del otro como un ser libre: el ser libre es un ser incierto. (adrian mancuso)</description>
	<lastBuildDate>Sun, 07 Mar 2010 02:15:55 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jeffrey Leo Oloresisimo</title>
		<link>http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/comment-page-1/#comment-31138</link>
		<dc:creator>Jeffrey Leo Oloresisimo</dc:creator>
		<pubDate>Mon, 22 Feb 2010 18:20:24 +0000</pubDate>
		<guid isPermaLink="false">http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/#comment-31138</guid>
		<description>Hi, i really like this wrapper class you created but i have a question.... how could i do it in a secure HTTP? im trying to implement a secure HTTP RESTful web service but when I use this project to test connection between my server it does not work.

I would really appreciate the help....</description>
		<content:encoded><![CDATA[<p>Hi, i really like this wrapper class you created but i have a question&#8230;. how could i do it in a secure HTTP? im trying to implement a secure HTTP RESTful web service but when I use this project to test connection between my server it does not work.</p>
<p>I would really appreciate the help&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian</title>
		<link>http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/comment-page-1/#comment-27031</link>
		<dc:creator>Adrian</dc:creator>
		<pubDate>Fri, 11 Sep 2009 13:57:17 +0000</pubDate>
		<guid isPermaLink="false">http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/#comment-27031</guid>
		<description>Thanks Sandra! :)</description>
		<content:encoded><![CDATA[<p>Thanks Sandra! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sandrar</title>
		<link>http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/comment-page-1/#comment-27024</link>
		<dc:creator>sandrar</dc:creator>
		<pubDate>Thu, 10 Sep 2009 22:56:30 +0000</pubDate>
		<guid isPermaLink="false">http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/#comment-27024</guid>
		<description>Hi! I was surfing and found your blog post... nice! I love your blog.  :) Cheers! Sandra. R.</description>
		<content:encoded><![CDATA[<p>Hi! I was surfing and found your blog post&#8230; nice! I love your blog.  :) Cheers! Sandra. R.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Gravatt</title>
		<link>http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/comment-page-1/#comment-26114</link>
		<dc:creator>Matthew Gravatt</dc:creator>
		<pubDate>Wed, 22 Jul 2009 02:34:26 +0000</pubDate>
		<guid isPermaLink="false">http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/#comment-26114</guid>
		<description>Thank you, Adrian.  Extremely useful code and thread.</description>
		<content:encoded><![CDATA[<p>Thank you, Adrian.  Extremely useful code and thread.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/comment-page-1/#comment-26010</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Sun, 14 Jun 2009 21:55:32 +0000</pubDate>
		<guid isPermaLink="false">http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/#comment-26010</guid>
		<description>If you guys need to debug, run REST or any HTTP calls there is an Eclipse plugin where you can visually construct your REST call: http://http4e.roussev.org/ 

Of course this is not an Objective-C client, yet it is very powerful tool.</description>
		<content:encoded><![CDATA[<p>If you guys need to debug, run REST or any HTTP calls there is an Eclipse plugin where you can visually construct your REST call: <a href="http://http4e.roussev.org/" rel="nofollow">http://http4e.roussev.org/</a> </p>
<p>Of course this is not an Objective-C client, yet it is very powerful tool.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: iPhone SDK, Cocoa &#38; RESTful Web Services, Memory Leak &#171; Ambient Ideas</title>
		<link>http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/comment-page-1/#comment-25303</link>
		<dc:creator>iPhone SDK, Cocoa &#38; RESTful Web Services, Memory Leak &#171; Ambient Ideas</dc:creator>
		<pubDate>Sun, 01 Feb 2009 17:16:19 +0000</pubDate>
		<guid isPermaLink="false">http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/#comment-25303</guid>
		<description>[...] A Blog about 5 languages calling web services, including Objective-C [...]</description>
		<content:encoded><![CDATA[<p>[...] A Blog about 5 languages calling web services, including Objective-C [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian</title>
		<link>http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/comment-page-1/#comment-25204</link>
		<dc:creator>Adrian</dc:creator>
		<pubDate>Mon, 19 Jan 2009 12:46:21 +0000</pubDate>
		<guid isPermaLink="false">http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/#comment-25204</guid>
		<description>@Simon: please check http://kosmaczewski.net/2009/01/19/objective-c-rest-client-update/ as I&#039;ve fixed the formatting of data sent via POST... it turns out that the method I was using was wrong, and CoreFoundation has a better way to handle URL formatting.</description>
		<content:encoded><![CDATA[<p>@Simon: please check <a href="http://kosmaczewski.net/2009/01/19/objective-c-rest-client-update/" rel="nofollow">http://kosmaczewski.net/2009/01/19/objective-c-rest-client-update/</a> as I&#8217;ve fixed the formatting of data sent via POST&#8230; it turns out that the method I was using was wrong, and CoreFoundation has a better way to handle URL formatting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/comment-page-1/#comment-23779</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Sun, 16 Nov 2008 20:44:28 +0000</pubDate>
		<guid isPermaLink="false">http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/#comment-23779</guid>
		<description>Adrian, Just had a scan through. Looks good. Will try it out. Am wondering if the method used for POSTing form data via URL encoding ends up putting a restriction on how much data you are able to submit as I recall there being a limit on the length of a URL (though I don&#039;t know what it is). Perhaps this is a REST interaction characteristic that I don&#039;t yet understand. Again thanks
Cheers
Simon</description>
		<content:encoded><![CDATA[<p>Adrian, Just had a scan through. Looks good. Will try it out. Am wondering if the method used for POSTing form data via URL encoding ends up putting a restriction on how much data you are able to submit as I recall there being a limit on the length of a URL (though I don&#8217;t know what it is). Perhaps this is a REST interaction characteristic that I don&#8217;t yet understand. Again thanks<br />
Cheers<br />
Simon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian</title>
		<link>http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/comment-page-1/#comment-23774</link>
		<dc:creator>Adrian</dc:creator>
		<pubDate>Sun, 16 Nov 2008 12:21:41 +0000</pubDate>
		<guid isPermaLink="false">http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/#comment-23774</guid>
		<description>Hi Simon, thanks to you for the work you&#039;ve done in your comment! Indeed this version is my first attempt to make a REST wrapper for Objective-C code, you might want to check out this one: 
http://kosmaczewski.net/2008/10/18/rest-and-objective-c-again/
It&#039;s a more polished version, and it&#039;s being used not only in my own projects but also in a friend of mine&#039;s :) And as far as I can tell, POST requests work fine, but of course I might not be doing it properly ;) Thanks for the &quot;heads up&quot; and I&#039;ll fix the code as soon as I can to make it more HTTP-compliant.</description>
		<content:encoded><![CDATA[<p>Hi Simon, thanks to you for the work you&#8217;ve done in your comment! Indeed this version is my first attempt to make a REST wrapper for Objective-C code, you might want to check out this one:<br />
<a href="http://kosmaczewski.net/2008/10/18/rest-and-objective-c-again/" rel="nofollow">http://kosmaczewski.net/2008/10/18/rest-and-objective-c-again/</a><br />
It&#8217;s a more polished version, and it&#8217;s being used not only in my own projects but also in a friend of mine&#8217;s :) And as far as I can tell, POST requests work fine, but of course I might not be doing it properly ;) Thanks for the &#8220;heads up&#8221; and I&#8217;ll fix the code as soon as I can to make it more HTTP-compliant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/comment-page-1/#comment-23767</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Sun, 16 Nov 2008 03:45:28 +0000</pubDate>
		<guid isPermaLink="false">http://kosmaczewski.net/2008/03/26/playing-with-http-libraries/#comment-23767</guid>
		<description>Adrian,
Once again, thanks for posting the code and updates. Migrating to a delegate method at the moment. I can see the advantages. I&#039;m still somewhat hung up on your sendRequestTo method. I&#039;m going to go out on a limb and say I don&#039;t think it&#039;s all encompassing (yet), that is, works for all verbs, in particular POST with form data. If I&#039;m wrong please let me know and I&#039;ll study it again to try and figure it out.

I do see in your example (in the comment history), the uploadData method so I see a form data based method, (though not with a set of parameters) It is a POST example that seems to be almost what you need for generic form POST requests.

In your sendRequestTo, you set
[headers setValue:@&quot;text/html; charset=utf-8&quot; forKey:@&quot;Content-Type&quot;];

That&#039;s great for GET, but for POST form data won&#039;t work.

Also adding parameters via:
        for (id key in parameters)
        {
            [params appendFormat:@&quot;%@=%@&amp;&quot;, [key stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [[parameters objectForKey:key] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
        }

is also great for GET, but not for POST (unless you want url paramters in addition to form parameters). 

I have (pulled from some other code elsewhere) some form parameter construction code of the following nature:
		NSString *stringBoundary = [NSString stringWithString:@&quot;0xKhTmLbOuNdArY&quot;];
		if (parameters)
		{
			NSMutableData *postBody = [NSMutableData data];
			[postBody appendData:[[NSString stringWithFormat:@&quot;--%@&quot;,stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
			for (id key in parameters)
			{
				[postBody appendData:[[NSString stringWithFormat:@&quot;\r\nContent-Disposition: form-data; name=\&quot;%@\&quot;\r\n\r\n&quot;,
									   key] dataUsingEncoding:NSUTF8StringEncoding]];
				[postBody appendData:[[NSString stringWithFormat:@&quot;%@&quot;,
									  [parameters objectForKey:key]] dataUsingEncoding:NSUTF8StringEncoding]];
				[postBody appendData:[[NSString stringWithFormat:@&quot;\r\n--%@&quot;,
									   stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
			}
			//Add the final components of the string.
			[postBody appendData:[[NSString stringWithFormat:@&quot;--\r\n&quot;,
								   stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
			[request setHTTPBody:postBody];

Yes, this is a bit rough, but it seems to work OK.

Am I missing something here? Do you have the capability to post a form, or have you only developed an example where you can use a POST verb, but effectively only with URL parameters, similar to a GET verb? 

Cheers
Simon</description>
		<content:encoded><![CDATA[<p>Adrian,<br />
Once again, thanks for posting the code and updates. Migrating to a delegate method at the moment. I can see the advantages. I&#8217;m still somewhat hung up on your sendRequestTo method. I&#8217;m going to go out on a limb and say I don&#8217;t think it&#8217;s all encompassing (yet), that is, works for all verbs, in particular POST with form data. If I&#8217;m wrong please let me know and I&#8217;ll study it again to try and figure it out.</p>
<p>I do see in your example (in the comment history), the uploadData method so I see a form data based method, (though not with a set of parameters) It is a POST example that seems to be almost what you need for generic form POST requests.</p>
<p>In your sendRequestTo, you set<br />
[headers setValue:@"text/html; charset=utf-8" forKey:@"Content-Type"];</p>
<p>That&#8217;s great for GET, but for POST form data won&#8217;t work.</p>
<p>Also adding parameters via:<br />
        for (id key in parameters)<br />
        {<br />
            [params appendFormat:@"%@=%@&amp;", [key stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [[parameters objectForKey:key] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];<br />
        }</p>
<p>is also great for GET, but not for POST (unless you want url paramters in addition to form parameters). </p>
<p>I have (pulled from some other code elsewhere) some form parameter construction code of the following nature:<br />
		NSString *stringBoundary = [NSString stringWithString:@"0xKhTmLbOuNdArY"];<br />
		if (parameters)<br />
		{<br />
			NSMutableData *postBody = [NSMutableData data];<br />
			[postBody appendData:[[NSString stringWithFormat:@"--%@",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];<br />
			for (id key in parameters)<br />
			{<br />
				[postBody appendData:[[NSString stringWithFormat:@"\r\nContent-Disposition: form-data; name=\"%@\"\r\n\r\n",<br />
									   key] dataUsingEncoding:NSUTF8StringEncoding]];<br />
				[postBody appendData:[[NSString stringWithFormat:@"%@",<br />
									  [parameters objectForKey:key]] dataUsingEncoding:NSUTF8StringEncoding]];<br />
				[postBody appendData:[[NSString stringWithFormat:@"\r\n--%@",<br />
									   stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];<br />
			}<br />
			//Add the final components of the string.<br />
			[postBody appendData:[[NSString stringWithFormat:@"--\r\n",<br />
								   stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];<br />
			[request setHTTPBody:postBody];</p>
<p>Yes, this is a bit rough, but it seems to work OK.</p>
<p>Am I missing something here? Do you have the capability to post a form, or have you only developed an example where you can use a POST verb, but effectively only with URL parameters, similar to a GET verb? </p>
<p>Cheers<br />
Simon</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic page generated in 0.261 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-03-09 11:02:58 -->
<!-- Compression = gzip -->