[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] POST file content without the form method
From: |
alexander . hetzl |
Subject: |
[libmicrohttpd] POST file content without the form method |
Date: |
Mon, 26 Jun 2017 12:19:32 +0200 (CEST) |
Hi,
I've used the largepost.c example and implemented the upload. When I perform a
test using cUrl, everything works fine.
curl -F "payload=<remove.xml" http://username:address@hidden:9090
However requirements changed and I need to change the logic from using the form
post to posting the file content directly without having a "key". Doing this in
cUrl looks like:
curl -d "@remove.xml" http://username:address@hidden:9090
Assume the signature of my iteratePost looks like this:
static int iteratePost(void *conInfoCls,
enum MHD_ValueKind kind,
const char *key,
const char *filename,
const char *content_type,
const char *transfer_encoding,
const char *data,
uint64_t off,
size_t size);
When i post the file content directly, some part of the files content is in the
key and some in the data variables. It would be possible to handle this;
however, if have a "=" character in the first section of the file, it seems
that libmicrohttpd is removing it. So lets assume the file remove.xml has the
following line at the beginning:
<?xml version="1.0" encoding="ISO-8859-1"?>
What is receive in the iteratePost is:
<?xml version"1.0" encoding="ISO-8859-1"?>
Hence, the content is invalid.
Is there a way in the library to handle this case?
Best Regards,
Alex
- [libmicrohttpd] POST file content without the form method,
alexander . hetzl <=