合并更新Remoting,无法迁移到NewLife.Remoting,因为后者为支持net40就得放弃一些新的语法。
智能大石头 authored at 2024-02-02 16:49:09 智能大石头 committed at 2024-02-02 16:58:46
831.00 B
X
using NewLife.Http;
using NewLife.Net;

namespace NewLife.Remoting;

class ApiHttpServer : ApiNetServer
{
    #region 属性
    //private String RawUrl;
    #endregion

    public ApiHttpServer()
    {
        Name = "Http";

        ProtocolType = NetType.Http;
    }

    /// <summary>初始化</summary>
    /// <param name="config"></param>
    /// <param name="host"></param>
    /// <returns></returns>
    public override Boolean Init(Object config, IApiHost host)
    {
        Host = host;

        if (config is NetUri uri) Port = uri.Port;

        //RawUrl = uri + "";

        // Http封包协议
        //Add<HttpCodec>();
        Add(new HttpCodec { AllowParseHeader = true });

        //host.Handler = new ApiHttpHandler { Host = host };
        host.Encoder = new HttpEncoder();

        return true;
    }
}