Raw HTTP is bad for you? And whats with wxDebugReport?!
Posted: Sat Aug 13, 2005 1:49 pm
I have almost gone INSANE using RAW HTTP for the last 2 hours... ARGH... I can barely connect to event my own local server (http://localhost) the following code is from my DevugReport::Process:Any reason why it should always hang and 10 secs later report thatthey can't connect to the server?..
i put the Host: directive there... tried wityh and without... both still failed (it barely went past Connect()!)
btw, is there anything i should need to set for wxDebugReport? wxFFile file(fn.GetFullPath()); always can't find the file
Code: Select all
//Gather the data
wxString str;
for (size_t i = 0; i < GetFilesCount(); i++)
{
//Get the metadata
wxString filename, desc, contents;
GetFile(i, &filename, &desc);
wxFileName fn(GetDirectory(), filename);
//Then pluck the file
wxFFile file(fn.GetFullPath());
if (file.IsOpened() && file.ReadAll(&contents))
{
str += filename;
str += "=";
str += contents;
str += "&";
}
}
str = str.Mid(0, str.Length() - 1);
//Connect to my server
wxSocketClient client;
wxIPV4address addr;
addr.Hostname("localhost");
addr.Service(80);
client.Connect(addr, false);
if (!client.WaitOnConnect(10))
{
die("Could not connect to server");
return false;
}
client.Write("POST /bin/error.php HTTP/1.1\r\n", 128);
client.Write("User-Agent: ClassTools/8\r\n", 128);
client.Write("Content-Type: application/x-www-form-urlencoded\r\n\r\n", 128);
client.Write("Host: localhost\r\n", 128);
client.Write(str.ToAscii(), str.Length());
client.Write("Connection: Close\r\n", 128);
Reset();
return true;
i put the Host: directive there... tried wityh and without... both still failed (it barely went past Connect()!)
btw, is there anything i should need to set for wxDebugReport? wxFFile file(fn.GetFullPath()); always can't find the file