/// <summary>
 /// <para> Initializes a new HTTP request, returning a handle to use in further operations on it.  Requires</para>
 /// <para> the method (GET or POST) and the absolute URL for the request.  Both http and https are supported,</para>
 /// <para> so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/</para>
 /// <para> or such.</para>
 /// </summary>
 public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL)
 {
     InteropHelp.TestIfAvailableClient();
     using (var pchAbsoluteURL2 = new InteropHelp.UTF8StringHandle(pchAbsoluteURL)) {
         return((HTTPRequestHandle)NativeMethods.ISteamHTTP_CreateHTTPRequest(eHTTPRequestMethod, pchAbsoluteURL2));
     }
 }
 /// <summary>
 /// <para> Initializes a new HTTP request, returning a handle to use in further operations on it.  Requires</para>
 /// <para> the method (GET or POST) and the absolute URL for the request.  Both http and https are supported,</para>
 /// <para> so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/</para>
 /// <para> or such.</para>
 /// </summary>
 public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL)
 {
     InteropHelp.TestIfAvailableGameServer();
     using (var pchAbsoluteURL2 = new InteropHelp.UTF8StringHandle(pchAbsoluteURL)) {
         return((HTTPRequestHandle)NativeMethods.ISteamHTTP_CreateHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), eHTTPRequestMethod, pchAbsoluteURL2));
     }
 }
Esempio n. 3
0
 public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL)
 {
     InteropHelp.TestIfAvailableGameServer();
     using (InteropHelp.UTF8StringHandle handle = new InteropHelp.UTF8StringHandle(pchAbsoluteURL))
     {
         return((HTTPRequestHandle)NativeMethods.ISteamGameServerHTTP_CreateHTTPRequest(eHTTPRequestMethod, handle));
     }
 }
Esempio n. 4
0
 public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL)
 {
     InteropHelp.TestIfAvailableGameServer();
     HTTPRequestHandle result;
     using (InteropHelp.UTF8StringHandle uTF8StringHandle = new InteropHelp.UTF8StringHandle(pchAbsoluteURL))
     {
         result = (HTTPRequestHandle)NativeMethods.ISteamGameServerHTTP_CreateHTTPRequest(eHTTPRequestMethod, uTF8StringHandle);
     }
     return result;
 }
Esempio n. 5
0
        public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL)
        {
            InteropHelp.TestIfAvailableClient();
            HTTPRequestHandle result;

            using (InteropHelp.UTF8StringHandle utf8StringHandle = new InteropHelp.UTF8StringHandle(pchAbsoluteURL))
            {
                result = (HTTPRequestHandle)NativeMethods.ISteamHTTP_CreateHTTPRequest(eHTTPRequestMethod, utf8StringHandle);
            }
            return(result);
        }
Esempio n. 6
0
        // Token: 0x0600062B RID: 1579 RVA: 0x0000CB80 File Offset: 0x0000AD80
        public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL)
        {
            InteropHelp.TestIfAvailableGameServer();
            HTTPRequestHandle result;

            using (InteropHelp.UTF8StringHandle utf8StringHandle = new InteropHelp.UTF8StringHandle(pchAbsoluteURL))
            {
                result = (HTTPRequestHandle)NativeMethods.ISteamHTTP_CreateHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), eHTTPRequestMethod, utf8StringHandle);
            }
            return(result);
        }
		/// <summary>
		/// <para> Initializes a new HTTP request, returning a handle to use in further operations on it.  Requires</para>
		/// <para> the method (GET or POST) and the absolute URL for the request.  Both http and https are supported,</para>
		/// <para> so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/</para>
		/// <para> or such.</para>
		/// </summary>
		public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL) {
			InteropHelp.TestIfAvailableGameServer();
			using (var pchAbsoluteURL2 = new InteropHelp.UTF8StringHandle(pchAbsoluteURL)) {
				return (HTTPRequestHandle)NativeMethods.ISteamGameServerHTTP_CreateHTTPRequest(eHTTPRequestMethod, pchAbsoluteURL2);
			}
		}
Esempio n. 8
0
 /// <summary>
 /// <para> Initializes a new HTTP request, returning a handle to use in further operations on it.  Requires</para>
 /// <para> the method (GET or POST) and the absolute URL for the request.  Only http requests (ie, not https) are</para>
 /// <para> currently supported, so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/</para>
 /// <para> or such.</para>
 /// </summary>
 public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL)
 {
     InteropHelp.TestIfAvailableClient();
     return((HTTPRequestHandle)NativeMethods.ISteamHTTP_CreateHTTPRequest(eHTTPRequestMethod, pchAbsoluteURL));
 }
Esempio n. 9
0
		// 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.  Only http requests (ie, not https) are
		// currently supported, so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/
		// or such.
		public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL) {
			InteropHelp.TestIfAvailableClient();
			return (HTTPRequestHandle)NativeMethods.ISteamHTTP_CreateHTTPRequest(eHTTPRequestMethod, pchAbsoluteURL);
		}
Esempio n. 10
0
		public static extern uint ISteamHTTP_CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, InteropHelp.UTF8StringHandle pchAbsoluteURL);
Esempio n. 11
0
        public HTTPHeaderData(string headerString)
        {
            InvalidHeader = true;

            int doubleCRLFIndex = headerString.IndexOf("\r\n\r\n");
            if (doubleCRLFIndex >= 0)
                headerString = headerString.Substring(0, doubleCRLFIndex);

            string[] headerRows = headerString.Split(new string[] { "\r\n" }, StringSplitOptions.None);

            if (headerRows[0].EndsWith("HTTP/1.1"))
                HTTPVersion = EHTTPVersion.HTTP11;
            else if (headerRows[0].EndsWith("HTTP/1.0"))
                HTTPVersion = EHTTPVersion.HTTP11;
            else
                HTTPVersion = EHTTPVersion.HTTP09;

            int spaceIndex = headerRows[0].IndexOf(' ');

            if (spaceIndex < 3 || spaceIndex > 7)
                return;

            string method = headerRows[0].Substring(0, spaceIndex);
            switch(method)
            {
                case "GET": HTTPMethod = EHTTPMethod.GET; break;
                case "POST": HTTPMethod = EHTTPMethod.POST; break;
                case "PUT": HTTPMethod = EHTTPMethod.PUT; break;
                case "DELETE": HTTPMethod = EHTTPMethod.DELETE; break;

                case "HEAD": HTTPMethod = EHTTPMethod.HEAD; break;
                case "OPTIONS": HTTPMethod = EHTTPMethod.OPTIONS; break;
                case "CONNECT": HTTPMethod = EHTTPMethod.CONNECT; break;
                default: return; //Invalid
            }

            requestedResource = headerRows[0].Substring(headerRows[0].IndexOf(' ') + 1);
            requestedResource = requestedResource.Substring(0, requestedResource.IndexOfAny(new char[] { ' ', '\r' }));

            for (int i = 1; i < headerRows.Length; i++)
            {
                if (headerRows[i] == "")
                    break;

                string field = headerRows[i].Substring(0, headerRows[i].IndexOf(':'));
                string value = headerRows[i].Substring(headerRows[i].IndexOf(':') + 1).TrimStart(null);

                //Check for a malformed field

                headerData.Add(field, value);
            }

            InvalidHeader = false;
        }
Esempio n. 12
0
 /// 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.
 public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL)
 {
     return((HTTPRequestHandle)0);
 }
Esempio n. 13
0
        public HTTPHeaderData(string headerString)
        {
            InvalidHeader = true;

            int doubleCRLFIndex = headerString.IndexOf("\r\n\r\n");

            if (doubleCRLFIndex >= 0)
            {
                headerString = headerString.Substring(0, doubleCRLFIndex);
            }

            string[] headerRows = headerString.Split(new string[] { "\r\n" }, StringSplitOptions.None);

            if (headerRows[0].EndsWith("HTTP/1.1"))
            {
                HTTPVersion = EHTTPVersion.HTTP11;
            }
            else if (headerRows[0].EndsWith("HTTP/1.0"))
            {
                HTTPVersion = EHTTPVersion.HTTP11;
            }
            else
            {
                HTTPVersion = EHTTPVersion.HTTP09;
            }

            int spaceIndex = headerRows[0].IndexOf(' ');

            if (spaceIndex < 3 || spaceIndex > 7)
            {
                return;
            }

            string method = headerRows[0].Substring(0, spaceIndex);

            switch (method)
            {
            case "GET": HTTPMethod = EHTTPMethod.GET; break;

            case "POST": HTTPMethod = EHTTPMethod.POST; break;

            case "PUT": HTTPMethod = EHTTPMethod.PUT; break;

            case "DELETE": HTTPMethod = EHTTPMethod.DELETE; break;

            case "HEAD": HTTPMethod = EHTTPMethod.HEAD; break;

            case "OPTIONS": HTTPMethod = EHTTPMethod.OPTIONS; break;

            case "CONNECT": HTTPMethod = EHTTPMethod.CONNECT; break;

            default: return;     //Invalid
            }

            requestedResource = headerRows[0].Substring(headerRows[0].IndexOf(' ') + 1);
            requestedResource = requestedResource.Substring(0, requestedResource.IndexOfAny(new char[] { ' ', '\r' }));

            for (int i = 1; i < headerRows.Length; i++)
            {
                if (headerRows[i] == "")
                {
                    break;
                }

                string field = headerRows[i].Substring(0, headerRows[i].IndexOf(':'));
                string value = headerRows[i].Substring(headerRows[i].IndexOf(':') + 1).TrimStart(null);

                //Check for a malformed field

                headerData.Add(field, value);
            }

            InvalidHeader = false;
        }
Esempio n. 14
0
 // Methods
 public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL) => default;                   // 0x00000001809542C0-0x0000000180954420
Esempio n. 15
0
        private string GetHttpRequest(string strData, EHTTPMethod eMethod)
        {
            string strBodyRequest = string.Empty;
            string strResponse    = "";

            try
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // .NET 4.5
                HttpWebRequest oRequest = (HttpWebRequest)WebRequest.Create(m_strURL);

                switch (eMethod)
                {
                case EHTTPMethod.POST:
                    oRequest.Method      = "POST";
                    oRequest.Accept      = "application/json-rpc";
                    oRequest.ContentType = "application/json-rpc; charset=UTF-8";
                    strBodyRequest       = strData;
                    break;

                case EHTTPMethod.GET:
                    oRequest.Method = "GET";
                    oRequest.Headers.Add(string.Format("GET:{0} HTTP/1.1", strData));
                    oRequest.Accept = "*/*";
                    strBodyRequest  = strData;
                    break;

                case EHTTPMethod.PUT:
                    string strBoundary = DateTime.Now.Ticks.ToString().Substring(0, 10);
                    oRequest.Headers.Add(string.Format("POST:{0}{1} HTTP/1.1", m_oJsonRpc.Api, "upload/"));
                    oRequest.Method      = "POST";
                    oRequest.Accept      = "*/*";
                    oRequest.ContentType = string.Format("multipart/form-data; boundary=%s", strBoundary);
                    strBodyRequest       = string.Format("--{0}{1}", strBoundary, CJson.CRLF);
                    strBodyRequest      += string.Format("Content-Disposition: form-data; name=\"unknown\"; filename=\"newFile.bin\"{0}", CJson.CRLF);
                    strBodyRequest      += string.Format("{0}", CJson.CRLF);
                    strBodyRequest      += string.Format("{0}{1}", strData, CJson.CRLF);
                    strBodyRequest      += string.Format("--{0}--{1}", strBoundary, CJson.CRLF);
                    break;

                default:
                    throw new Exception("Method not found : supported : GET/POST/PUT");
                }

                if (eMethod != EHTTPMethod.GET)
                {
                    // Setting DATA
                    StringBuilder oStringBuilder = new StringBuilder().Append(strBodyRequest);
                    byte[]        aData          = Encoding.UTF8.GetBytes(oStringBuilder.ToString());

                    oRequest.Headers.Add(string.Format("ContentLength: {0}", aData.Length));

                    using (System.IO.Stream oStream = oRequest.GetRequestStream())
                    {
                        oStream.Write(aData, 0, aData.Length);
                    }
                }

                // Execute request
                using (HttpWebResponse oResponseWeb = (HttpWebResponse)(oRequest.GetResponse()))
                {
                    if (oResponseWeb.StatusCode != HttpStatusCode.OK)
                    {
                        throw new Exception(string.Format("Error request response : {0} - {1}", oResponseWeb.StatusCode, oResponseWeb.StatusDescription));
                    }
                    // Read response
                    using (StreamReader oStream = new StreamReader(oResponseWeb.GetResponseStream()))
                    {
                        strResponse = oStream.ReadToEnd();
                        oStream.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }

            return(strResponse);
        }
Esempio n. 16
0
 public UInt32 CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, StringBuilder pchAbsoluteURL)
 {
     return(this.GetFunction <NativeCreateHTTPRequestES>(this.Functions.CreateHTTPRequest0)(this.ObjectAddress, eHTTPRequestMethod, pchAbsoluteURL));
 }
 // Token: 0x060007E1 RID: 2017 RVA: 0x00004C58 File Offset: 0x00002E58
 public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamGameServerHTTP_CreateHTTPRequest(eHTTPRequestMethod, pchAbsoluteURL));
 }