diff --git a/gamespy_gamestats_server.py b/gamespy_gamestats_server.py index 98758a3..ed986d3 100644 --- a/gamespy_gamestats_server.py +++ b/gamespy_gamestats_server.py @@ -283,7 +283,11 @@ class Gamestats(LineReceiver): data = "" keys = data_parsed['keys'].split('\x01') - profile_data = gs_query.parse_gamespy_message("\\prof\\" + profile['data'] + "\\final\\") + profile_data = None + + if 'data' in profile: + profile_data = gs_query.parse_gamespy_message("\\prof\\" + profile['data'] + "\\final\\") + if profile_data != None: profile_data = profile_data[0][0] diff --git a/nintendo_nas_server.py b/nintendo_nas_server.py index fbf9686..5ba1b40 100644 --- a/nintendo_nas_server.py +++ b/nintendo_nas_server.py @@ -80,22 +80,23 @@ class NintendoNasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler): ret["returncd"] = "007" ret["statusdata"] = "Y" authtoken = self.server.db.generate_authtoken(post["userid"], post) - - if post["svc"] == "9000" or post["svc"] == "9001": # DLC host = 9000 - ret["svchost"] = self.headers['host'] # in case the client's DNS isn't redirecting dls1.nintendowifi.net - # Brawl has 2 host headers which Apache chokes on, so only return the first one or else it won't work - cindex = ret["svchost"].find(',') - if cindex != -1: - ret["svchost"] = ret["svchost"][:cindex] + if 'svc' in post: + if post["svc"] == "9000" or post["svc"] == "9001": # DLC host = 9000 + ret["svchost"] = self.headers['host'] # in case the client's DNS isn't redirecting dls1.nintendowifi.net - if post["svc"] == 9000: - ret["token"] = authtoken - else: + # Brawl has 2 host headers which Apache chokes on, so only return the first one or else it won't work + cindex = ret["svchost"].find(',') + if cindex != -1: + ret["svchost"] = ret["svchost"][:cindex] + + if post["svc"] == 9000: + ret["token"] = authtoken + else: + ret["servicetoken"] = authtoken + elif post["svc"] == "0000": # Pokemon requests this for some things ret["servicetoken"] = authtoken - elif post["svc"] == "0000": # Pokemon requests this for some things - ret["servicetoken"] = authtoken - ret["svchost"] = "n/a" + ret["svchost"] = "n/a" logger.log(logging.DEBUG, "svcloc response to %s", self.client_address) logger.log(logging.DEBUG, ret)