本文整理汇总了C#中WebHeaderCollection类的典型用法代码示例。如果您正苦于以下问题:C# WebHeaderCollection类的具体用法?C# WebHeaderCollection怎么用?C# WebHeaderCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebHeaderCollection类属于命名空间,在下文中一共展示了WebHeaderCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ChunkStream
public ChunkStream (WebHeaderCollection headers)
{
this.headers = headers;
saved = new StringBuilder ();
chunks = new ArrayList ();
chunkSize = -1;
}
开发者ID:transformersprimeabcxyz,项目名称:mono.net.httplistener,代码行数:7,代码来源:ChunkStream.cs
示例2: HttpRequestHeader_GetKey_Success
public void HttpRequestHeader_GetKey_Success()
{
WebHeaderCollection w = new WebHeaderCollection();
w.Add("header1", "value1");
w.Add("header1", "value2");
Assert.NotEmpty(w.GetKey(0));
}
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:WebHeaderCollectionTest.netstandard17.cs
示例3: HttpListenerRequest
internal HttpListenerRequest (HttpListenerContext context)
{
this.context = context;
headers = new WebHeaderCollection ();
input_stream = Stream.Null;
version = HttpVersion.Version10;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:HttpListenerRequest.cs
示例4: ChunkStream
public ChunkStream(WebHeaderCollection headers)
{
_headers = headers;
_chunkSize = -1;
_chunks = new List<Chunk> ();
_saved = new StringBuilder ();
}
开发者ID:pedro-ramirez-suarez,项目名称:DiPS,代码行数:7,代码来源:ChunkStream.cs
示例5: HeaderInfo
public static WebHeaderCollection HeaderInfo(String str)
{
WebHeaderCollection CC = new WebHeaderCollection();
HttpWebRequest Req = (HttpWebRequest)WebRequest.Create(str);
Req.Proxy = null;
Req.UseDefaultCredentials = true;
//YOU MUST ASSIGN A COOKIE CONTAINER FOR THE REQUEST TO PULL THE COOKIES
//Req.Headers = CC;
HttpWebResponse Res = (HttpWebResponse)Req.GetResponse();
//DUMP THE COOKIES
Console.WriteLine("----- HEADERS -----");
if(Res.Headers != null && Res.Headers.Count != 0)
{
foreach (string key in Res.Headers)
{
Console.WriteLine("\t" + key.ToString() + "\t" + Res.Headers[key]);
}
}
else
{
Console.WriteLine("No Headers");
}
return Res.Headers;
}
开发者ID:leon4422,项目名称:Neilson-Tag,代码行数:25,代码来源:WebFetch.cs
示例6: write
static void write(WebHeaderCollection headers)
{
for (int index = 0; index < headers.Count; index++) {
Console.WriteLine("{0}: {1}", headers.Keys[index], headers[index]);
}
Console.WriteLine("");
}
开发者ID:weaver,项目名称:scribbles,代码行数:7,代码来源:03-curl.cs
示例7: HttpRequestHeader_ToByteArray_Success
public void HttpRequestHeader_ToByteArray_Success()
{
WebHeaderCollection w = new WebHeaderCollection();
w.Add("header1", "value1");
w.Add("header1", "value2");
byte[] byteArr = w.ToByteArray();
Assert.NotEmpty(byteArr);
}
开发者ID:dotnet,项目名称:corefx,代码行数:8,代码来源:WebHeaderCollectionTest.netstandard17.cs
示例8: HttpRequest_AddQuery_CommonHeader_Success
public void HttpRequest_AddQuery_CommonHeader_Success()
{
string headerValue = "value123";
WebHeaderCollection w = new WebHeaderCollection();
w[HttpRequestHeader.Accept] = headerValue;
Assert.Equal(headerValue, w[HttpRequestHeader.Accept]);
}
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:8,代码来源:WebHeaderCollectionTest.cs
示例9: DefaultPropertyValues_ReturnEmptyAfterConstruction_Success
public void DefaultPropertyValues_ReturnEmptyAfterConstruction_Success()
{
WebHeaderCollection w = new WebHeaderCollection();
Assert.Equal(0, w.AllKeys.Length);
Assert.Equal(0, w.Count);
Assert.Equal("\r\n", w.ToString());
Assert.Empty(w);
}
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:8,代码来源:WebHeaderCollectionTest.cs
示例10: HttpRequestHeader_Get_Success
public void HttpRequestHeader_Get_Success()
{
WebHeaderCollection w = new WebHeaderCollection();
w.Add("header1", "value1");
w.Add("header1", "value2");
string[] values = w.GetValues(0);
Assert.Equal("value1", values[0]);
Assert.Equal("value2", values[1]);
}
开发者ID:dotnet,项目名称:corefx,代码行数:9,代码来源:WebHeaderCollectionTest.netstandard17.cs
示例11: HttpRequestHeader_Add_Success
public void HttpRequestHeader_Add_Success()
{
WebHeaderCollection w = new WebHeaderCollection();
w[HttpRequestHeader.Connection] = "keep-alive";
Assert.Equal(1, w.Count);
Assert.Equal("keep-alive", w[HttpRequestHeader.Connection]);
Assert.Equal("Connection", w.AllKeys[0]);
}
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:9,代码来源:WebHeaderCollectionTest.cs
示例12: HttpResponseHeader_AddQuery_CommonHeader_Success
public void HttpResponseHeader_AddQuery_CommonHeader_Success()
{
string headerValue = "value123";
WebHeaderCollection w = new WebHeaderCollection();
w[HttpResponseHeader.ProxyAuthenticate] = headerValue;
w[HttpResponseHeader.WwwAuthenticate] = headerValue;
Assert.Equal(headerValue, w[HttpResponseHeader.ProxyAuthenticate]);
Assert.Equal(headerValue, w[HttpResponseHeader.WwwAuthenticate]);
}
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:10,代码来源:WebHeaderCollectionTest.cs
示例13: CustomHeader_AddQuery_Success
public void CustomHeader_AddQuery_Success()
{
string customHeader = "Custom-Header";
string customValue = "Custom;.-Value";
WebHeaderCollection w = new WebHeaderCollection();
w[customHeader] = customValue;
Assert.Equal(1, w.Count);
Assert.Equal(customValue, w[customHeader]);
Assert.Equal(customHeader, w.AllKeys[0]);
}
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:11,代码来源:WebHeaderCollectionTest.cs
示例14: HttpRequestHeader_Add_Remove_Success
public void HttpRequestHeader_Add_Remove_Success()
{
WebHeaderCollection w = new WebHeaderCollection();
w.Add(HttpRequestHeader.Warning, "Warning1");
Assert.Equal(1, w.Count);
Assert.Equal("Warning1", w[HttpRequestHeader.Warning]);
Assert.Equal("Warning", w.AllKeys[0]);
w.Remove(HttpRequestHeader.Warning);
Assert.Equal(0, w.Count);
}
开发者ID:dotnet,项目名称:corefx,代码行数:12,代码来源:WebHeaderCollectionTest.netstandard17.cs
示例15: SerializeDeserialize_Roundtrip_MemberData
public static IEnumerable<object[]> SerializeDeserialize_Roundtrip_MemberData()
{
for (int i = 0; i < 10; i++)
{
var wc = new WebHeaderCollection();
for (int j = 0; j < i; j++)
{
wc[$"header{j}"] = $"value{j}";
}
yield return new object[] { wc };
}
}
开发者ID:dotnet,项目名称:corefx,代码行数:12,代码来源:WebHeaderCollectionTest.netstandard17.cs
示例16: getHeader
static WebHeaderCollection getHeader(System.Uri pUri)
{
var lHeader = new WebHeaderCollection();
//lHeader.Add("Host", pUri.Host);
//lHeader.Add("Get", pUri.PathAndQuery);
//lHeader.Add("Accept", "*/*");
lHeader.Add("Cache-Control", "no-cache");
//lHeader.Add("Connection", "Keep-Alive");
lHeader.Add("Pragma", "no-cache");
//lHeader.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)");
return lHeader;
}
开发者ID:Seraphli,项目名称:TheInsectersWar,代码行数:12,代码来源:BreakpointDownload.cs
示例17: RTSPClient
public RTSPClient( string Host, int Port, string URL )
{
host = Host;
port = Port;
url = URL;
cseq = 0;
UserAgent = "RTSPClient";
tcctrl = new TcpClient();
addheaders = new WebHeaderCollection();
}
开发者ID:llytvynenko,项目名称:axStream,代码行数:12,代码来源:RTSPClient.cs
示例18: TestWebHeaderCollectionAdd
public void TestWebHeaderCollectionAdd()
{
WebHeaderCollection whc = new WebHeaderCollection();
whc.Add("phony:header");
whc.Add("some", "stuff");
try
{
whc.Add("nonsenseheader");
Fail("Add: failed to throw exception for missing colon");
}
catch (ArgumentException)
{
// So far, so good.
}
try
{
whc.Add(null);
Fail("Add: failed to throw exception for null header");
}
catch (ArgumentNullException)
{
// Still ok...
}
try
{
whc.Add(null, "theOtherCtor");
Fail("Add: failed to throw header for null name");
}
catch (ArgumentNullException)
{
// Onward and upward...
}
try
{
whc.Add("accept:betterNot");
Fail("Add: failed to throw exception for restricted header");
}
catch (ArgumentException)
{
// Add looks good...
}
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:42,代码来源:TestWebHeaderCollection.cs
示例19: BrowserHttpWebResponse
public BrowserHttpWebResponse (HttpWebRequest request, IntPtr native)
{
this.request = request;
this.response = new MemoryStream ();
progressive = request.AllowReadStreamBuffering;
Headers = new WebHeaderCollection ();
SetMethod (request.Method);
if (native == IntPtr.Zero)
return;
// Get the status code and status text asap, this way we don't have to
// ref/unref the native ptr
int status_code = NativeMethods.http_response_get_response_status (native);
SetStatus ((HttpStatusCode) status_code, (status_code == 200 || status_code == 404) ?
NativeMethods.http_response_get_response_status_text (native) :
"Requested resource was not found");
GCHandle handle = GCHandle.Alloc (this);
NativeMethods.http_response_visit_headers (native, OnHttpHeader, GCHandle.ToIntPtr (handle));
handle.Free ();
}
开发者ID:shana,项目名称:moon,代码行数:22,代码来源:BrowserHttpWebResponse.cs
示例20: HttpContinueMethod
public void HttpContinueMethod(int StatusCode, WebHeaderCollection httpHeaders)
{
}
开发者ID:chcosta,项目名称:corefx,代码行数:3,代码来源:HttpWebResponseHeaderTest.cs
注:本文中的WebHeaderCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论