mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Make HTTPObject::post work.
This commit is contained in:
parent
376db9e097
commit
697dbb13b3
1 changed files with 13 additions and 3 deletions
|
|
@ -266,7 +266,19 @@ void HTTPObject::onConnected()
|
||||||
char *pt = dStrchr(mHostName, ':');
|
char *pt = dStrchr(mHostName, ':');
|
||||||
if(pt)
|
if(pt)
|
||||||
*pt = 0;
|
*pt = 0;
|
||||||
dSprintf(buffer, sizeof(buffer), "GET %s HTTP/1.1\r\nHost: %s\r\n\r\n", expPath, mHostName);
|
|
||||||
|
//If we want to do a get request
|
||||||
|
if(mPost == NULL)
|
||||||
|
{
|
||||||
|
dSprintf(buffer, sizeof(buffer), "GET %s HTTP/1.1\r\nHost: %s\r\n\r\n", expPath, mHostName);
|
||||||
|
}
|
||||||
|
//Else we want to do a post request
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dSprintf(buffer, sizeof(buffer), "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: %i\r\n\r\n%s\r\n\r\n",
|
||||||
|
expPath, mHostName, dStrlen(mPost), mPost);
|
||||||
|
}
|
||||||
|
|
||||||
if(pt)
|
if(pt)
|
||||||
*pt = ':';
|
*pt = ':';
|
||||||
|
|
||||||
|
|
@ -431,8 +443,6 @@ DefineEngineMethod( HTTPObject, post, void, ( const char* Address, const char* r
|
||||||
"@param requirstURI Specific location on the server to access (IE: \"index.php\".)\n"
|
"@param requirstURI Specific location on the server to access (IE: \"index.php\".)\n"
|
||||||
"@param query Actual data to transmit to the server. Can be anything required providing it sticks with limitations of the HTTP protocol. \n"
|
"@param query Actual data to transmit to the server. Can be anything required providing it sticks with limitations of the HTTP protocol. \n"
|
||||||
"@param post Submission data to be processed.\n"
|
"@param post Submission data to be processed.\n"
|
||||||
|
|
||||||
"@note The post() method is currently non-functional.\n"
|
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Create an HTTP object for communications\n"
|
"// Create an HTTP object for communications\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue