New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide IFile consumers a rudimentary HTTP POST option #1650
Conversation
m_httpresponse need init in constructor |
@@ -21,7 +21,6 @@ | |||
#include "CurlFile.h" | |||
#include "utils/URIUtils.h" | |||
#include "Util.h" | |||
#include "URL.h" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
+1 from me, but will need to get an ok from @cptspiff first (and squashed before merging ofc) |
Huh? |
what's the huh addressing? the C H D? where i'm from it's a b c d e f g h. |
Ah, sorry, I've just added HTTPFile close to it's parent. Didn't notice the alphabetical ordering, and since CHD usually means "Coronary heart disease" I was a little taken aback :) And once again I really would like to point out that this is only to provide very minimal post functionality for PVR addons that are limited to using IFile. It is not pretty, it is not clean and it definitely is not the way I would like to engineer it. It's a cornered cat trying to find a solution since it can not instantiate a CurlFile within a PVR addon. Cheers, |
yeah, we all know this is a bandaid. fix up the makefile, squash it up and i'll pull. |
ok, when I get home from work I'll rebase and squash |
Git's power never ceases to amaze me. Just when I think I understand, I manage to do something that behaves not quite as expected. Yet I've never lost history sofar. Anyway, after 'git rebase -i master' the above is what I ended with. Commit edbf643 is indeed the squashed set of commits I made (and I trust the 'H' is now properly located ;)). |
awesome :P and now you need to fix this up and never do a rebase onto another branch anymore and force-pushing to your PR branch :) something like this:
|
Thanks Lars, I knew I simply had to continue branching, cherry picking and forcing updates, but was a little lost how to reduce the number of commits instead of expand... Copied and pasted to the iron clad memory of my evernote :) |
thanks, but can you please update the description to something more descriptive (git commit --amend). thanks |
… sub-class called HTTPFile. Implements IFile's OpenForWrite and Write methods to POST data with Content-Type set to "Application/Json"
Provide IFile consumers a rudimentary HTTP POST option
using namespace XFILE; | ||
|
||
CHTTPFile::CHTTPFile(void) | ||
{ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Yes, we can move it. Actually I think we really should initialise the m_postdata and m_postdataset within CCurlFile::Post() as well as CCurlFile::Get() and re-factor CCurlFile::Service without the postdata argument. That way it would more be like prepare request -> execute request in both cases. You want me to do that and either make a new PR or update this one? Of course the real underlying problem is using side effects to control the Open() method ;). |
As this one has already been merged and been closed, you have to create a new PR, IMO |
np |
Fixed as described in pull request #1681 |
@Red-F @opdenkamp would you know if this is still used by any addon? @mapfau would like to clean this up #9469 |
no sorry. it was only used by one add-on, fortherecord, for logging in. but that may have changed by now |
return -1; | ||
|
||
// Finally (and this is a clumsy hack) return the http response code | ||
return (int) m_httpresponse; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This PR replaces original #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:
This change extends that with a very rudimentary support for POST with post data via the IFile interface by using the sequence:
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