/// <summary>
		/// <para> Set a request header value for the request, must be called prior to sending the request.  Will</para>
		/// <para> return false if the handle is invalid or the request is already sent.</para>
		/// </summary>
		public static bool SetHTTPRequestHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, string pchHeaderValue) {
			InteropHelp.TestIfAvailableClient();
			using (var pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName))
			using (var pchHeaderValue2 = new InteropHelp.UTF8StringHandle(pchHeaderValue)) {
				return NativeMethods.ISteamHTTP_SetHTTPRequestHeaderValue(hRequest, pchHeaderName2, pchHeaderValue2);
			}
		}
		/// <summary>
		/// <para> Set a GET or POST parameter value on the request, which is set will depend on the EHTTPMethod specified</para>
		/// <para> when creating the request.  Must be called prior to sending the request.  Will return false if the</para>
		/// <para> handle is invalid or the request is already sent.</para>
		/// </summary>
		public static bool SetHTTPRequestGetOrPostParameter(HTTPRequestHandle hRequest, string pchParamName, string pchParamValue) {
			InteropHelp.TestIfAvailableGameServer();
			using (var pchParamName2 = new InteropHelp.UTF8StringHandle(pchParamName))
			using (var pchParamValue2 = new InteropHelp.UTF8StringHandle(pchParamValue)) {
				return NativeMethods.ISteamGameServerHTTP_SetHTTPRequestGetOrPostParameter(hRequest, pchParamName2, pchParamValue2);
			}
		}
 public static bool GetHTTPResponseHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, byte[] pHeaderValueBuffer, uint unBufferSize)
 {
     InteropHelp.TestIfAvailableGameServer();
     bool result;
     using (InteropHelp.UTF8StringHandle uTF8StringHandle = new InteropHelp.UTF8StringHandle(pchHeaderName))
     {
         result = NativeMethods.ISteamGameServerHTTP_GetHTTPResponseHeaderValue(hRequest, uTF8StringHandle, pHeaderValueBuffer, unBufferSize);
     }
     return result;
 }
        public bool SetHTTPRequestHeaderValue(HTTPRequestHandle request, string headerName, string headerValue)
        {
            CheckIfUsable();

            using (NativeString nativeHeaderName = new NativeString(headerName))
            {
                using (NativeString nativeHeaderValue = new NativeString(headerValue))
                {
                    return NativeMethods.HTTP_SetHTTPRequestHeaderValue(request.AsUInt32, nativeHeaderName.ToNativeAsUtf8(), nativeHeaderValue.ToNativeAsUtf8());
                }
            }
        }
 protected void setHTTPRequestHandle(HTTPRequestHandle newHTTPRequestHandle)
 {
     this.httpRequestHandle = newHTTPRequestHandle;
 }
Exemple #6
0
 public static bool SetHTTPRequestUserAgentInfo(HTTPRequestHandle hRequest, string pchUserAgentInfo)
 {
     InteropHelp.TestIfAvailableClient();
     using InteropHelp.UTF8StringHandle pchUserAgentInfo2 = new InteropHelp.UTF8StringHandle(pchUserAgentInfo);
     return(NativeMethods.ISteamHTTP_SetHTTPRequestUserAgentInfo(CSteamAPIContext.GetSteamHTTP(), hRequest, pchUserAgentInfo2));
 }
		/// <summary>
		/// <para> Set a timeout in seconds for the HTTP request, must be called prior to sending the request.  Default</para>
		/// <para> timeout is 60 seconds if you don't call this.  Returns false if the handle is invalid, or the request</para>
		/// <para> has already been sent.</para>
		/// </summary>
		public static bool SetHTTPRequestNetworkActivityTimeout(HTTPRequestHandle hRequest, uint unTimeoutSeconds) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_SetHTTPRequestNetworkActivityTimeout(hRequest, unTimeoutSeconds);
		}
		/// <summary>
		/// <para> Set that https request should require verified SSL certificate via machines certificate trust store</para>
		/// </summary>
		public static bool SetHTTPRequestRequiresVerifiedCertificate(HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_SetHTTPRequestRequiresVerifiedCertificate(hRequest, bRequireVerifiedCertificate);
		}
		/// <summary>
		/// <para> Gets progress on downloading the body for the request.  This will be zero unless a response header has already been</para>
		/// <para> received which included a content-length field.  For responses that contain no content-length it will report</para>
		/// <para> zero for the duration of the request as the size is unknown until the connection closes.</para>
		/// </summary>
		public static bool GetHTTPDownloadProgressPct(HTTPRequestHandle hRequest, out float pflPercentOut) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_GetHTTPDownloadProgressPct(hRequest, out pflPercentOut);
		}
		// 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.
		public static bool GetHTTPResponseHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, byte[] pHeaderValueBuffer, uint unBufferSize) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamHTTP_GetHTTPResponseHeaderValue(hRequest, pchHeaderName, pHeaderValueBuffer, unBufferSize);
		}
		// 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.
		public static bool SetHTTPRequestHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, string pchHeaderValue) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamHTTP_SetHTTPRequestHeaderValue(hRequest, pchHeaderName, pchHeaderValue);
		}
Exemple #12
0
 public static bool SetHTTPRequestCookieContainer(HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_SetHTTPRequestCookieContainer(hRequest, hCookieContainer));
 }
Exemple #13
0
 public static bool SetHTTPRequestContextValue(HTTPRequestHandle hRequest, ulong ulContextValue)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_SetHTTPRequestContextValue(hRequest, ulContextValue));
 }
Exemple #14
0
 public static bool GetHTTPDownloadProgressPct(HTTPRequestHandle hRequest, out float pflPercentOut)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_GetHTTPDownloadProgressPct(hRequest, out pflPercentOut));
 }
Exemple #15
0
 /// <summary>
 /// <para> Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on</para>
 /// <para> asynchronous response via callback.</para>
 /// <para> Note: If the user is in offline mode in Steam, then this will add a only-if-cached cache-control</para>
 /// <para> header and only do a local cache lookup rather than sending any actual remote request.</para>
 /// </summary>
 public static bool SendHTTPRequest(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_SendHTTPRequest(CSteamAPIContext.GetSteamHTTP(), hRequest, out pCallHandle));
 }
Exemple #16
0
 /// <summary>
 /// <para> Defers a request you have sent, the actual HTTP client code may have many requests queued, and this will move</para>
 /// <para> the specified request to the tail of the queue.  Returns false on invalid handle, or if the request is not yet sent.</para>
 /// </summary>
 public static bool DeferHTTPRequest(HTTPRequestHandle hRequest)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_DeferHTTPRequest(CSteamAPIContext.GetSteamHTTP(), hRequest));
 }
 public SteamworksWebRequestHandle(HTTPRequestHandle newHTTPRequestHandle, WebRequestReadyCallback newWebRequestReadyCallback)
 {
     this.setHTTPRequestHandle(newHTTPRequestHandle);
     this.webRequestReadyCallback = newWebRequestReadyCallback;
 }
		public static extern bool ISteamGameServerHTTP_GetHTTPRequestWasTimedOut(HTTPRequestHandle hRequest, out bool pbWasTimedOut);
		// 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.
		public static bool GetHTTPResponseBodyData(HTTPRequestHandle hRequest, byte[] pBodyDataBuffer, uint unBufferSize) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamHTTP_GetHTTPResponseBodyData(hRequest, pBodyDataBuffer, unBufferSize);
		}
Exemple #20
0
 public static bool SetHTTPRequestRequiresVerifiedCertificate(HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate(hRequest, bRequireVerifiedCertificate));
 }
		// 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.
		public static bool SendHTTPRequest(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamHTTP_SendHTTPRequest(hRequest, out pCallHandle);
		}
Exemple #22
0
 public static bool SetHTTPRequestAbsoluteTimeoutMS(HTTPRequestHandle hRequest, uint unMilliseconds)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS(hRequest, unMilliseconds));
 }
		/// <summary>
		/// <para> Gets the size of the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the</para>
		/// <para> handle is invalid.</para>
		/// </summary>
		public static bool GetHTTPResponseBodySize(HTTPRequestHandle hRequest, out uint unBodySize) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_GetHTTPResponseBodySize(hRequest, out unBodySize);
		}
Exemple #24
0
 public static bool GetHTTPRequestWasTimedOut(HTTPRequestHandle hRequest, out bool pbWasTimedOut)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_GetHTTPRequestWasTimedOut(hRequest, out pbWasTimedOut));
 }
		/// <summary>
		/// <para> Set the cookie container to use for a HTTP request</para>
		/// </summary>
		public static bool SetHTTPRequestCookieContainer(HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_SetHTTPRequestCookieContainer(hRequest, hCookieContainer);
		}
Exemple #26
0
 public static bool SetHTTPRequestNetworkActivityTimeout(HTTPRequestHandle hRequest, uint unTimeoutSeconds)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_SetHTTPRequestNetworkActivityTimeout(hRequest, unTimeoutSeconds));
 }
		/// <summary>
		/// <para> Check if the reason the request failed was because we timed it out (rather than some harder failure)</para>
		/// </summary>
		public static bool GetHTTPRequestWasTimedOut(HTTPRequestHandle hRequest, out bool pbWasTimedOut) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_GetHTTPRequestWasTimedOut(hRequest, out pbWasTimedOut);
		}
Exemple #28
0
 public static bool SendHTTPRequestAndStreamResponse(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_SendHTTPRequestAndStreamResponse(hRequest, out pCallHandle));
 }
		/// <summary>
		/// <para> Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on</para>
		/// <para> asynchronous response via callback for completion, and listen for HTTPRequestHeadersReceived_t and</para>
		/// <para> HTTPRequestDataReceived_t callbacks while streaming.</para>
		/// </summary>
		public static bool SendHTTPRequestAndStreamResponse(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_SendHTTPRequestAndStreamResponse(hRequest, out pCallHandle);
		}
		public static extern bool ISteamGameServerHTTP_SetHTTPRequestRequiresVerifiedCertificate(HTTPRequestHandle hRequest, [MarshalAs(UnmanagedType.I1)] bool bRequireVerifiedCertificate);
Exemple #31
0
 public static bool PrioritizeHTTPRequest(HTTPRequestHandle hRequest)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_PrioritizeHTTPRequest(hRequest));
 }
Exemple #32
0
 public static bool GetHTTPResponseHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, byte[] pHeaderValueBuffer, uint unBufferSize)
 {
     InteropHelp.TestIfAvailableClient();
     using InteropHelp.UTF8StringHandle pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName);
     return(NativeMethods.ISteamHTTP_GetHTTPResponseHeaderValue(CSteamAPIContext.GetSteamHTTP(), hRequest, pchHeaderName2, pHeaderValueBuffer, unBufferSize));
 }
		public static extern bool ISteamGameServerHTTP_SetHTTPRequestUserAgentInfo(HTTPRequestHandle hRequest, InteropHelp.UTF8StringHandle pchUserAgentInfo);
Exemple #34
0
 public static bool GetHTTPResponseBodySize(HTTPRequestHandle hRequest, out uint unBodySize)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_GetHTTPResponseBodySize(hRequest, out unBodySize));
 }
		public static extern bool ISteamGameServerHTTP_SetHTTPRequestAbsoluteTimeoutMS(HTTPRequestHandle hRequest, uint unMilliseconds);
Exemple #36
0
 public static bool GetHTTPResponseBodyData(HTTPRequestHandle hRequest, byte[] pBodyDataBuffer, uint unBufferSize)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_GetHTTPResponseBodyData(hRequest, pBodyDataBuffer, unBufferSize));
 }
		public static extern bool ISteamHTTP_SetHTTPRequestContextValue(HTTPRequestHandle hRequest, ulong ulContextValue);
Exemple #38
0
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 120, 0, 120, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_RequestHandle: " + m_RequestHandle);
        GUILayout.Label("m_ContextValue: " + m_ContextValue);
        GUILayout.Label("m_Offset: " + m_Offset);
        GUILayout.Label("m_BufferSize: " + m_BufferSize);
        GUILayout.Label("m_CookieContainer: " + m_CookieContainer);
        GUILayout.EndArea();

        if (GUILayout.Button("CreateHTTPRequest(k_EHTTPMethodGET, \"http://httpbin.org/get\")")) {
            m_RequestHandle = SteamHTTP.CreateHTTPRequest(EHTTPMethod.k_EHTTPMethodGET, "http://httpbin.org/get");
            print("SteamHTTP.CreateHTTPRequest(EHTTPMethod.k_EHTTPMethodGET, \"http://httpbin.org/get\") : " + m_RequestHandle);
        }

        if (GUILayout.Button("SetHTTPRequestContextValue(m_RequestHandle, 1)")) {
            print("SteamHTTP.SetHTTPRequestContextValue(" + m_RequestHandle + ", 1) : " + SteamHTTP.SetHTTPRequestContextValue(m_RequestHandle, 1));
        }

        if (GUILayout.Button("SetHTTPRequestNetworkActivityTimeout(m_RequestHandle, 30)")) {
            print("SteamHTTP.SetHTTPRequestNetworkActivityTimeout(" + m_RequestHandle + ", 30) : " + SteamHTTP.SetHTTPRequestNetworkActivityTimeout(m_RequestHandle, 30));
        }

        if (GUILayout.Button("SetHTTPRequestHeaderValue(m_RequestHandle, \"From\", \"[email protected]\")")) {
            print("SteamHTTP.SetHTTPRequestHeaderValue(" + m_RequestHandle + ", \"From\", \"[email protected]\") : " + SteamHTTP.SetHTTPRequestHeaderValue(m_RequestHandle, "From", "*****@*****.**"));
        }

        if (GUILayout.Button("SetHTTPRequestGetOrPostParameter(m_RequestHandle, \"testing\", \"Steamworks.NET\")")) {
            print("SteamHTTP.SetHTTPRequestGetOrPostParameter(" + m_RequestHandle + ", \"testing\", \"Steamworks.NET\") : " + SteamHTTP.SetHTTPRequestGetOrPostParameter(m_RequestHandle, "testing", "Steamworks.NET"));
        }

        if (GUILayout.Button("SendHTTPRequest(m_RequestHandle, out handle)")) {
            SteamAPICall_t handle;
            bool ret = SteamHTTP.SendHTTPRequest(m_RequestHandle, out handle);
            OnHTTPRequestCompletedCallResult.Set(handle);
            print("SteamHTTP.SendHTTPRequest(" + m_RequestHandle + ", out handle) : " + ret + " -- " + handle);
        }

        if (GUILayout.Button("SendHTTPRequestAndStreamResponse(m_RequestHandle, out handle)")) {
            SteamAPICall_t handle;
            bool ret = SteamHTTP.SendHTTPRequestAndStreamResponse(m_RequestHandle, out handle);
            OnHTTPRequestCompletedCallResult.Set(handle);
            print("SteamHTTP.SendHTTPRequestAndStreamResponse(" + m_RequestHandle + ", out handle) : " + ret + " -- " + handle);
        }

        if (GUILayout.Button("DeferHTTPRequest(m_RequestHandle)")) {
            print("SteamHTTP.DeferHTTPRequest(" + m_RequestHandle + ") : " + SteamHTTP.DeferHTTPRequest(m_RequestHandle));
        }

        if (GUILayout.Button("PrioritizeHTTPRequest(m_RequestHandle)")) {
            print("SteamHTTP.PrioritizeHTTPRequest(" + m_RequestHandle + ") : " + SteamHTTP.PrioritizeHTTPRequest(m_RequestHandle));
        }

        if (GUILayout.Button("GetHTTPResponseHeaderSize(m_RequestHandle, \"User-Agent\", out ResponseHeaderSize)")) {
            uint ResponseHeaderSize;
            bool ret = SteamHTTP.GetHTTPResponseHeaderSize(m_RequestHandle, "User-Agent", out ResponseHeaderSize);
            print("SteamHTTP.GetHTTPResponseHeaderSize(" + m_RequestHandle + ", \"User-Agent\", out ResponseHeaderSize) : " + ret + " -- " + ResponseHeaderSize);
        }

        if (GUILayout.Button("GetHTTPResponseHeaderValue(m_RequestHandle, \"User-Agent\", HeaderValueBuffer, ResponseHeaderSize)")) {
            uint ResponseHeaderSize;
            SteamHTTP.GetHTTPResponseHeaderSize(m_RequestHandle, "User-Agent", out ResponseHeaderSize);

            byte[] HeaderValueBuffer = new byte[ResponseHeaderSize];
            bool ret = SteamHTTP.GetHTTPResponseHeaderValue(m_RequestHandle, "User-Agent", HeaderValueBuffer, ResponseHeaderSize);
            print("SteamHTTP.GetHTTPResponseHeaderValue(" + m_RequestHandle + ", \"User-Agent\", " + HeaderValueBuffer + ", " + ResponseHeaderSize + ") : " + ret + " -- " + System.Text.Encoding.UTF8.GetString(HeaderValueBuffer));
        }

        if (GUILayout.Button("GetHTTPResponseBodySize(m_RequestHandle, out BodySize)")) {
            uint BodySize;
            bool ret = SteamHTTP.GetHTTPResponseBodySize(m_RequestHandle, out BodySize);
            print("SteamHTTP.GetHTTPResponseBodySize(" + m_RequestHandle + ", out BodySize) : " + ret + " -- " + BodySize);
        }

        if (GUILayout.Button("GetHTTPResponseBodyData(m_RequestHandle, BodyDataBuffer, BodySize)")) {
            uint BodySize;
            SteamHTTP.GetHTTPResponseBodySize(m_RequestHandle, out BodySize);

            byte[] BodyDataBuffer = new byte[BodySize];
            bool ret = SteamHTTP.GetHTTPResponseBodyData(m_RequestHandle, BodyDataBuffer, BodySize);
            print("SteamHTTP.GetHTTPResponseBodyData(" + m_RequestHandle + ", " + BodyDataBuffer + ", " + BodySize + ") : " + ret + " -- " + System.Text.Encoding.UTF8.GetString(BodyDataBuffer));
        }

        if (GUILayout.Button("GetHTTPStreamingResponseBodyData(m_RequestHandle, m_Offset, BodyDataBuffer, m_BufferSize)")) {
            byte[] BodyDataBuffer = new byte[m_BufferSize];
            bool ret = SteamHTTP.GetHTTPStreamingResponseBodyData(m_RequestHandle, m_Offset, BodyDataBuffer, m_BufferSize);
            print("SteamHTTP.GetHTTPStreamingResponseBodyData(" + m_RequestHandle + ", " + m_Offset + ", " + BodyDataBuffer + ", " + m_BufferSize + ") : " + ret + " -- " + System.Text.Encoding.UTF8.GetString(BodyDataBuffer));
        }

        if (GUILayout.Button("ReleaseHTTPRequest(m_RequestHandle)")) {
            print("SteamHTTP.ReleaseHTTPRequest(m_RequestHandle) : " + SteamHTTP.ReleaseHTTPRequest(m_RequestHandle));
        }

        {
            float PercentOut;
            bool ret = SteamHTTP.GetHTTPDownloadProgressPct(m_RequestHandle, out PercentOut);
            GUILayout.Label("GetHTTPDownloadProgressPct(m_RequestHandle, out PercentOut) - " + ret + " -- " + PercentOut);
        }

        if (GUILayout.Button("SetHTTPRequestRawPostBody(m_RequestHandle, \"application/x-www-form-urlencoded\", buffer, (uint)buffer.Length)")) {
            string Body = "parameter=value&also=another";
            byte[] buffer = new byte[System.Text.Encoding.UTF8.GetByteCount(Body) + 1];
            System.Text.Encoding.UTF8.GetBytes(Body, 0, Body.Length, buffer, 0);
            bool ret = SteamHTTP.SetHTTPRequestRawPostBody(m_RequestHandle, "application/x-www-form-urlencoded", buffer, (uint)buffer.Length);
            print("SteamHTTP.SetHTTPRequestRawPostBody(" + m_RequestHandle + ", \"application/x-www-form-urlencoded\", " + buffer + ", " + (uint)buffer.Length + ") : " + ret);
        }

        if(GUILayout.Button("CreateCookieContainer(true)")) {
            m_CookieContainer = SteamHTTP.CreateCookieContainer(true);
            print("SteamHTTP.CreateCookieContainer(true) - " + m_CookieContainer);
        }

        if (GUILayout.Button("ReleaseCookieContainer(m_CookieContainer)")) {
            ReleaseCookieContainer();
        }

        if (GUILayout.Button("SetCookie(m_CookieContainer, \"http://httpbin.org\", \"http://httpbin.org/get\", \"TestCookie\")")) {
            bool ret = SteamHTTP.SetCookie(m_CookieContainer, "http://httpbin.org", "http://httpbin.org/get", "TestCookie");
            print("SteamHTTP.SetCookie(" + m_CookieContainer + ", \"http://httpbin.org\", \"http://httpbin.org\", \"TestCookie\") - " + ret);
        }

        if (GUILayout.Button("SetHTTPRequestCookieContainer(m_RequestHandle, m_CookieContainer)")) {
            bool ret = SteamHTTP.SetHTTPRequestCookieContainer(m_RequestHandle, m_CookieContainer);
            print("SteamHTTP.SetHTTPRequestCookieContainer(" + m_RequestHandle + ", " + m_CookieContainer + ") - " + ret);
        }

        if (GUILayout.Button("SetHTTPRequestUserAgentInfo(m_RequestHandle, \"TestUserAgentInfo\")")) {
            bool ret = SteamHTTP.SetHTTPRequestUserAgentInfo(m_RequestHandle, "TestUserAgentInfo");
            print("SteamHTTP.SetHTTPRequestUserAgentInfo(" + m_RequestHandle + ", \"TestUserAgentInfo\") - " + ret);
        }

        if (GUILayout.Button("SetHTTPRequestRequiresVerifiedCertificate(m_RequestHandle, false)")) {
            bool ret = SteamHTTP.SetHTTPRequestRequiresVerifiedCertificate(m_RequestHandle, false);
            print("SteamHTTP.SetHTTPRequestRequiresVerifiedCertificate(" + m_RequestHandle + ", false) - " + ret);
        }

        if (GUILayout.Button("SetHTTPRequestAbsoluteTimeoutMS(m_RequestHandle, 20000)")) {
            bool ret = SteamHTTP.SetHTTPRequestAbsoluteTimeoutMS(m_RequestHandle, 20000);
            print("SteamHTTP.SetHTTPRequestAbsoluteTimeoutMS(" + m_RequestHandle + ", 20000) - " + ret);
        }

        {
            bool WasTimedOut;
            bool ret = SteamHTTP.GetHTTPRequestWasTimedOut(m_RequestHandle, out WasTimedOut);
            GUILayout.Label("GetHTTPRequestWasTimedOut(m_RequestHandle, out WasTimedOut) - " + ret + " -- " + WasTimedOut);
        }
    }
		// 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.
		public static bool SetHTTPRequestRawPostBody(HTTPRequestHandle hRequest, string pchContentType, byte[] pubBody, uint unBodyLen) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamHTTP_SetHTTPRequestRawPostBody(hRequest, pchContentType, pubBody, unBodyLen);
		}
 /// <summary>
 /// <para> Gets the size of the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the</para>
 /// <para> handle is invalid.</para>
 /// </summary>
 public static bool GetHTTPResponseBodySize(HTTPRequestHandle hRequest, out uint unBodySize)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_GetHTTPResponseBodySize(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out unBodySize));
 }
		// 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.
		public static bool SetHTTPRequestGetOrPostParameter(HTTPRequestHandle hRequest, string pchParamName, string pchParamValue) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamHTTP_SetHTTPRequestGetOrPostParameter(hRequest, pchParamName, pchParamValue);
		}
 /// <summary>
 /// <para> Gets the body data from a streaming HTTP response given a handle from HTTPRequestDataReceived_t. Will return false if the</para>
 /// <para> handle is invalid or is to a non-streaming response (meaning it wasn't sent with SendHTTPRequestAndStreamResponse), or if the buffer size and offset</para>
 /// <para> do not match the size and offset sent in HTTPRequestDataReceived_t.</para>
 /// </summary>
 public static bool GetHTTPStreamingResponseBodyData(HTTPRequestHandle hRequest, uint cOffset, byte[] pBodyDataBuffer, uint unBufferSize)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_GetHTTPStreamingResponseBodyData(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, cOffset, pBodyDataBuffer, unBufferSize));
 }
		// 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.
		public static bool PrioritizeHTTPRequest(HTTPRequestHandle hRequest) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamHTTP_PrioritizeHTTPRequest(hRequest);
		}
 /// <summary>
 /// <para> Releases an HTTP response handle, should always be called to free resources after receiving a HTTPRequestCompleted_t</para>
 /// <para> callback and finishing using the response.</para>
 /// </summary>
 public static bool ReleaseHTTPRequest(HTTPRequestHandle hRequest)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_ReleaseHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest));
 }
		/// <summary>
		/// <para> Checks if a response header is present in a HTTP response given a handle from HTTPRequestCompleted_t, also</para>
		/// <para> returns the size of the header value if present so the caller and allocate a correctly sized buffer for</para>
		/// <para> GetHTTPResponseHeaderValue.</para>
		/// </summary>
		public static bool GetHTTPResponseHeaderSize(HTTPRequestHandle hRequest, string pchHeaderName, out uint unResponseHeaderSize) {
			InteropHelp.TestIfAvailableGameServer();
			using (var pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName)) {
				return NativeMethods.ISteamGameServerHTTP_GetHTTPResponseHeaderSize(hRequest, pchHeaderName2, out unResponseHeaderSize);
			}
		}
 /// <summary>
 /// <para> Gets progress on downloading the body for the request.  This will be zero unless a response header has already been</para>
 /// <para> received which included a content-length field.  For responses that contain no content-length it will report</para>
 /// <para> zero for the duration of the request as the size is unknown until the connection closes.</para>
 /// </summary>
 public static bool GetHTTPDownloadProgressPct(HTTPRequestHandle hRequest, out float pflPercentOut)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_GetHTTPDownloadProgressPct(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pflPercentOut));
 }
		/// <summary>
		/// <para> Gets the body data from a streaming HTTP response given a handle from HTTPRequestDataReceived_t. Will return false if the</para>
		/// <para> handle is invalid or is to a non-streaming response (meaning it wasn't sent with SendHTTPRequestAndStreamResponse), or if the buffer size and offset</para>
		/// <para> do not match the size and offset sent in HTTPRequestDataReceived_t.</para>
		/// </summary>
		public static bool GetHTTPStreamingResponseBodyData(HTTPRequestHandle hRequest, uint cOffset, byte[] pBodyDataBuffer, uint unBufferSize) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_GetHTTPStreamingResponseBodyData(hRequest, cOffset, pBodyDataBuffer, unBufferSize);
		}
 /// <summary>
 /// <para> Set the cookie container to use for a HTTP request</para>
 /// </summary>
 public static bool SetHTTPRequestCookieContainer(HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_SetHTTPRequestCookieContainer(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, hCookieContainer));
 }
		/// <summary>
		/// <para> Sets the body for an HTTP Post request.  Will fail and return false on a GET request, and will fail if POST params</para>
		/// <para> have already been set for the request.  Setting this raw body makes it the only contents for the post, the pchContentType</para>
		/// <para> parameter will set the content-type header for the request so the server may know how to interpret the body.</para>
		/// </summary>
		public static bool SetHTTPRequestRawPostBody(HTTPRequestHandle hRequest, string pchContentType, byte[] pubBody, uint unBodyLen) {
			InteropHelp.TestIfAvailableGameServer();
			using (var pchContentType2 = new InteropHelp.UTF8StringHandle(pchContentType)) {
				return NativeMethods.ISteamGameServerHTTP_SetHTTPRequestRawPostBody(hRequest, pchContentType2, pubBody, unBodyLen);
			}
		}
 /// <summary>
 /// <para> Disable or re-enable verification of SSL/TLS certificates.</para>
 /// <para> By default, certificates are checked for all HTTPS requests.</para>
 /// </summary>
 public static bool SetHTTPRequestRequiresVerifiedCertificate(HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, bRequireVerifiedCertificate));
 }
		/// <summary>
		/// <para> 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</para>
		/// </summary>
		public static bool SetHTTPRequestUserAgentInfo(HTTPRequestHandle hRequest, string pchUserAgentInfo) {
			InteropHelp.TestIfAvailableGameServer();
			using (var pchUserAgentInfo2 = new InteropHelp.UTF8StringHandle(pchUserAgentInfo)) {
				return NativeMethods.ISteamGameServerHTTP_SetHTTPRequestUserAgentInfo(hRequest, pchUserAgentInfo2);
			}
		}
 /// <summary>
 /// <para> Set an absolute timeout on the HTTP request, this is just a total time timeout different than the network activity timeout</para>
 /// <para> which can bump everytime we get more data</para>
 /// </summary>
 public static bool SetHTTPRequestAbsoluteTimeoutMS(HTTPRequestHandle hRequest, uint unMilliseconds)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, unMilliseconds));
 }
		/// <summary>
		/// <para> Set an absolute timeout on the HTTP request, this is just a total time timeout different than the network activity timeout</para>
		/// <para> which can bump everytime we get more data</para>
		/// </summary>
		public static bool SetHTTPRequestAbsoluteTimeoutMS(HTTPRequestHandle hRequest, uint unMilliseconds) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_SetHTTPRequestAbsoluteTimeoutMS(hRequest, unMilliseconds);
		}
 /// <summary>
 /// <para> Check if the reason the request failed was because we timed it out (rather than some harder failure)</para>
 /// </summary>
 public static bool GetHTTPRequestWasTimedOut(HTTPRequestHandle hRequest, out bool pbWasTimedOut)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_GetHTTPRequestWasTimedOut(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pbWasTimedOut));
 }
		/// <summary>
		/// <para> Set a context value for the request, which will be returned in the HTTPRequestCompleted_t callback after</para>
		/// <para> sending the request.  This is just so the caller can easily keep track of which callbacks go with which request data.</para>
		/// </summary>
		public static bool SetHTTPRequestContextValue(HTTPRequestHandle hRequest, ulong ulContextValue) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_SetHTTPRequestContextValue(hRequest, ulContextValue);
		}
 /// <summary>
 /// <para> Set a context value for the request, which will be returned in the HTTPRequestCompleted_t callback after</para>
 /// <para> sending the request.  This is just so the caller can easily keep track of which callbacks go with which request data.</para>
 /// </summary>
 public static bool SetHTTPRequestContextValue(HTTPRequestHandle hRequest, ulong ulContextValue)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_SetHTTPRequestContextValue(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, ulContextValue));
 }
 /// <summary>
 /// <para> Set a timeout in seconds for the HTTP request, must be called prior to sending the request.  Default</para>
 /// <para> timeout is 60 seconds if you don't call this.  Returns false if the handle is invalid, or the request</para>
 /// <para> has already been sent.</para>
 /// </summary>
 public static bool SetHTTPRequestNetworkActivityTimeout(HTTPRequestHandle hRequest, uint unTimeoutSeconds)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_SetHTTPRequestNetworkActivityTimeout(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, unTimeoutSeconds));
 }
 /// <summary>
 /// <para> Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on</para>
 /// <para> asynchronous response via callback for completion, and listen for HTTPRequestHeadersReceived_t and</para>
 /// <para> HTTPRequestDataReceived_t callbacks while streaming.</para>
 /// </summary>
 public static bool SendHTTPRequestAndStreamResponse(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_SendHTTPRequestAndStreamResponse(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pCallHandle));
 }
		/// <summary>
		/// <para> Defers a request you have sent, the actual HTTP client code may have many requests queued, and this will move</para>
		/// <para> the specified request to the tail of the queue.  Returns false on invalid handle, or if the request is not yet sent.</para>
		/// </summary>
		public static bool DeferHTTPRequest(HTTPRequestHandle hRequest) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_DeferHTTPRequest(hRequest);
		}
Exemple #60
0
 public static bool SetHTTPRequestRawPostBody(HTTPRequestHandle hRequest, string pchContentType, byte[] pubBody, uint unBodyLen)
 {
     InteropHelp.TestIfAvailableClient();
     using InteropHelp.UTF8StringHandle pchContentType2 = new InteropHelp.UTF8StringHandle(pchContentType);
     return(NativeMethods.ISteamHTTP_SetHTTPRequestRawPostBody(CSteamAPIContext.GetSteamHTTP(), hRequest, pchContentType2, pubBody, unBodyLen));
 }