/// <summary> /// 加载 HTTP 调用[TRY] /// </summary> /// <typeparam name="callType"></typeparam> /// <param name="socket">HTTP套接字接口</param> /// <param name="call">HTTP 调用</param> /// <param name="callInfo">HTTP 调用函数信息</param> protected void loadAsynchronous <callType>(Http.SocketBase socket, callType call, AutoCSer.WebView.CallMethodInfo callInfo) where callType : AutoCSer.WebView.CallAsynchronous <callType> { Http.Header header = socket.HttpHeader; if (header.ContentLength <= callInfo.MaxPostDataSize && (header.Method == Http.MethodType.POST || !callInfo.IsOnlyPost)) { call.LoadHeader(this, socket, call, callInfo); if (header.Method == Http.MethodType.POST && header.ContentLength != 0) { socket.GetForm(call, Http.GetFormType.CallAsynchronous); return; } long socketIdentity = socket.Identity; if (this.call(call)) { return; } call.PushPool(); socket.ResponseError(socketIdentity, Http.ResponseState.ServerError500); } else { AutoCSer.WebView.CallAsynchronous <callType> .PushNotNull(call); socket.ResponseErrorIdentity(Http.ResponseState.ServerError500); } }
/// <summary> /// 加载web调用 /// </summary> /// <param name="socket">HTTP套接字接口</param> /// <param name="call">web调用</param> /// <param name="callInfo">HTTP 调用函数信息</param> protected void load(Http.SocketBase socket, AutoCSer.WebView.Call call, AutoCSer.WebView.CallMethodInfo callInfo) { Http.Header header = socket.HttpHeader; if (header.ContentLength <= callInfo.MaxPostDataSize && (header.Method == Http.MethodType.POST || !callInfo.IsOnlyPost)) { call.LoadHeader(this, socket, callInfo); if (header.Method == Http.MethodType.POST && header.ContentLength != 0) { socket.GetForm(call, Http.GetFormType.Call); return; } long socketIdentity = socket.Identity; if (this.callSynchronize(call)) { return; } socket.ResponseError(socketIdentity, Http.ResponseState.ServerError500); } else { socket.ResponseErrorIdentity(Http.ResponseState.ServerError500); } }
/// <summary> /// WebSocket请求处理 /// </summary> /// <param name="socket">HTTP套接字</param> public override void WebSocketRequest(Http.SocketBase socket) { int index = webSocketSearcher.Search(socket.HttpHeader.Path); if (index >= 0) { long socketIdentity = socket.Identity; try { callWebSocket(index, socket); return; } catch (Exception error) { socket.ResponseError(socketIdentity, Http.ResponseState.ServerError500); RegisterServer.TcpServer.Log.Exception(error, null, LogLevel.Exception | LogLevel.AutoCSer); } } else { socket.ResponseErrorIdentity(Http.ResponseState.NotFound404); } }