コード例 #1
0
        protected Page HandleResponse(Request request, string charset, HttpResults httpResponse, ITask task)
        {
            var  bytes = httpResponse.ResultByte;
            Page page  = new Page();

            page.SetBytes(bytes);
            page.SetCharset(charset);
            page.SetRawText(Encoding.GetEncoding(charset).GetString(bytes));
            page.SetUrl(new PlainText(request.GetUrl()));
            page.SetRequest(request);
            page.SetStatusCode(httpResponse.StatusCodeNum);
            page.SetDownloadSuccess(true);
            if (_responseHeader)
            {
                page.SetHeaders(HttpClientUtils.ConvertHeaders(httpResponse.Header));
            }
            return(page);
        }