From bce372f23655be0d2229470bca331aa8a96e92cb Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 27 Oct 2006 13:41:27 +0000 Subject: [PATCH] Fixed a couple of rerouting issues, Warning: RAW mode is not requested, this will break compatability with the origional qtv protocol, including with mvdsv. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2435 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- fteqtv/forward.c | 7 +++++++ fteqtv/source.c | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/fteqtv/forward.c b/fteqtv/forward.c index 142136175..4b7b54b28 100644 --- a/fteqtv/forward.c +++ b/fteqtv/forward.c @@ -266,6 +266,9 @@ void Net_SendConnectionMVD(sv_t *qtv, oproxy_t *prox) netmsg_t msg; int prespawn; + if (!*qtv->mapname) + return; + InitNetMsg(&msg, buffer, sizeof(buffer)); prox->flushing = false; @@ -1068,6 +1071,10 @@ qboolean SV_ReadPendingProxy(cluster_t *cluster, oproxy_t *pend) Net_ProxySend(cluster, pend, s, strlen(s)); pend->flushing = true; } + else if (!strcmp(s, "AUTH")) + { //lists the demos available on this proxy + //part of the connection process, can be ignored if there's no password + } else printf("Unrecognised token in QTV connection request (%s)\n", s); } diff --git a/fteqtv/source.c b/fteqtv/source.c index fdadd0e77..4b436e783 100644 --- a/fteqtv/source.c +++ b/fteqtv/source.c @@ -247,19 +247,41 @@ SOCKET Net_MVDListen(int port) return sock; } +char *strchrrev(char *str, char chr) +{ + char *firstchar = str; + for (str = str + strlen(str)-1; str>=firstchar; str--) + if (*str == chr) + return str; + + return NULL; +} + void Net_SendQTVConnectionRequest(sv_t *qtv, char *authmethod, char *challenge) { + char *at; char *str; char hash[512]; //due to mvdsv sucking and stuff, we try using raw connections where possibleso that we don't end up expecting a header. //at some point, this will be forced to 1 - qtv->parsingqtvheader = !!*qtv->connectpassword; + qtv->parsingqtvheader = true;//!!*qtv->connectpassword; str = "QTV\n"; Net_QueueUpstream(qtv, strlen(str), str); str = "VERSION: 1\n"; Net_QueueUpstream(qtv, strlen(str), str); + + at = strchrrev(qtv->server, '@'); + if (at) + { + *at = '\0'; + str = "SOURCE: "; Net_QueueUpstream(qtv, strlen(str), str); + str = qtv->server; Net_QueueUpstream(qtv, strlen(str), str); + str = "\n"; Net_QueueUpstream(qtv, strlen(str), str); + *at = '@'; + } + if (!qtv->parsingqtvheader) { str = "RAW: 1\n"; Net_QueueUpstream(qtv, strlen(str), str); @@ -408,6 +430,9 @@ qboolean Net_ConnectToUDPServer(sv_t *qtv, char *ip) qboolean Net_ConnectToServer(sv_t *qtv, char *ip) { + char *at; + qboolean status; + qtv->usequkeworldprotocols = false; if (!strncmp(ip, "file:", 5) || !strncmp(ip, "demo:", 5)) @@ -427,18 +452,23 @@ qboolean Net_ConnectToServer(sv_t *qtv, char *ip) qtv->nextconnectattempt = qtv->curtime + RECONNECT_TIME; //wait half a minuite before trying to reconnect + at = strchrrev(ip, '@'); + if (at) + ip = at+1; + if (!strncmp(ip, "udp:", 4)) { qtv->usequkeworldprotocols = true; - return Net_ConnectToUDPServer(qtv, ip); + status = Net_ConnectToUDPServer(qtv, ip); } else if (!strncmp(ip, "tcp:", 4)) - return Net_ConnectToTCPServer(qtv, ip); + status = Net_ConnectToTCPServer(qtv, ip); else { Sys_Printf(qtv->cluster, "Unknown source type %s\n", ip); - return false; + status = false; } + return status; } void Net_QueueUpstream(sv_t *qtv, int size, char *buffer)