Skip to content

Commit

Permalink
fix: websockets failing due to HTTP request having improper response …
Browse files Browse the repository at this point in the history
…sent
  • Loading branch information
BlenMiner committed Dec 20, 2023
1 parent d38974e commit fc0acd0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 3d-pixels-client/Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1176,17 +1176,17 @@ PrefabInstance:
- target: {fileID: 2530163867034958643, guid: 84488ffec075cd0498e2642533b000e1,
type: 3}
propertyPath: m_ssl
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2530163867034958643, guid: 84488ffec075cd0498e2642533b000e1,
type: 3}
propertyPath: m_host
value: 3dpixels.riten.dev
value: localhost
objectReference: {fileID: 0}
- target: {fileID: 2530163867034958643, guid: 84488ffec075cd0498e2642533b000e1,
type: 3}
propertyPath: m_port
value: 443
value: 8080
objectReference: {fileID: 0}
- target: {fileID: 2530163867034958643, guid: 84488ffec075cd0498e2642533b000e1,
type: 3}
Expand Down
7 changes: 7 additions & 0 deletions 3d-pixels-server/PixelsServerSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ protected override async void OnReceivedRequest(HttpRequest request)
string urlPath = unescapedPathAndQuery[0];
string urlQuery = unescapedPathAndQuery.Length > 1 ? unescapedPathAndQuery[1] : string.Empty;

for (int i = 0; i < request.Headers; i++)
{
(string key, string value) = request.Header(i);
if (key == "Upgrade" && value == "websocket")
return;
}

switch (request.Method)
{
case "GET": await HandleGETRequests(request, isLocalHost, rootUrl, urlPath, urlQuery); break;
Expand Down

0 comments on commit fc0acd0

Please sign in to comment.