mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 02:44:15 +00:00
Making sure Content-Length is sent when having body.
RFC; http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4
This commit is contained in:
parent
cc5d924899
commit
eb3fcde2f4
@ -7,6 +7,7 @@
|
|||||||
#include "Transports.h"
|
#include "Transports.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.h"
|
||||||
#include "HTTPServer.h"
|
#include "HTTPServer.h"
|
||||||
|
#include "I2PEndian.h"
|
||||||
|
|
||||||
// For image and info
|
// For image and info
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
@ -316,13 +317,15 @@ namespace util
|
|||||||
if (m_Stream)
|
if (m_Stream)
|
||||||
{
|
{
|
||||||
std::string request = method+" " + uri + " HTTP/1.1\n Host:" + fullAddress + "\r\n";
|
std::string request = method+" " + uri + " HTTP/1.1\n Host:" + fullAddress + "\r\n";
|
||||||
if (!strcmp(method.c_str(), "GET"))
|
if (!strcmp(method.c_str(), "GET") && data.size () > 0)
|
||||||
{
|
{
|
||||||
// POST/PUT, apply body
|
// POST/PUT, apply body
|
||||||
request += "\r\n"+ data;
|
request += "Content-Length: " ;
|
||||||
}
|
request += request.size ();
|
||||||
LogPrint("HTTP Client Request: ", request);
|
request += "\r\n" + data;
|
||||||
m_Stream->Send ((uint8_t *)request.c_str (), request.length (), 10);
|
}
|
||||||
|
LogPrint("HTTP Client Request: ", request);
|
||||||
|
m_Stream->Send ((uint8_t *)request.c_str (), request.size (), 10);
|
||||||
AsyncStreamReceive ();
|
AsyncStreamReceive ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user