summaryrefslogtreecommitdiff
path: root/libpiano/src/http.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2009-08-03 22:15:24 +0200
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2009-08-03 22:15:24 +0200
commit39597a0d5cbfd0ca37c6e5e0e7c2bd32fc60e0ed (patch)
treeb730da1bd1219c4bd11a344481fa2d83ea49738b /libpiano/src/http.c
parente1d27d4036b249b3d860d62d41322bc40071e05b (diff)
downloadpianobar-39597a0d5cbfd0ca37c6e5e0e7c2bd32fc60e0ed.tar.gz
pianobar-39597a0d5cbfd0ca37c6e5e0e7c2bd32fc60e0ed.tar.bz2
pianobar-39597a0d5cbfd0ca37c6e5e0e7c2bd32fc60e0ed.zip
piano: Always encrypt HTTP POST data
Diffstat (limited to 'libpiano/src/http.c')
-rw-r--r--libpiano/src/http.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libpiano/src/http.c b/libpiano/src/http.c
index 6173c89..d33a4e5 100644
--- a/libpiano/src/http.c
+++ b/libpiano/src/http.c
@@ -27,6 +27,8 @@ THE SOFTWARE.
#include <waitress.h>
+#include "main.h"
+#include "crypt.h"
#include "http.h"
/* post data to url and receive answer as string
@@ -38,14 +40,20 @@ THE SOFTWARE.
*/
PianoReturn_t PianoHttpPost (WaitressHandle_t *waith, const char *postData,
char *retData, size_t retDataSize) {
+ PianoReturn_t pRet = PIANO_RET_NET_ERROR;
+ char *reqPostData = PianoEncryptString (postData);
+
waith->extraHeaders = "Content-Type: text/xml\r\n";
- waith->postData = postData;
+ waith->postData = reqPostData;
waith->method = WAITRESS_METHOD_POST;
if (WaitressFetchBuf (waith, retData, retDataSize) == WAITRESS_RET_OK) {
- return PIANO_RET_OK;
+ pRet = PIANO_RET_OK;
}
- return PIANO_RET_NET_ERROR;
+
+ PianoFree (reqPostData, 0);
+
+ return pRet;
}
/* http get request, return server response body