summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorcedeel@gmail.com <cedeel@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-16 19:02:25 +0200
committercedeel@gmail.com <cedeel@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-16 19:02:25 +0200
commit1afe0d2534314497ceb798f425df80f6693e0c82 (patch)
tree7f9552a335588511b91774ce00aea6e5e3431785 /source
parentAdded new hooks: UPDATING_SIGN and UPDATED_SIGN. The first one is capable of changing the sign text by returning the new four lines along with the bool value (diff)
downloadcuberite-1afe0d2534314497ceb798f425df80f6693e0c82.tar
cuberite-1afe0d2534314497ceb798f425df80f6693e0c82.tar.gz
cuberite-1afe0d2534314497ceb798f425df80f6693e0c82.tar.bz2
cuberite-1afe0d2534314497ceb798f425df80f6693e0c82.tar.lz
cuberite-1afe0d2534314497ceb798f425df80f6693e0c82.tar.xz
cuberite-1afe0d2534314497ceb798f425df80f6693e0c82.tar.zst
cuberite-1afe0d2534314497ceb798f425df80f6693e0c82.zip
Diffstat (limited to 'source')
-rw-r--r--source/cAuthenticator.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/cAuthenticator.cpp b/source/cAuthenticator.cpp
index f248f4698..268514940 100644
--- a/source/cAuthenticator.cpp
+++ b/source/cAuthenticator.cpp
@@ -161,7 +161,13 @@ bool cAuthenticator::AuthFromAddress(const AString & a_Server, const AString & a
return false;
}
- Link.SendMessage( AString( "GET " + a_Address + " HTTP/1.0\r\n\r\n" ).c_str());
+ 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( "Accept: */*\r\n" ).c_str());
+ Link.SendMessage( AString( "Connection: keep-alive\r\n" ).c_str());
+ Link.SendMessage( AString( "\r\n" ).c_str());
AString DataRecvd;
Link.ReceiveData(DataRecvd);
Link.CloseSocket();
@@ -260,7 +266,10 @@ 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)
+ // 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
{
LOGINFO("Result was \"YES\", so player is authenticated!");
return true;