void OnDownloaded(HTTPRequest req, HTTPResponse resp)
        {
            Debug.Log ("OnDownloaded");
            NetworkMsgType error = NetworkMsgType.network;
            string message = "未知错误";
            if (resp != null) {

                if (resp.IsSuccess) {
                    byte[] data = resp.Data;
                    protoBuffer.SetResMsg (data, data.Length);
                    error = NetworkMsgType.protocol;
                    message = "请求成功";
                } else {
                    if (resp.StatusCode == 500 ||
                        resp.StatusCode == 501 ||
                        resp.StatusCode == 503 ||
                        resp.StatusCode == 403) {
                        message = resp.DataAsText;
                        error = NetworkMsgType.server;
                    }
                }
            }
            //			return;
            onFinish (error, message, protoBuffer);
        }
示例#2
0
    static int _CreateBestHTTP_HTTPResponse(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 4)
            {
                BestHTTP.HTTPRequest arg0 = (BestHTTP.HTTPRequest)ToLua.CheckObject(L, 1, typeof(BestHTTP.HTTPRequest));
                System.IO.Stream     arg1 = (System.IO.Stream)ToLua.CheckObject <System.IO.Stream>(L, 2);
                bool arg2 = LuaDLL.luaL_checkboolean(L, 3);
                bool arg3 = LuaDLL.luaL_checkboolean(L, 4);
                BestHTTP.HTTPResponse obj = new BestHTTP.HTTPResponse(arg0, arg1, arg2, arg3);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: BestHTTP.HTTPResponse.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
        void OnSendRequestFinished(HTTPRequest req, HTTPResponse resp)
        {
            sendRequestQueue.Remove(req);

            // error reason if there is any. We will call the manager's Error function if it's not empty.
            string reason = string.Empty;

            switch (req.State)
            {
                // The request finished without any problem.
                case HTTPRequestStates.Finished:
                    if (resp.IsSuccess)
                    {
                        HTTPManager.Logger.Information("Transport - " + this.Name, "Send - Request Finished Successfully! " + resp.DataAsText);

                        if (!string.IsNullOrEmpty(resp.DataAsText))
                        {
                            IServerMessage msg = TransportBase.Parse(Connection.JsonEncoder, resp.DataAsText);

                            if (msg != null)
                                Connection.OnMessage(msg);
                        }
                    }
                    else
                        reason = string.Format("Send - Request Finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2}",
                                                                                                    resp.StatusCode,
                                                                                                    resp.Message,
                                                                                                    resp.DataAsText);
                    break;

                // The request finished with an unexpected error. The request's Exception property may contain more info about the error.
                case HTTPRequestStates.Error:
                    reason = "Send - Request Finished with Error! " + (req.Exception != null ? (req.Exception.Message + "\n" + req.Exception.StackTrace) : "No Exception");
                    break;

                // The request aborted, initiated by the user.
                case HTTPRequestStates.Aborted:
                    reason = "Send - Request Aborted!";
                    break;

                // Ceonnecting to the server is timed out.
                case HTTPRequestStates.ConnectionTimedOut:
                    reason = "Send - Connection Timed Out!";
                    break;

                // The request didn't finished in the given time.
                case HTTPRequestStates.TimedOut:
                    reason = "Send - Processing the request Timed Out!";
                    break;
            }

            if (!string.IsNullOrEmpty(reason))
                Connection.Error(reason);
        }
 static int QPYX_Dispose_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         BestHTTP.HTTPResponse QPYX_obj_YXQP = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L_YXQP, 1);
         QPYX_obj_YXQP.Dispose();
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int QPYX_GetStreamedFragments_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         BestHTTP.HTTPResponse QPYX_obj_YXQP = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L_YXQP, 1);
         System.Collections.Generic.List <byte[]> QPYX_o_YXQP = QPYX_obj_YXQP.GetStreamedFragments();
         ToLua.PushSealed(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int QPYX_GetRange_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         BestHTTP.HTTPResponse QPYX_obj_YXQP = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L_YXQP, 1);
         BestHTTP.HTTPRange    QPYX_o_YXQP   = QPYX_obj_YXQP.GetRange();
         ToLua.PushSealed(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
    /// <summary>
    /// Called when the response downloaded, or if an error occured.
    /// </summary>
    /// <param name="request">The original request that automatically generated in the SendRequest call.</param>
    /// <param name="response">The response object that holds everything the server sent to us. Or null, if an error occured.</param>
    private void OnImageDownloaded(BestHTTP.HTTPRequest request, BestHTTP.HTTPResponse response)
    {
        if (response != null)
        {
            Debug.Log("Download finished!");

            // Set the texture to the newly downloaded one
            this.GetComponent <GUITexture>().texture = response.DataAsTexture2D;
        }
        else
        {
            Debug.LogError("No response received: " + (request.Exception != null ? (request.Exception.Message + "\n" + request.Exception.StackTrace) : "No Exception"));
        }
    }
示例#8
0
    static int Receive(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L, 1);
                bool o = obj.Receive();
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 2)
            {
                BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L, 1);
                int  arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                bool o    = obj.Receive(arg0);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 3)
            {
                BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L, 1);
                int  arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
                bool o    = obj.Receive(arg0, arg1);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 4)
            {
                BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L, 1);
                int  arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
                bool arg2 = LuaDLL.luaL_checkboolean(L, 4);
                bool o    = obj.Receive(arg0, arg1, arg2);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: BestHTTP.HTTPResponse.Receive"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static int Dispose(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L, 1);
         obj.Dispose();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int QPYX_GetHeaderValues_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 2);
         BestHTTP.HTTPResponse QPYX_obj_YXQP = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L_YXQP, 1);
         string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 2);
         System.Collections.Generic.List <string> QPYX_o_YXQP = QPYX_obj_YXQP.GetHeaderValues(QPYX_arg0_YXQP);
         ToLua.PushSealed(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
示例#11
0
    static int QPYX_get_httpRsp_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        BestHttpOperation QPYX_obj_YXQP = (BestHttpOperation)QPYX_o_YXQP;
            BestHTTP.HTTPResponse QPYX_ret_YXQP = QPYX_obj_YXQP.httpRsp;
            ToLua.PushObject(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index httpRsp on a nil value"));
        }
    }
 static int GetRange(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L, 1);
         BestHTTP.HTTPRange    o   = obj.GetRange();
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int GetStreamedFragments(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L, 1);
         System.Collections.Generic.List <byte[]> o = obj.GetStreamedFragments();
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int QPYX_HasHeader_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 2);
         BestHTTP.HTTPResponse QPYX_obj_YXQP = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L_YXQP, 1);
         string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 2);
         bool   QPYX_o_YXQP    = QPYX_obj_YXQP.HasHeader(QPYX_arg0_YXQP);
         LuaDLL.lua_pushboolean(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int HasHeader(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L, 1);
         string arg0 = ToLua.CheckString(L, 2);
         bool   o    = obj.HasHeader(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#16
0
 static int AddHeader(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L, 1);
         string arg0 = ToLua.CheckString(L, 2);
         string arg1 = ToLua.CheckString(L, 3);
         obj.AddHeader(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int GetHeaderValues(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)ToLua.CheckObject <BestHTTP.HTTPResponse>(L, 1);
         string arg0 = ToLua.CheckString(L, 2);
         System.Collections.Generic.List <string> o = obj.GetHeaderValues(arg0);
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int get_DataAsTexture2D(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)o;
            UnityEngine.Texture2D ret = obj.DataAsTexture2D;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index DataAsTexture2D on a nil value"));
        }
    }
    static int get_httpRsp(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BestHttpOperation     obj = (BestHttpOperation)o;
            BestHTTP.HTTPResponse ret = obj.httpRsp;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index httpRsp on a nil value"));
        }
    }
    static int get_Headers(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)o;
            System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <string> > ret = obj.Headers;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Headers on a nil value"));
        }
    }
    static int get_DataAsText(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)o;
            string ret = obj.DataAsText;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index DataAsText on a nil value"));
        }
    }
    static int get_Data(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)o;
            byte[] ret = obj.Data;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Data on a nil value"));
        }
    }
示例#23
0
    static int get_Cookies(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)o;
            System.Collections.Generic.List <BestHTTP.Cookies.Cookie> ret = obj.Cookies;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Cookies on a nil value"));
        }
    }
    static int get_StatusCode(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)o;
            int ret = obj.StatusCode;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index StatusCode on a nil value"));
        }
    }
    static int get_IsClosedManually(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)o;
            bool ret = obj.IsClosedManually;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index IsClosedManually on a nil value"));
        }
    }
示例#26
0
    static int get_CacheFileInfo(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BestHTTP.HTTPResponse obj = (BestHTTP.HTTPResponse)o;
            BestHTTP.Caching.HTTPCacheFileInfo ret = obj.CacheFileInfo;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index CacheFileInfo on a nil value"));
        }
    }
示例#27
0
        void OnComplete(HTTPRequest request, HTTPResponse response)
        {
            _texture = _request.Response.DataAsTexture2D;
            _error = (_request.State == HTTPRequestStates.Error)
                ? "Request Finished with Error! " +
                    (_request.Exception != null ?
                    (_request.Exception.Message + "\n" + _request.Exception.StackTrace) :
               "No Exception")
               : null;

            _progress = 1;
            _isCompleted = true;
            _complete.Dispatch(this);
        }
    static int QPYX_get_DataAsText_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        BestHTTP.HTTPResponse QPYX_obj_YXQP = (BestHTTP.HTTPResponse)QPYX_o_YXQP;
            string QPYX_ret_YXQP = QPYX_obj_YXQP.DataAsText;
            LuaDLL.lua_pushstring(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index DataAsText on a nil value"));
        }
    }
    static int QPYX_get_StatusCode_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        BestHTTP.HTTPResponse QPYX_obj_YXQP = (BestHTTP.HTTPResponse)QPYX_o_YXQP;
            int QPYX_ret_YXQP = QPYX_obj_YXQP.StatusCode;
            LuaDLL.lua_pushinteger(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index StatusCode on a nil value"));
        }
    }
    static int QPYX_get_Headers_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        BestHTTP.HTTPResponse     QPYX_obj_YXQP = (BestHTTP.HTTPResponse)QPYX_o_YXQP;
            System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <string> > QPYX_ret_YXQP = QPYX_obj_YXQP.Headers;
            ToLua.PushSealed(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index Headers on a nil value"));
        }
    }
        void OnPollRequestFinished(HTTPRequest req, HTTPResponse resp)
        {
            // When Stop() called on the transport.
            // In Stop() we set the pollRequest to null, but a new poll request can be made after a quick reconnection, and there is a chanse that 
            // in this handler function we can null out the new request. So we return early here.
            if (req.State == HTTPRequestStates.Aborted)
            {
                HTTPManager.Logger.Warning("Transport - " + this.Name, "Poll - Request Aborted!");
                return;
            }

            // Set the pollRequest to null, now we can send out a new one
            pollRequest = null;

            // error reason if there is any. We will call the manager's Error function if it's not empty.
            string reason = string.Empty;

            switch (req.State)
            {
                // The request finished without any problem.
                case HTTPRequestStates.Finished:
                    if (resp.IsSuccess)
                    {
                        HTTPManager.Logger.Information("Transport - " + this.Name, "Poll - Request Finished Successfully! " + resp.DataAsText);

                        IServerMessage msg = TransportBase.Parse(Connection.JsonEncoder, resp.DataAsText);

                        if (msg != null)
                        {
                            Connection.OnMessage(msg);

                            MultiMessage multiple = msg as MultiMessage;
                            if (multiple != null && multiple.PollDelay.HasValue)
                                PollDelay = multiple.PollDelay.Value;

                            LastPoll = DateTime.UtcNow;
                        }
                    }
                    else
                        reason = string.Format("Poll - Request Finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2}",
                                                                                                    resp.StatusCode,
                                                                                                    resp.Message,
                                                                                                    resp.DataAsText);
                    break;

                // The request finished with an unexpected error. The request's Exception property may contain more info about the error.
                case HTTPRequestStates.Error:
                    reason = "Poll - Request Finished with Error! " + (req.Exception != null ? (req.Exception.Message + "\n" + req.Exception.StackTrace) : "No Exception");
                    break;

                // Ceonnecting to the server is timed out.
                case HTTPRequestStates.ConnectionTimedOut:
                    reason = "Poll - Connection Timed Out!";
                    break;

                // The request didn't finished in the given time.
                case HTTPRequestStates.TimedOut:
                    reason = "Poll - Processing the request Timed Out!";
                    break;
            }

            if (!string.IsNullOrEmpty(reason))
                Connection.Error(reason);
        }
        private void OnNegotiationRequestFinished(HTTPRequest req, HTTPResponse resp)
        {
            NegotiationRequest = null;

            switch (req.State)
            {
                case HTTPRequestStates.Finished:
                    if (resp.IsSuccess)
                    {
                        HTTPManager.Logger.Information("NegotiationData", "Negotiation data arrived: " + resp.DataAsText);

                        int idx = resp.DataAsText.IndexOf("{");
                        if (idx < 0)
                        {
                            RaiseOnError("Invalid negotiation text: " + resp.DataAsText);
                            return;
                        }

                        var Negotiation = Parse(resp.DataAsText.Substring(idx));

                        if (Negotiation == null)
                        {
                            RaiseOnError("Parsing Negotiation data failed: " + resp.DataAsText);
                            return;
                        }

                        if (OnReceived != null)
                        {
                            OnReceived(this);
                            OnReceived = null;
                        }
                    }
                    else
                        RaiseOnError(string.Format("Negotiation request finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2} Uri: {3}",
                                                                    resp.StatusCode,
                                                                    resp.Message,
                                                                    resp.DataAsText,
                                                                    req.CurrentUri));
                    break;

                case HTTPRequestStates.Error:
                    RaiseOnError(req.Exception != null ? (req.Exception.Message + " " + req.Exception.StackTrace) : string.Empty);
                    break;

                default:
                    RaiseOnError(req.State.ToString());
                    break;
            }   
        }
    static int QPYX_get_Data_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        BestHTTP.HTTPResponse QPYX_obj_YXQP = (BestHTTP.HTTPResponse)QPYX_o_YXQP;
            byte[] QPYX_ret_YXQP = QPYX_obj_YXQP.Data;
            ToLua.Push(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index Data on a nil value"));
        }
    }
    static int QPYX_get_IsClosedManually_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        BestHTTP.HTTPResponse QPYX_obj_YXQP = (BestHTTP.HTTPResponse)QPYX_o_YXQP;
            bool QPYX_ret_YXQP = QPYX_obj_YXQP.IsClosedManually;
            LuaDLL.lua_pushboolean(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index IsClosedManually on a nil value"));
        }
    }
    static int QPYX_get_DataAsTexture2D_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        BestHTTP.HTTPResponse QPYX_obj_YXQP = (BestHTTP.HTTPResponse)QPYX_o_YXQP;
            UnityEngine.Texture2D QPYX_ret_YXQP = QPYX_obj_YXQP.DataAsTexture2D;
            ToLua.PushSealed(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index DataAsTexture2D on a nil value"));
        }
    }