summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-10 09:16:42 +0200
committerlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-10 09:16:42 +0200
commit7276cc0f9b965aef7f2ead624b5d38579ba198d5 (patch)
tree9faea759de9df94873fb710148cdd67c06c58307
parentRemoved some debug messages and removed an old file (diff)
downloadcuberite-7276cc0f9b965aef7f2ead624b5d38579ba198d5.tar
cuberite-7276cc0f9b965aef7f2ead624b5d38579ba198d5.tar.gz
cuberite-7276cc0f9b965aef7f2ead624b5d38579ba198d5.tar.bz2
cuberite-7276cc0f9b965aef7f2ead624b5d38579ba198d5.tar.lz
cuberite-7276cc0f9b965aef7f2ead624b5d38579ba198d5.tar.xz
cuberite-7276cc0f9b965aef7f2ead624b5d38579ba198d5.tar.zst
cuberite-7276cc0f9b965aef7f2ead624b5d38579ba198d5.zip
-rw-r--r--source/cAuthenticator.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/source/cAuthenticator.cpp b/source/cAuthenticator.cpp
index 268514940..d34758c34 100644
--- a/source/cAuthenticator.cpp
+++ b/source/cAuthenticator.cpp
@@ -163,10 +163,10 @@ bool cAuthenticator::AuthFromAddress(const AString & a_Server, const AString & a
Link.SendMessage( AString( "GET " + a_Address + " HTTP/1.1\r\n" ).c_str());
Link.SendMessage( AString( "User-Agent: MCServer\r\n" ).c_str());
- // FIXME: AString( "Host: %s\r\n", a_Server.c_str() ).c_str() doesn't work. Causes segfault.
- Link.SendMessage( AString( "Host: session.minecraft.net\r\n" ).c_str());
+ Link.SendMessage( AString( "Host: " + a_Server + "\r\n" ).c_str());
+ //Link.SendMessage( AString( "Host: session.minecraft.net\r\n" ).c_str());
Link.SendMessage( AString( "Accept: */*\r\n" ).c_str());
- Link.SendMessage( AString( "Connection: keep-alive\r\n" ).c_str());
+ Link.SendMessage( AString( "Connection: close\r\n" ).c_str()); //Close so we donīt have to mess with the Content-Length :)
Link.SendMessage( AString( "\r\n" ).c_str());
AString DataRecvd;
Link.ReceiveData(DataRecvd);
@@ -266,14 +266,15 @@ bool cAuthenticator::AuthFromAddress(const AString & a_Server, const AString & a
std::string Result;
ss >> Result;
LOGINFO("Got result: %s", Result.c_str());
- // if (Result.compare("YES") == 0)
- // TODO: I'm assuming the only response containing 3 letters is "YES", but proper reading of the return code
- // would be preferred.
- if (Result.compare("3") == 0) // FIXME: Quick and dirty hack to support auth
+ //if (Result.compare("3") == 0) // FIXME: Quick and dirty hack to support auth
+ //Lapayo: Wtf 3?
+ if (Result.compare("YES") == 0) //Works well
{
LOGINFO("Result was \"YES\", so player is authenticated!");
return true;
}
+
+
LOGINFO("Result was \"%s\", so player is NOT authenticated!", Result.c_str());
return false;
}