Fix some qtv/browser connectivity bugs/timing issues.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6175 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
5fb58a8990
commit
a61976a3e6
2 changed files with 18 additions and 4 deletions
|
@ -1059,11 +1059,22 @@ void HTTPSV_GetMethod(cluster_t *cluster, oproxy_t *pend)
|
|||
{
|
||||
if (HTTPSV_GetHeaderField((char*)pend->inbuffer, "Upgrade", upgrade, sizeof(upgrade)) && !stricmp(upgrade, "websocket"))
|
||||
{
|
||||
char wsprot[64];
|
||||
char ver[64];
|
||||
char key[64];
|
||||
HTTPSV_GetHeaderField((char*)pend->inbuffer, "Sec-WebSocket-Key", key, sizeof(key));
|
||||
|
||||
if (HTTPSV_GetHeaderField((char*)pend->inbuffer, "Sec-WebSocket-Version", ver, sizeof(ver)) && atoi(ver) != 13)
|
||||
HTTPSV_GetHeaderField((char*)pend->inbuffer, "Sec-WebSocket-Protocol", wsprot, sizeof(wsprot));
|
||||
|
||||
if (strcmp(wsprot, "quake") && strcmp(wsprot, "fteqw"))
|
||||
{
|
||||
#define dest pend
|
||||
HTTPSV_SendHTTPHeader(cluster, pend, "404", "text/html", true);
|
||||
HTTPSV_SendHTMLHeader(cluster, pend, "Websocket SubProtocol not recognised", "");
|
||||
HTMLPRINT("<h1>Websocket SubProtocol not recognised</h1>");
|
||||
HTTPSV_SendHTMLFooter(cluster, pend);
|
||||
}
|
||||
else if (HTTPSV_GetHeaderField((char*)pend->inbuffer, "Sec-WebSocket-Version", ver, sizeof(ver)) && atoi(ver) != 13)
|
||||
{
|
||||
s = "HTTP/1.1 426 Upgrade Required\r\n"
|
||||
"Sec-WebSocket-Version: 13\r\n"
|
||||
|
@ -1086,12 +1097,14 @@ void HTTPSV_GetMethod(cluster_t *cluster, oproxy_t *pend)
|
|||
"Connection: Upgrade\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n" //allow cross-origin requests. this means you can use any domain to play on any public server.
|
||||
"Sec-WebSocket-Accept: %s\r\n"
|
||||
// "Sec-WebSocket-Protocol: FTEQTVWebSocket\r\n"
|
||||
"\r\n", acceptkey);
|
||||
"Sec-WebSocket-Protocol: %s\r\n"
|
||||
"\r\n", acceptkey, wsprot);
|
||||
//send the websocket handshake response.
|
||||
Net_ProxySend(cluster, pend, padkey, strlen(padkey));
|
||||
pend->websocket.websocket = true;
|
||||
|
||||
pend->droptime = cluster->curtime + 20*1000;
|
||||
|
||||
printf("websocket upgrade\n");
|
||||
}
|
||||
pend->drop = false;
|
||||
|
|
|
@ -796,7 +796,8 @@ qboolean Netchan_Process (netchan_t *chan, netmsg_t *msg)
|
|||
|
||||
// read the qport if we are a server
|
||||
if (!chan->isclient)
|
||||
ReadShort (msg);
|
||||
if (chan->qport != ReadShort (msg))
|
||||
return false;
|
||||
|
||||
reliable_message = sequence >> 31;
|
||||
reliable_ack = sequence_ack >> 31;
|
||||
|
|
Loading…
Reference in a new issue