Hi,
I'm trying to send files over HTTP, using the nRF9160. In order to do this, I'm using the https_client sample. It was working with the initial configuration (HEAD request, to example.com). Now I just changed the host, and request, and I get all the time 400 Bad Request, even though the request was successful with with python socket. I also tried the head request with the new host, and it worked.
Here is the C request I'm trying to send with the DK and the https_client sample, that gets a Bad Request :
#define HTTP_POST \ "POST /upload HTTP/1.1\r\n"\ "Host: xxxxxx.eu:8000\r\n"\ "Content-Length: 202\r\n"\ "Content-Type: multipart/form-data; boundary=------------------------a56f48d03f4a08e5\r\n"\ "\r\n"\ "--------------------------a56f48d03f4a08e5\r\n"\ "Content-Disposition: form-data; name=\"files\"; filename=\"mytestfile.txt\"\r\n"\ "Content-Type: text/plain\r\n"\ "\r\n"\ "AABBCCDD\r\n"\ "\r\n"\ "--------------------------a56f48d03f4a08e5--\r\n"\
Once printed, the request is the following (single quotes at start and end are printed on purpose to see the start and end of the request) :
And here is the python request, with which I could send a file :
request = """POST /upload HTTP/1.1 Host: xxxxxx.eu:8000 Content-Length: 202 Content-Type: multipart/form-data; boundary=------------------------a56f48d03f4a08e5 --------------------------a56f48d03f4a08e5 Content-Disposition: form-data; name="files"; filename="mytestfile.txt" Content-Type: text/plain AABBCCDD --------------------------a56f48d03f4a08e5-- """
Is it only an error in the request, or it could be something else ?
Thanks for your help !
Kind regards,
Armand