mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
THRIFT-4859 Enables changing 'UserAgent'
Client: C# Patch: Park June Chul <pjc0247@naver.com> This closes #1787
This commit is contained in:
parent
65d5f84507
commit
8d554f503e
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
@ -43,6 +43,7 @@ namespace Thrift.Transport
|
||||
private int readTimeout = 30000;
|
||||
|
||||
private IDictionary<string, string> customHeaders = new Dictionary<string, string>();
|
||||
private string userAgent = "C#/THttpClient";
|
||||
|
||||
#if !SILVERLIGHT
|
||||
private IWebProxy proxy = WebRequest.DefaultWebProxy;
|
||||
@ -52,12 +53,22 @@ namespace Thrift.Transport
|
||||
: this(u, Enumerable.Empty<X509Certificate>())
|
||||
{
|
||||
}
|
||||
public THttpClient(Uri u, string userAgent)
|
||||
: this(u, userAgent, Enumerable.Empty<X509Certificate>())
|
||||
{
|
||||
}
|
||||
|
||||
public THttpClient(Uri u, IEnumerable<X509Certificate> certificates)
|
||||
{
|
||||
uri = u;
|
||||
this.certificates = (certificates ?? Enumerable.Empty<X509Certificate>()).ToArray();
|
||||
}
|
||||
public THttpClient(Uri u, string userAgent, IEnumerable<X509Certificate> certificates)
|
||||
{
|
||||
uri = u;
|
||||
this.userAgent = userAgent;
|
||||
this.certificates = (certificates ?? Enumerable.Empty<X509Certificate>()).ToArray();
|
||||
}
|
||||
|
||||
public int ConnectTimeout
|
||||
{
|
||||
@ -271,7 +282,7 @@ namespace Thrift.Transport
|
||||
// Make the request
|
||||
connection.ContentType = "application/x-thrift";
|
||||
connection.Accept = "application/x-thrift";
|
||||
connection.UserAgent = "C#/THttpClient";
|
||||
connection.UserAgent = userAgent;
|
||||
connection.Method = "POST";
|
||||
#if !SILVERLIGHT
|
||||
connection.ProtocolVersion = HttpVersion.Version10;
|
||||
|
Loading…
Reference in New Issue
Block a user