示例#1
0
 /// <summary>
 /// HTML标题获取客户端任务池
 /// </summary>
 /// <param name="maxClientCount">最大实例数量</param>
 /// <param name="timeoutSeconds">套接字操作超时时间</param>
 /// <param name="bufferSize">收发数据缓冲区字节数</param>
 /// <param name="maxSearchSize">最大搜索字节数</param>
 /// <param name="isValidateCertificate">是否验证安全证书</param>
 /// <param name="log">日志处理</param>
 public HttpTask(int maxClientCount = 1, int timeoutSeconds = 15, AutoCSer.SubBuffer.Size bufferSize = SubBuffer.Size.Kilobyte4, int maxSearchSize = 0, bool isValidateCertificate = false, AutoCSer.Log.ILog log = null)
 {
     if (bufferSize < MinBufferSize)
     {
         bufferSize = MinBufferSize;
     }
     else if (bufferSize > SubBuffer.Size.Kilobyte32)
     {
         bufferSize = SubBuffer.Size.Kilobyte32;
     }
     BufferSize            = (int)bufferSize;
     MaxSearchSize         = Math.Min(BufferSize - sizeof(int), maxSearchSize);
     IsValidateCertificate = isValidateCertificate;
     this.Log      = log ?? AutoCSer.Log.Pub.Log;
     BufferPool    = AutoCSer.SubBuffer.Pool.GetPool(bufferSize);
     uris          = new Uri.Queue(new Uri());
     socketTimeout = SocketTimeoutLink.TimerLink.Get(Math.Max(timeoutSeconds, 15));
     clients       = new HttpClient[maxClientCount <= 0 ? 1 : maxClientCount];
 }