コード例 #1
0
 private Task <byte[]> FetchObject(HttpWebResponse response, CancellationToken cancellationToken)
 {
     this._lastModified = response.Headers["Last-Modified"];
     this._etag         = response.Headers["ETag"];
     this._cacheControl = response.Headers["CacheControl"];
     return(HttpWebRequestExtensions.ReadAsByteArrayAsync(response, cancellationToken));
 }
コード例 #2
0
        public async Task <IWebStreamResponse> GetWebStreamAsync(Uri url, bool waitForContent, CancellationToken cancellationToken, Uri referrer = null, long?from = null, long?to = null, SM.Media.Web.WebResponse webResponse = null)
        {
            HttpWebRequest  request  = this._webReaderManager.CreateRequest(url, referrer, (IWebReader)this, this.ContentType, (string)null, waitForContent, from, to);
            HttpWebResponse response = await HttpWebRequestExtensions.SendAsync(request, cancellationToken).ConfigureAwait(false);

            this.Update(url, response, webResponse);
            return((IWebStreamResponse) new HttpWebRequestWebStreamResponse(request, response));
        }
コード例 #3
0
 public async Task <byte[]> GetByteArrayAsync(Uri url, CancellationToken cancellationToken, SM.Media.Web.WebResponse webResponse = null)
 {
     if ((Uri)null != this._baseAddress && !url.IsAbsoluteUri)
     {
         url = new Uri(this._baseAddress, url);
     }
     byte[] numArray;
     using (HttpWebResponse response = await this._webReaderManager.SendAsync(url, (IWebReader)this, cancellationToken, (string)null, (ContentType)null, true, (Uri)null, new long?(), new long?()).ConfigureAwait(false))
     {
         this.Update(url, response, webResponse);
         numArray = await HttpWebRequestExtensions.ReadAsByteArrayAsync(response, cancellationToken).ConfigureAwait(false);
     }
     return(numArray);
 }
コード例 #4
0
        internal async Task <HttpWebResponse> SendAsync(Uri url, IWebReader parent, CancellationToken cancellationToken, string method = null, ContentType contentType = null, bool allowBuffering = true, Uri referrer = null, long?fromBytes = null, long?toBytes = null)
        {
            HttpWebRequest request = this.CreateRequest(url, referrer, parent, contentType, method, allowBuffering, fromBytes, toBytes);

            return(await HttpWebRequestExtensions.SendAsync(request, cancellationToken).ConfigureAwait(false));
        }