示例#1
0
 void ReleaseCookieContainer()
 {
     if (m_CookieContainer != HTTPCookieContainerHandle.Invalid) {
         print("SteamHTTP.ReleaseCookieContainer(" + m_CookieContainer + ") - " + SteamHTTP.ReleaseCookieContainer(m_CookieContainer));
         m_CookieContainer = HTTPCookieContainerHandle.Invalid;
     }
 }
示例#2
0
 public static bool SetCookie(HTTPCookieContainerHandle hCookieContainer, string pchHost, string pchUrl, string pchCookie)
 {
     InteropHelp.TestIfAvailableGameServer();
     using InteropHelp.UTF8StringHandle pchHost2   = new InteropHelp.UTF8StringHandle(pchHost);
     using InteropHelp.UTF8StringHandle pchUrl2    = new InteropHelp.UTF8StringHandle(pchUrl);
     using InteropHelp.UTF8StringHandle pchCookie2 = new InteropHelp.UTF8StringHandle(pchCookie);
     return(NativeMethods.ISteamHTTP_SetCookie(CSteamGameServerAPIContext.GetSteamHTTP(), hCookieContainer, pchHost2, pchUrl2, pchCookie2));
 }
	public void OnEnable() {
		m_HTTPRequestHeadersReceived = Callback<HTTPRequestHeadersReceived_t>.Create(OnHTTPRequestHeadersReceived);
		m_HTTPRequestDataReceived = Callback<HTTPRequestDataReceived_t>.Create(OnHTTPRequestDataReceived);

		OnHTTPRequestCompletedCallResult = CallResult<HTTPRequestCompleted_t>.Create(OnHTTPRequestCompleted);

		m_CookieContainer = HTTPCookieContainerHandle.Invalid;
	}
示例#4
0
 /// <summary>
 /// <para> Adds a cookie to the specified cookie container that will be used with future requests.</para>
 /// </summary>
 public static bool SetCookie(HTTPCookieContainerHandle hCookieContainer, string Host, string Url, string Cookie)
 {
     InteropHelp.TestIfAvailableGameServer();
     using (var Host2 = new InteropHelp.UTF8StringHandle(Host))
         using (var Url2 = new InteropHelp.UTF8StringHandle(Url))
             using (var Cookie2 = new InteropHelp.UTF8StringHandle(Cookie)) {
                 return(NativeMethods.ISteamGameServerHTTP_SetCookie(hCookieContainer, Host2, Url2, Cookie2));
             }
 }
示例#5
0
 /// <summary>
 /// <para> Adds a cookie to the specified cookie container that will be used with future requests.</para>
 /// </summary>
 public static bool SetCookie(HTTPCookieContainerHandle hCookieContainer, string pchHost, string pchUrl, string pchCookie)
 {
     InteropHelp.TestIfAvailableClient();
     using (var pchHost2 = new InteropHelp.UTF8StringHandle(pchHost))
         using (var pchUrl2 = new InteropHelp.UTF8StringHandle(pchUrl))
             using (var pchCookie2 = new InteropHelp.UTF8StringHandle(pchCookie)) {
                 return(NativeMethods.ISteamHTTP_SetCookie(hCookieContainer, pchHost2, pchUrl2, pchCookie2));
             }
 }
示例#6
0
    public void OnEnable()
    {
        m_HTTPRequestHeadersReceived = Callback<HTTPRequestHeadersReceived_t>.Create(OnHTTPRequestHeadersReceived);
        m_HTTPRequestDataReceived = Callback<HTTPRequestDataReceived_t>.Create(OnHTTPRequestDataReceived);

        OnHTTPRequestCompletedCallResult = CallResult<HTTPRequestCompleted_t>.Create(OnHTTPRequestCompleted);

        m_CookieContainer = HTTPCookieContainerHandle.Invalid;
    }
示例#7
0
		public static extern bool ISteamGameServerHTTP_ReleaseCookieContainer(HTTPCookieContainerHandle hCookieContainer);
		/// <summary>
		/// <para> Adds a cookie to the specified cookie container that will be used with future requests.</para>
		/// </summary>
		public static bool SetCookie(HTTPCookieContainerHandle hCookieContainer, string pchHost, string pchUrl, string pchCookie) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_SetCookie(hCookieContainer, pchHost, pchUrl, pchCookie);
		}
	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);
		}
	}
示例#10
0
 private static extern bool _SetHTTPRequestCookieContainer(IntPtr self, HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer);
		/// <summary>
		/// <para> Adds a cookie to the specified cookie container that will be used with future requests.</para>
		/// </summary>
		public static bool SetCookie(HTTPCookieContainerHandle hCookieContainer, string pchHost, string pchUrl, string pchCookie) {
			InteropHelp.TestIfAvailableGameServer();
			using (var pchHost2 = new InteropHelp.UTF8StringHandle(pchHost))
			using (var pchUrl2 = new InteropHelp.UTF8StringHandle(pchUrl))
			using (var pchCookie2 = new InteropHelp.UTF8StringHandle(pchCookie)) {
				return NativeMethods.ISteamGameServerHTTP_SetCookie(hCookieContainer, pchHost2, pchUrl2, pchCookie2);
			}
		}
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, 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();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

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

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

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

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

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

        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)"))
        {
            bool ret = SteamHTTP.DeferHTTPRequest(m_RequestHandle);
            print("SteamHTTP.DeferHTTPRequest(" + m_RequestHandle + ") : " + ret);
        }

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

        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);
            print("HeaderValueBuffer:\n" + 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);
            print("BodyDataBuffer:\n" + 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);
            print("BodyDataBuffer:\n" + System.Text.Encoding.UTF8.GetString(BodyDataBuffer));
        }

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

        {
            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/cookies\", \"TestCookie=Testing\")"))
        {
            bool ret = SteamHTTP.SetCookie(m_CookieContainer, "http://httpbin.org", "http://httpbin.org/cookies", "TestCookie=Testing");
            print("SteamHTTP.SetCookie(" + m_CookieContainer + ", " + "\"http://httpbin.org\"" + ", " + "\"http://httpbin.org/cookies\"" + ", " + "\"TestCookie=Testing\"" + ") : " + 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);
        }

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
示例#13
0
 public static bool SetCookie(HTTPCookieContainerHandle hCookieContainer, string pchHost, string pchUrl, string pchCookie)
 {
     InteropHelp.TestIfAvailableGameServer();
     bool result;
     using (InteropHelp.UTF8StringHandle uTF8StringHandle = new InteropHelp.UTF8StringHandle(pchHost))
     {
         using (InteropHelp.UTF8StringHandle uTF8StringHandle2 = new InteropHelp.UTF8StringHandle(pchUrl))
         {
             using (InteropHelp.UTF8StringHandle uTF8StringHandle3 = new InteropHelp.UTF8StringHandle(pchCookie))
             {
                 result = NativeMethods.ISteamGameServerHTTP_SetCookie(hCookieContainer, uTF8StringHandle, uTF8StringHandle2, uTF8StringHandle3);
             }
         }
     }
     return result;
 }
示例#14
0
 private static extern bool _SetCookie(IntPtr self, HTTPCookieContainerHandle hCookieContainer, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string pchHost, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string pchUrl, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string pchCookie);
示例#15
0
 /// <summary>
 /// <para> Set the cookie container to use for a HTTP request</para>
 /// </summary>
 public static bool SetHTTPRequestCookieContainer(HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_SetHTTPRequestCookieContainer(CSteamAPIContext.GetSteamHTTP(), hRequest, hCookieContainer));
 }
示例#16
0
 /// <summary>
 /// <para> Release a cookie container you are finished using, freeing it's memory</para>
 /// </summary>
 public static bool ReleaseCookieContainer(HTTPCookieContainerHandle hCookieContainer)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamHTTP_ReleaseCookieContainer(CSteamAPIContext.GetSteamHTTP(), hCookieContainer));
 }
示例#17
0
        internal bool SetHTTPRequestCookieContainer(HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer)
        {
            var returnValue = _SetHTTPRequestCookieContainer(Self, hRequest, hCookieContainer);

            return(returnValue);
        }
示例#18
0
		public static extern bool ISteamGameServerHTTP_SetCookie(HTTPCookieContainerHandle hCookieContainer, InteropHelp.UTF8StringHandle pchHost, InteropHelp.UTF8StringHandle pchUrl, InteropHelp.UTF8StringHandle pchCookie);
示例#19
0
 /// <summary>
 /// <para> Release a cookie container you are finished using, freeing it's memory</para>
 /// </summary>
 public static bool ReleaseCookieContainer(HTTPCookieContainerHandle hCookieContainer)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamGameServerHTTP_ReleaseCookieContainer(hCookieContainer));
 }
示例#20
0
		public static extern bool ISteamGameServerHTTP_SetHTTPRequestCookieContainer(HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer);
示例#21
0
        internal bool ReleaseCookieContainer(HTTPCookieContainerHandle hCookieContainer)
        {
            var returnValue = _ReleaseCookieContainer(Self, hCookieContainer);

            return(returnValue);
        }
		/// <summary>
		/// <para> Release a cookie container you are finished using, freeing it's memory</para>
		/// </summary>
		public static bool ReleaseCookieContainer(HTTPCookieContainerHandle hCookieContainer) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_ReleaseCookieContainer(hCookieContainer);
		}
	void ReleaseCookieContainer() {
		if (m_CookieContainer != HTTPCookieContainerHandle.Invalid) {
			print("SteamHTTP.ReleaseCookieContainer(" + m_CookieContainer + ") - " + SteamHTTP.ReleaseCookieContainer(m_CookieContainer));
			m_CookieContainer = HTTPCookieContainerHandle.Invalid;
		}
	}
		/// <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);
		}
示例#25
0
        internal bool SetCookie(HTTPCookieContainerHandle hCookieContainer, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string pchHost, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string pchUrl, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string pchCookie)
        {
            var returnValue = _SetCookie(Self, hCookieContainer, pchHost, pchUrl, pchCookie);

            return(returnValue);
        }
示例#26
0
 /// <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));
 }
示例#27
0
 private static extern bool _ReleaseCookieContainer(IntPtr self, HTTPCookieContainerHandle hCookieContainer);