Skip to content

Add header "Range" #26

@daixian

Description

@daixian

hi,I want to implement the download file to support the breakpoint resume.I try to add header "Range:bytes=0-100". But i get a ArgumentException in Request.MakeRequest() function,line
request.Headers = GetHeadersFromProvider(headers.GetHeaders());

Dictionary<String, String> headers = new Dictionary<string, string>();
headers.Add("Range", "bytes=0-100");
DictionaryHeaderProvider provider = new DictionaryHeaderProvider(headers);

RequestBuilder rb = Http.Get("https://blog.csdn.net/");
rb.Headers(provider);
rb.Go();

msdn:
https://msdn.microsoft.com/ZH-CN/library/s71167ye(v=VS.110,d=hv.2).aspx
The M:System.Net.WebHeaderCollection.Add(System.Net.HttpRequestHeader,System.String) method throws an T:System.ArgumentException if you try to set one of these protected headers.

so I can only modified code to pass the HttpWebRequest out when it is ready to work。

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions