docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SteamGameServerHTTP

    Purpose: interface to http client

    Inheritance
    object
    SteamGameServerHTTP
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Steamworks.Interop
    Assembly: Unity.Steamworks.Interop.dll
    Syntax
    public static class SteamGameServerHTTP

    Methods

    CreateCookieContainer(bool)

    Creates a cookie container handle which you must later free with ReleaseCookieContainer(). If bAllowResponsesToModify=true than any response to your requests using this cookie container may add new cookies which may be transmitted with future requests. If bAllowResponsesToModify=false than only cookies you explicitly set will be sent. This API is just for during process lifetime, after steam restarts no cookies are persisted and you have no way to access the cookie container across repeat executions of your process.

    Declaration
    public static HTTPCookieContainerHandle CreateCookieContainer(bool bAllowResponsesToModify)
    Parameters
    Type Name Description
    bool bAllowResponsesToModify

    Passed through to ISteamGameServerHTTP::CreateCookieContainer.

    Returns
    Type Description
    HTTPCookieContainerHandle

    The value ISteamGameServerHTTP::CreateCookieContainer returns.

    CreateHTTPRequest(EHTTPMethod, string)

    Initializes a new HTTP request, returning a handle to use in further operations on it. Requires the method (GET or POST) and the absolute URL for the request. Both http and https are supported, so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/ or such.

    Declaration
    public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL)
    Parameters
    Type Name Description
    EHTTPMethod eHTTPRequestMethod

    Passed through to ISteamGameServerHTTP::CreateHTTPRequest.

    string pchAbsoluteURL

    Passed through to ISteamGameServerHTTP::CreateHTTPRequest.

    Returns
    Type Description
    HTTPRequestHandle

    The value ISteamGameServerHTTP::CreateHTTPRequest returns.

    DeferHTTPRequest(HTTPRequestHandle)

    Defers a request you have sent, the actual HTTP client code may have many requests queued, and this will move the specified request to the tail of the queue. Returns false on invalid handle, or if the request is not yet sent.

    Declaration
    public static bool DeferHTTPRequest(HTTPRequestHandle hRequest)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::DeferHTTPRequest.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::DeferHTTPRequest returns.

    GetHTTPDownloadProgressPct(HTTPRequestHandle, out float)

    Gets progress on downloading the body for the request. This will be zero unless a response header has already been received which included a content-length field. For responses that contain no content-length it will report zero for the duration of the request as the size is unknown until the connection closes.

    Declaration
    public static bool GetHTTPDownloadProgressPct(HTTPRequestHandle hRequest, out float pflPercentOut)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::GetHTTPDownloadProgressPct.

    float pflPercentOut

    Passed through to ISteamGameServerHTTP::GetHTTPDownloadProgressPct.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::GetHTTPDownloadProgressPct returns.

    GetHTTPRequestWasTimedOut(HTTPRequestHandle, out bool)

    Check if the reason the request failed was because we timed it out (rather than some harder failure)

    Declaration
    public static bool GetHTTPRequestWasTimedOut(HTTPRequestHandle hRequest, out bool pbWasTimedOut)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::GetHTTPRequestWasTimedOut.

    bool pbWasTimedOut

    Passed through to ISteamGameServerHTTP::GetHTTPRequestWasTimedOut.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::GetHTTPRequestWasTimedOut returns.

    GetHTTPResponseBodyData(HTTPRequestHandle, byte[], uint)

    Gets the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the handle is invalid or is to a streaming response, or if the provided buffer is not the correct size. Use BGetHTTPResponseBodySize first to find out the correct buffer size to use.

    Declaration
    public static bool GetHTTPResponseBodyData(HTTPRequestHandle hRequest, byte[] pBodyDataBuffer, uint unBufferSize)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::GetHTTPResponseBodyData.

    byte[] pBodyDataBuffer

    Passed through to ISteamGameServerHTTP::GetHTTPResponseBodyData.

    uint unBufferSize

    Passed through to ISteamGameServerHTTP::GetHTTPResponseBodyData.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::GetHTTPResponseBodyData returns.

    GetHTTPResponseBodySize(HTTPRequestHandle, out uint)

    Gets the size of the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the handle is invalid.

    Declaration
    public static bool GetHTTPResponseBodySize(HTTPRequestHandle hRequest, out uint unBodySize)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::GetHTTPResponseBodySize.

    uint unBodySize

    Passed through to ISteamGameServerHTTP::GetHTTPResponseBodySize.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::GetHTTPResponseBodySize returns.

    GetHTTPResponseHeaderSize(HTTPRequestHandle, string, out uint)

    Checks if a response header is present in a HTTP response given a handle from HTTPRequestCompleted_t, also returns the size of the header value if present so the caller and allocate a correctly sized buffer for GetHTTPResponseHeaderValue.

    Declaration
    public static bool GetHTTPResponseHeaderSize(HTTPRequestHandle hRequest, string pchHeaderName, out uint unResponseHeaderSize)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::GetHTTPResponseHeaderSize.

    string pchHeaderName

    Passed through to ISteamGameServerHTTP::GetHTTPResponseHeaderSize.

    uint unResponseHeaderSize

    Passed through to ISteamGameServerHTTP::GetHTTPResponseHeaderSize.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::GetHTTPResponseHeaderSize returns.

    GetHTTPResponseHeaderValue(HTTPRequestHandle, string, byte[], uint)

    Gets header values from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the header is not present or if your buffer is too small to contain it's value. You should first call BGetHTTPResponseHeaderSize to check for the presence of the header and to find out the size buffer needed.

    Declaration
    public static bool GetHTTPResponseHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, byte[] pHeaderValueBuffer, uint unBufferSize)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::GetHTTPResponseHeaderValue.

    string pchHeaderName

    Passed through to ISteamGameServerHTTP::GetHTTPResponseHeaderValue.

    byte[] pHeaderValueBuffer

    Passed through to ISteamGameServerHTTP::GetHTTPResponseHeaderValue.

    uint unBufferSize

    Passed through to ISteamGameServerHTTP::GetHTTPResponseHeaderValue.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::GetHTTPResponseHeaderValue returns.

    GetHTTPStreamingResponseBodyData(HTTPRequestHandle, uint, byte[], uint)

    Gets the body data from a streaming HTTP response given a handle from HTTPRequestDataReceived_t. Will return false if the handle is invalid or is to a non-streaming response (meaning it wasn't sent with SendHTTPRequestAndStreamResponse), or if the buffer size and offset do not match the size and offset sent in HTTPRequestDataReceived_t.

    Declaration
    public static bool GetHTTPStreamingResponseBodyData(HTTPRequestHandle hRequest, uint cOffset, byte[] pBodyDataBuffer, uint unBufferSize)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::GetHTTPStreamingResponseBodyData.

    uint cOffset

    Passed through to ISteamGameServerHTTP::GetHTTPStreamingResponseBodyData.

    byte[] pBodyDataBuffer

    Passed through to ISteamGameServerHTTP::GetHTTPStreamingResponseBodyData.

    uint unBufferSize

    Passed through to ISteamGameServerHTTP::GetHTTPStreamingResponseBodyData.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::GetHTTPStreamingResponseBodyData returns.

    PrioritizeHTTPRequest(HTTPRequestHandle)

    Prioritizes a request you have sent, the actual HTTP client code may have many requests queued, and this will move the specified request to the head of the queue. Returns false on invalid handle, or if the request is not yet sent.

    Declaration
    public static bool PrioritizeHTTPRequest(HTTPRequestHandle hRequest)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::PrioritizeHTTPRequest.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::PrioritizeHTTPRequest returns.

    ReleaseCookieContainer(HTTPCookieContainerHandle)

    Release a cookie container you are finished using, freeing it's memory

    Declaration
    public static bool ReleaseCookieContainer(HTTPCookieContainerHandle hCookieContainer)
    Parameters
    Type Name Description
    HTTPCookieContainerHandle hCookieContainer

    Passed through to ISteamGameServerHTTP::ReleaseCookieContainer.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::ReleaseCookieContainer returns.

    ReleaseHTTPRequest(HTTPRequestHandle)

    Releases an HTTP response handle, should always be called to free resources after receiving a HTTPRequestCompleted_t callback and finishing using the response.

    Declaration
    public static bool ReleaseHTTPRequest(HTTPRequestHandle hRequest)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::ReleaseHTTPRequest.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::ReleaseHTTPRequest returns.

    SendHTTPRequest(HTTPRequestHandle, out SteamAPICall_t)

    Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on asynchronous response via callback. Note: If the user is in offline mode in Steam, then this will add a only-if-cached cache-control header and only do a local cache lookup rather than sending any actual remote request.

    Declaration
    public static bool SendHTTPRequest(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::SendHTTPRequest.

    SteamAPICall_t pCallHandle

    Passed through to ISteamGameServerHTTP::SendHTTPRequest.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SendHTTPRequest returns.

    SendHTTPRequestAndStreamResponse(HTTPRequestHandle, out SteamAPICall_t)

    Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on asynchronous response via callback for completion, and listen for HTTPRequestHeadersReceived_t and HTTPRequestDataReceived_t callbacks while streaming.

    Declaration
    public static bool SendHTTPRequestAndStreamResponse(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::SendHTTPRequestAndStreamResponse.

    SteamAPICall_t pCallHandle

    Passed through to ISteamGameServerHTTP::SendHTTPRequestAndStreamResponse.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SendHTTPRequestAndStreamResponse returns.

    SetCookie(HTTPCookieContainerHandle, string, string, string)

    Adds a cookie to the specified cookie container that will be used with future requests.

    Declaration
    public static bool SetCookie(HTTPCookieContainerHandle hCookieContainer, string pchHost, string pchUrl, string pchCookie)
    Parameters
    Type Name Description
    HTTPCookieContainerHandle hCookieContainer

    Passed through to ISteamGameServerHTTP::SetCookie.

    string pchHost

    Passed through to ISteamGameServerHTTP::SetCookie.

    string pchUrl

    Passed through to ISteamGameServerHTTP::SetCookie.

    string pchCookie

    Passed through to ISteamGameServerHTTP::SetCookie.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SetCookie returns.

    SetHTTPRequestAbsoluteTimeoutMS(HTTPRequestHandle, uint)

    Set an absolute timeout on the HTTP request, this is just a total time timeout different than the network activity timeout which can bump everytime we get more data

    Declaration
    public static bool SetHTTPRequestAbsoluteTimeoutMS(HTTPRequestHandle hRequest, uint unMilliseconds)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::SetHTTPRequestAbsoluteTimeoutMS.

    uint unMilliseconds

    Passed through to ISteamGameServerHTTP::SetHTTPRequestAbsoluteTimeoutMS.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SetHTTPRequestAbsoluteTimeoutMS returns.

    SetHTTPRequestContextValue(HTTPRequestHandle, ulong)

    Set a context value for the request, which will be returned in the HTTPRequestCompleted_t callback after sending the request. This is just so the caller can easily keep track of which callbacks go with which request data.

    Declaration
    public static bool SetHTTPRequestContextValue(HTTPRequestHandle hRequest, ulong ulContextValue)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::SetHTTPRequestContextValue.

    ulong ulContextValue

    Passed through to ISteamGameServerHTTP::SetHTTPRequestContextValue.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SetHTTPRequestContextValue returns.

    SetHTTPRequestCookieContainer(HTTPRequestHandle, HTTPCookieContainerHandle)

    Set the cookie container to use for a HTTP request

    Declaration
    public static bool SetHTTPRequestCookieContainer(HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::SetHTTPRequestCookieContainer.

    HTTPCookieContainerHandle hCookieContainer

    Passed through to ISteamGameServerHTTP::SetHTTPRequestCookieContainer.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SetHTTPRequestCookieContainer returns.

    SetHTTPRequestGetOrPostParameter(HTTPRequestHandle, string, string)

    Set a GET or POST parameter value on the request, which is set will depend on the EHTTPMethod specified when creating the request. Must be called prior to sending the request. Will return false if the handle is invalid or the request is already sent.

    Declaration
    public static bool SetHTTPRequestGetOrPostParameter(HTTPRequestHandle hRequest, string pchParamName, string pchParamValue)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::SetHTTPRequestGetOrPostParameter.

    string pchParamName

    Passed through to ISteamGameServerHTTP::SetHTTPRequestGetOrPostParameter.

    string pchParamValue

    Passed through to ISteamGameServerHTTP::SetHTTPRequestGetOrPostParameter.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SetHTTPRequestGetOrPostParameter returns.

    SetHTTPRequestHeaderValue(HTTPRequestHandle, string, string)

    Set a request header value for the request, must be called prior to sending the request. Will return false if the handle is invalid or the request is already sent.

    Declaration
    public static bool SetHTTPRequestHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, string pchHeaderValue)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::SetHTTPRequestHeaderValue.

    string pchHeaderName

    Passed through to ISteamGameServerHTTP::SetHTTPRequestHeaderValue.

    string pchHeaderValue

    Passed through to ISteamGameServerHTTP::SetHTTPRequestHeaderValue.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SetHTTPRequestHeaderValue returns.

    SetHTTPRequestNetworkActivityTimeout(HTTPRequestHandle, uint)

    Set a timeout in seconds for the HTTP request, must be called prior to sending the request. Default timeout is 60 seconds if you don't call this. Returns false if the handle is invalid, or the request has already been sent.

    Declaration
    public static bool SetHTTPRequestNetworkActivityTimeout(HTTPRequestHandle hRequest, uint unTimeoutSeconds)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::SetHTTPRequestNetworkActivityTimeout.

    uint unTimeoutSeconds

    Passed through to ISteamGameServerHTTP::SetHTTPRequestNetworkActivityTimeout.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SetHTTPRequestNetworkActivityTimeout returns.

    SetHTTPRequestRawPostBody(HTTPRequestHandle, string, byte[], uint)

    Sets the body for an HTTP Post request. Will fail and return false on a GET request, and will fail if POST params have already been set for the request. Setting this raw body makes it the only contents for the post, the pchContentType parameter will set the content-type header for the request so the server may know how to interpret the body.

    Declaration
    public static bool SetHTTPRequestRawPostBody(HTTPRequestHandle hRequest, string pchContentType, byte[] pubBody, uint unBodyLen)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::SetHTTPRequestRawPostBody.

    string pchContentType

    Passed through to ISteamGameServerHTTP::SetHTTPRequestRawPostBody.

    byte[] pubBody

    Passed through to ISteamGameServerHTTP::SetHTTPRequestRawPostBody.

    uint unBodyLen

    Passed through to ISteamGameServerHTTP::SetHTTPRequestRawPostBody.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SetHTTPRequestRawPostBody returns.

    SetHTTPRequestRequiresVerifiedCertificate(HTTPRequestHandle, bool)

    Disable or re-enable verification of SSL/TLS certificates. By default, certificates are checked for all HTTPS requests.

    Declaration
    public static bool SetHTTPRequestRequiresVerifiedCertificate(HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::SetHTTPRequestRequiresVerifiedCertificate.

    bool bRequireVerifiedCertificate

    Passed through to ISteamGameServerHTTP::SetHTTPRequestRequiresVerifiedCertificate.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SetHTTPRequestRequiresVerifiedCertificate returns.

    SetHTTPRequestUserAgentInfo(HTTPRequestHandle, string)

    Set the extra user agent info for a request, this doesn't clobber the normal user agent, it just adds the extra info on the end

    Declaration
    public static bool SetHTTPRequestUserAgentInfo(HTTPRequestHandle hRequest, string pchUserAgentInfo)
    Parameters
    Type Name Description
    HTTPRequestHandle hRequest

    Passed through to ISteamGameServerHTTP::SetHTTPRequestUserAgentInfo.

    string pchUserAgentInfo

    Passed through to ISteamGameServerHTTP::SetHTTPRequestUserAgentInfo.

    Returns
    Type Description
    bool

    The value ISteamGameServerHTTP::SetHTTPRequestUserAgentInfo returns.

    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)