/// <summary> /// Initializes a new instance of the <see cref="HttpClient"/> class. /// 构造新的HttpClient实例 /// </summary> /// <param name="url"> /// 要获取的资源的地址 /// </param> /// <param name="context"> /// Cookie及Referer /// </param> /// <param name="keepContext"> /// 是否自动在不同的请求间保留Cookie, Referer /// </param> public HttpClient(string url, HttpClientContext context, bool keepContext) { this.url = url; this.context = context; this.keepContext = keepContext; if (this.context == null) { this.context = new HttpClientContext(); } }
/// <summary> /// Initializes a new instance of the <see cref="HttpClient"/> class. /// 构造新的HttpClient实例 /// </summary> /// <param name="url"> /// 要获取的资源的地址 /// </param> /// <param name="context"> /// Cookie及Referer /// </param> public HttpClient(string url, HttpClientContext context) : this(url, context, false) { }