Fix streaming HTTP response header and data callbacks

This commit is contained in:
Nicholas Hastings
2026-07-12 21:20:00 -04:00
parent a779d6d961
commit 645103735e
6 changed files with 94 additions and 25 deletions
+20 -1
View File
@@ -21,6 +21,10 @@
#include "steam_gameserver.h"
#include "smsdk_ext.h"
#include <unordered_map>
class SteamWorksHTTPRequest;
class SteamWorksHTTP :
public IHandleTypeDispatch
{
@@ -31,12 +35,27 @@ class SteamWorksHTTP :
public:
void OnHandleDestroy(HandleType_t type, void *object);
bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize);
public:
HandleType_t GetHTTPHandle(void);
/* Streaming responses report progress through HTTPRequestHeadersReceived_t /
HTTPRequestDataReceived_t. Steam delivers those as broadcast gameserver
callbacks (not as call results of the streaming API call), so a single
dispatcher here receives them and routes each one to the owning request by
its handle. Requests add/remove themselves as they are created/destroyed. */
void RegisterRequest(SteamWorksHTTPRequest *pRequest);
void UnregisterRequest(SteamWorksHTTPRequest *pRequest);
private:
SteamWorksHTTPRequest *FindRequest(HTTPRequestHandle request);
STEAM_GAMESERVER_CALLBACK(SteamWorksHTTP, OnHTTPHeadersReceived, HTTPRequestHeadersReceived_t, m_CallbackHeadersReceived);
STEAM_GAMESERVER_CALLBACK(SteamWorksHTTP, OnHTTPDataReceived, HTTPRequestDataReceived_t, m_CallbackDataReceived);
private:
HandleType_t typeHTTP;
std::unordered_map<HTTPRequestHandle, SteamWorksHTTPRequest *> m_Requests;
};
#include "swhttprequest.h"