示例#1
0
 private void DealRsp(HttpRsp rsp, ApolloResult rst)
 {
     if (rst == ApolloResult.Success)
     {
         ApolloHttpResponse apolloHttpResponse = new ApolloHttpResponse();
         string             httpVersion        = this.ByteArray2String(rsp.stResponseStatus.szHttpVersion);
         apolloHttpResponse.SetHttpVersion(httpVersion);
         string status = this.ByteArray2String(rsp.stResponseStatus.szStatusCode);
         apolloHttpResponse.SetStatus(status);
         string statusMessage = this.ByteArray2String(rsp.stResponseStatus.szReasonPhrase);
         apolloHttpResponse.SetStatusMessage(statusMessage);
         int num = 0;
         while ((long)num < (long)((ulong)rsp.stHttpHeaders.dwHeaderCount))
         {
             HeaderUnit headerUnit = rsp.stHttpHeaders.astHeaderUnit[num];
             string     name       = this.ByteArray2String(headerUnit.szHeaderName);
             string     value      = this.ByteArray2String(headerUnit.szHeaderContent);
             apolloHttpResponse.SetHeader(name, value);
             num++;
         }
         apolloHttpResponse.SetData(rsp.stResponseContent.szData, rsp.stResponseContent.dwDataLen);
         ADebug.Log("Get Result Response :" + apolloHttpResponse.ToString());
         this.responses.Add(apolloHttpResponse);
         if (this.ResponseEvent != null)
         {
             IApolloHttpResponse rsp2 = apolloHttpResponse;
             this.ResponseEvent(rsp2, rst);
         }
     }
     else if (rst == ApolloResult.Timeout)
     {
         this.gotTimeout = true;
     }
     else
     {
         ADebug.LogError("Got recv error :" + rst);
     }
 }
示例#2
0
 private void DealRsp(HttpRsp rsp, ApolloResult rst)
 {
     if (rst == ApolloResult.Success)
     {
         ApolloHttpResponse item    = new ApolloHttpResponse();
         string             version = this.ByteArray2String(rsp.stResponseStatus.szHttpVersion);
         item.SetHttpVersion(version);
         string status = this.ByteArray2String(rsp.stResponseStatus.szStatusCode);
         item.SetStatus(status);
         string msg = this.ByteArray2String(rsp.stResponseStatus.szReasonPhrase);
         item.SetStatusMessage(msg);
         for (int i = 0; i < rsp.stHttpHeaders.dwHeaderCount; i++)
         {
             HeaderUnit unit = rsp.stHttpHeaders.astHeaderUnit[i];
             string     name = this.ByteArray2String(unit.szHeaderName);
             string     str5 = this.ByteArray2String(unit.szHeaderContent);
             item.SetHeader(name, str5);
         }
         item.SetData(rsp.stResponseContent.szData, rsp.stResponseContent.dwDataLen);
         ADebug.Log("Get Result Response :" + item.ToString());
         this.responses.Add(item);
         if (this.ResponseEvent != null)
         {
             IApolloHttpResponse response2 = item;
             this.ResponseEvent(response2, rst);
         }
     }
     else if (rst == ApolloResult.Timeout)
     {
         this.gotTimeout = true;
     }
     else
     {
         ADebug.LogError("Got recv error :" + rst);
     }
 }