Hi
Ich hab mich mal an ein HTTP-Client in C++(Visual C++ 2005 Express) drangegeben.
Meine Funktion bis jetzt:
So das Problem:
Wenn ich jetzt als Text "GET / HTTP\1.1" eingebe steht in der access.log vom Apache:
"|ET / HTTP\x01.1"
Soweit ist das ja noch nicht schlimm, da der Befehl trotzdem ausgeführt wird und ich eine Korrekte antwort bekomme
"HTTP/1.1 302 Found
Date: Thu, 07 Feb 2008 16:57:53 GMT
Server: Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5
X-Powered-By: PHP/5.2.5
Location: hps/main/
Content-Length: 0
Connection: close
Content-Type: text/html"
Sobald ich aber als Text "GET /benny/ HTTP\1.1" eingebe, kommt Function not implemented
HTTP/1.1 501 Method Not Implemented
Date: Thu, 07 Feb 2008 16:58:31 GMT
Server: Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5
Vary: accept-language,accept-charset
Accept-Ranges: bytes
Connection: close
Content-Type: text/html; charset=iso-8859-1
Content-Language: en
Expires: Thu, 07 Feb 2008 16:58:31 GMT
Habe ich die umwandlung von System::String^ nach cli::array<unsigned char,1>^
falsch?
Thx im voraus
p.s GET /benny HTTP\1.1 geht(also /benny, nicht /benny/)
Ich hab mich mal an ein HTTP-Client in C++(Visual C++ 2005 Express) drangegeben.
Meine Funktion bis jetzt:
Code:
TcpClient^ client = gcnew TcpClient("127.0.0.1", 80);
NetworkStream^ stream = client->GetStream();
cli::array<unsigned char,1>^ data;
cli::array<unsigned char,1>^ dat;
dat = gcnew array<Byte>(4098);
data = System::Text::Encoding::ASCII->GetBytes(input->Text+"\r\n\r\n");
data[0] = (unsigned char) "T";
stream->Write( data, 0, data->Length);
if(stream->CanRead){
stream->Read(dat,0,dat->Length);
//System::Text::Encoding::UTF8
ausgabe->Text = System::Text::Encoding::ASCII->GetString(dat);
}
client->Close();
So das Problem:
Wenn ich jetzt als Text "GET / HTTP\1.1" eingebe steht in der access.log vom Apache:
"|ET / HTTP\x01.1"
Soweit ist das ja noch nicht schlimm, da der Befehl trotzdem ausgeführt wird und ich eine Korrekte antwort bekomme
"HTTP/1.1 302 Found
Date: Thu, 07 Feb 2008 16:57:53 GMT
Server: Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5
X-Powered-By: PHP/5.2.5
Location: hps/main/
Content-Length: 0
Connection: close
Content-Type: text/html"
Sobald ich aber als Text "GET /benny/ HTTP\1.1" eingebe, kommt Function not implemented
HTTP/1.1 501 Method Not Implemented
Date: Thu, 07 Feb 2008 16:58:31 GMT
Server: Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5
Vary: accept-language,accept-charset
Accept-Ranges: bytes
Connection: close
Content-Type: text/html; charset=iso-8859-1
Content-Language: en
Expires: Thu, 07 Feb 2008 16:58:31 GMT
Habe ich die umwandlung von System::String^ nach cli::array<unsigned char,1>^
falsch?
Thx im voraus
p.s GET /benny HTTP\1.1 geht(also /benny, nicht /benny/)