xbmc/xbmc — pull request #1650 by Red-F (2012-10-20 16:23:34+00:00)
Title: Provide IFile consumers a rudimentary HTTP POST option

This PR replaces original https://github.com/xbmc/xbmc/pull/1572.

The implementation has been moved to a subclass of CurlFile to address comments made both in the original PR #1572 and a colliding PR #1567.

Fixes made to CurlFile in the original PR were maintained.

*Notice:* Since I have no (easy) access to an OS X system at this moment I was not able to add the new CHTTPFile class implementation to the various .xcodeproj 's

**Original description:**

Currently binary addons can not access and use the full functionality provided by CCurlFile to access a webservice.

eg. PVR addons can use a simple GET via the IFile interface by using the sequence:

Open
ReadString or Read (until data is exhausted)
Close

This change extends that with a very rudimentary support for POST with post data via the IFile interface by using the sequence:

OpenForWrite
Write (postdata)
ReadString or Read (until data is exhausted)
Close

What's not pretty? Content-Type is hard coded to application/json at this time. In a future version this might be configurable by allowing headers to be added via IoControl (IOCTRL_NATIVE).

fix: allow post with postdata length of zero bytes
fix: SetMimeType didn't work
added: implementation of IFile's OpenForWrite and Write methods