set { _settings.ProxyPassword = value; }
}
+ public string ProxyDomain
+ {
+ get { return _settings.ProxyDomain; }
+ set { _settings.ProxyDomain = value; }
+ }
+
public bool ProxyAuthentication
{
<DependentUpon>GroupsView.xaml</DependentUpon>
</Compile>
<Compile Include="Preferences\GroupsViewModel.cs" />
+ <Compile Include="Preferences\ProxyAccountView.xaml.cs">
+ <DependentUpon>ProxyAccountView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Preferences\ProxyAccountViewModel.cs" />
<Compile Include="Shell\AboutView.xaml.cs">
<DependentUpon>AboutView.xaml</DependentUpon>
</Compile>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="Preferences\ProxyAccountView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Shell\AboutView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CheckBox Content="Proxy requires authentication" Height="16" VerticalAlignment="Top" Name="Settings_ProxyAuthentication" />
</GroupBox.Header>
<Grid >
- <Label Content="Username" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" Name="label3" VerticalAlignment="Top" />
- <Label Content="Password" Height="28" HorizontalAlignment="Left" Margin="0,32,0,0" Name="label4" VerticalAlignment="Top" />
- <TextBox Height="23" HorizontalAlignment="Left" Margin="65,6,0,0" Name="Settings_ProxyUsername" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/>
- <TextBox Height="23" HorizontalAlignment="Left" Margin="65,37,0,0" Name="Settings_ProxyPassword" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/>
+ <Grid.RowDefinitions>
+ <RowDefinition/>
+ <RowDefinition/>
+ <RowDefinition/>
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition/>
+ <ColumnDefinition/>
+ </Grid.ColumnDefinitions>
+ <Label Content="Username" Height="28" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" />
+ <Label Content="Password" Height="28" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" />
+ <Label Content="Domain" Height="28" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="0" VerticalAlignment="Top" />
+ <TextBox Height="23" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" Name="Settings_ProxyUsername" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/>
+ <TextBox Height="23" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="1" Name="Settings_ProxyPassword" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/>
+ <TextBox Height="23" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="1" Name="Settings_ProxyDomain" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/>
</Grid>
</GroupBox>
</Grid>
--- /dev/null
+<Window x:Class="Pithos.Client.WPF.Preferences.ProxyAccountView"\r
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
+ xmlns:Converters="clr-namespace:Pithos.Client.WPF.Converters" Title="ProxyAccountView" Height="300" Width="400">\r
+ <Window.Resources>\r
+ <ResourceDictionary>\r
+ <ResourceDictionary.MergedDictionaries>\r
+ <ResourceDictionary Source="..\PithosStyles.xaml" />\r
+ </ResourceDictionary.MergedDictionaries>\r
+ <Converters:NullToVisibilityConverter x:Key="NullToVisible" />\r
+ </ResourceDictionary>\r
+ </Window.Resources>\r
+ <Grid>\r
+ <Grid.RowDefinitions>\r
+ <RowDefinition Height="Auto"/>\r
+ <RowDefinition Height="Auto"/>\r
+ <RowDefinition Height="Auto"/>\r
+ <RowDefinition/>\r
+ <RowDefinition Height="Auto"/>\r
+ </Grid.RowDefinitions>\r
+ <Grid.ColumnDefinitions>\r
+ <ColumnDefinition Width="Auto"/>\r
+ <ColumnDefinition />\r
+ </Grid.ColumnDefinitions>\r
+ <RadioButton Name="Settings_UseDefaultProxy" Content="Use System Defaults" Margin="5,6,5,0" Height="16" VerticalAlignment="Top"/>\r
+ <RadioButton Name="Settings_UseManualProxy" Content="Manual" Margin="5,28,5,0" Height="16" VerticalAlignment="Top"/>\r
+ <Label Content="Server" Height="28" HorizontalAlignment="Left" Margin="5,47,0,0" Name="label2" VerticalAlignment="Top" />\r
+ <TextBox Height="23" HorizontalAlignment="Left" Margin="76,51,0,0" Name="Settings_ProxyServer" VerticalAlignment="Top" Width="162" IsEnabled="{Binding ElementName=Settings_UseManualProxy, Path=IsChecked}"/>\r
+ <TextBlock Height="23" HorizontalAlignment="Left" Margin="244,51,0,0" Name="textBlock1" Text=":" VerticalAlignment="Top" />\r
+ <TextBox Height="23" HorizontalAlignment="Left" Margin="254,51,0,0" Name="Settings_ProxyPort" VerticalAlignment="Top" Width="65" IsEnabled="{Binding ElementName=Settings_UseManualProxy, Path=IsChecked}"/>\r
+\r
+ <GroupBox Height="109" HorizontalAlignment="Left" Margin="5,80,0,0" Name="groupBox2" VerticalAlignment="Top" Width="373" IsEnabled="{Binding ElementName=Settings_UseManualProxy, Path=IsChecked}">\r
+ <GroupBox.Header>\r
+ <CheckBox Content="Proxy requires authentication" Height="16" VerticalAlignment="Top" Name="Settings_ProxyAuthentication" />\r
+ </GroupBox.Header>\r
+ <Grid >\r
+ <Grid.RowDefinitions>\r
+ <RowDefinition/>\r
+ <RowDefinition/>\r
+ <RowDefinition/>\r
+ </Grid.RowDefinitions>\r
+ <Grid.ColumnDefinitions>\r
+ <ColumnDefinition/>\r
+ <ColumnDefinition/>\r
+ </Grid.ColumnDefinitions>\r
+ <Label Content="Username" Height="28" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" />\r
+ <Label Content="Password" Height="28" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" />\r
+ <Label Content="Domain" Height="28" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="0" VerticalAlignment="Top" />\r
+ <TextBox Height="23" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" Name="Settings_ProxyUsername" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/>\r
+ <TextBox Height="23" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="1" Name="Settings_ProxyPassword" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/>\r
+ <TextBox Height="23" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="1" Name="Settings_ProxyDomain" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/>\r
+ </Grid>\r
+ </GroupBox>\r
+ \r
+\r
+<!--\r
+ <TextBlock Text="UserName" Grid.Row="0" Grid.Column="0" Margin="5"/>\r
+ <TextBox x:Name="UserName" Grid.Row="0" Grid.Column="1" Margin="5"/>\r
+ <TextBlock Text="Password" Grid.Row="1" Grid.Column="0" Margin="5"/>\r
+ <TextBox x:Name="Password" Grid.Row="1" Grid.Column="1" Margin="5"/>\r
+ <TextBlock Text="Domain" Grid.Row="2" Grid.Column="0" Margin="5"/>\r
+ <TextBox x:Name="Domain" Grid.Row="2" Grid.Column="1" Margin="5"/>\r
+-->\r
+ <StackPanel Orientation="Horizontal" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Right" VerticalAlignment="Bottom">\r
+ <Button Name="SaveChanges" Content="OK" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}"/>\r
+ <Button Name="RejectChanges" Content="Cancel" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}"/>\r
+ </StackPanel>\r
+ </Grid>\r
+</Window>\r
--- /dev/null
+using System;\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Windows;\r
+using System.Windows.Controls;\r
+using System.Windows.Data;\r
+using System.Windows.Documents;\r
+using System.Windows.Input;\r
+using System.Windows.Media;\r
+using System.Windows.Media.Imaging;\r
+using System.Windows.Shapes;\r
+\r
+namespace Pithos.Client.WPF.Preferences\r
+{\r
+ /// <summary>\r
+ /// Interaction logic for ProxyAccountView.xaml\r
+ /// </summary>\r
+ public partial class ProxyAccountView : Window\r
+ {\r
+ public ProxyAccountView()\r
+ {\r
+ InitializeComponent();\r
+ }\r
+ }\r
+}\r
--- /dev/null
+// -----------------------------------------------------------------------\r
+// <copyright file="ProxyAccountViewModel.cs" company="Microsoft">\r
+// TODO: Update copyright text.\r
+// </copyright>\r
+// -----------------------------------------------------------------------\r
+\r
+using System.ComponentModel.Composition;\r
+using System.Diagnostics.Contracts;\r
+using System.Net;\r
+using Caliburn.Micro;\r
+using Pithos.Client.WPF.Configuration;\r
+\r
+namespace Pithos.Client.WPF.Preferences\r
+{\r
+ using System;\r
+ using System.Collections.Generic;\r
+ using System.Linq;\r
+ using System.Text;\r
+\r
+ [Export(typeof(ProxyAccountViewModel))]\r
+ public class ProxyAccountViewModel:Screen\r
+ {\r
+ public override string DisplayName\r
+ {\r
+ get { return "Proxy Settings"; }\r
+ set\r
+ {\r
+ base.DisplayName = value;\r
+ }\r
+ }\r
+ private string _userName;\r
+ public string UserName\r
+ {\r
+ get { return _userName; }\r
+ set\r
+ {\r
+ if (String.IsNullOrWhiteSpace(value))\r
+ throw new ArgumentNullException();\r
+ _userName = value;\r
+ NotifyOfPropertyChange(()=>UserName);\r
+ }\r
+ }\r
+\r
+ private string _password; \r
+ public string Password\r
+ {\r
+ get { return _password; }\r
+ set\r
+ {\r
+ if (String.IsNullOrWhiteSpace(value))\r
+ throw new ArgumentNullException();\r
+ _password = value;\r
+ NotifyOfPropertyChange(()=>Password);\r
+ }\r
+ }\r
+\r
+ private string _domain;\r
+ public string Domain\r
+ {\r
+ get { return _domain; }\r
+ set\r
+ {\r
+ _domain = value;\r
+ NotifyOfPropertyChange(()=>Domain);\r
+ }\r
+ }\r
+\r
+ public PithosSettings Settings\r
+ {\r
+ get { return _settings; }\r
+ set\r
+ {\r
+ _settings = value;\r
+ NotifyOfPropertyChange(()=>Settings);\r
+ }\r
+ }\r
+\r
+ private PithosSettings _settings;\r
+\r
+ public ProxyAccountViewModel(PithosSettings settings)\r
+ {\r
+ if (settings == null)\r
+ throw new ArgumentNullException("settings");\r
+ Contract.EndContractBlock();\r
+\r
+ Settings = settings;\r
+ UserName = Settings.ProxyUsername;\r
+ Password = Settings.ProxyPassword;\r
+ Domain = Settings.ProxyDomain;\r
+ }\r
+\r
+ public void SaveChanges()\r
+ {\r
+/*\r
+ Settings.ProxyUsername = UserName;\r
+ Settings.ProxyPassword = Password;\r
+ Settings.ProxyDomain = Domain;\r
+ Settings.UseManualProxy = true;\r
+ Settings.UseDefaultProxy = false;\r
+ Settings.UseNoProxy = false;\r
+ Settings.ProxyAuthentication = true;\r
+*/\r
+ Settings.Save();\r
+ CredentialCache.DefaultNetworkCredentials.Password = Settings.ProxyPassword;\r
+ CredentialCache.DefaultNetworkCredentials.UserName = Settings.ProxyUsername;\r
+ CredentialCache.DefaultNetworkCredentials.Domain= Settings.ProxyDomain;\r
+ this.TryClose(true); \r
+ }\r
+\r
+ public void RejectChanges()\r
+ {\r
+ this.TryClose();\r
+ }\r
+ }\r
+}\r
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool ProxyAuthentication {
get {
return ((bool)(this["ProxyAuthentication"]));
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool UseDefaultProxy {
get {
return ((bool)(this["UseDefaultProxy"]));
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool UseManualProxy {
get {
return ((bool)(this["UseManualProxy"]));
this["PollingInterval"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string ProxyDomain {
+ get {
+ return ((string)(this["ProxyDomain"]));
+ }
+ set {
+ this["ProxyDomain"] = value;
+ }
+ }
}
}
<Value Profile="(Default)" />
</Setting>
<Setting Name="ProxyAuthentication" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">False</Value>
+ <Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="ExtensionsActivated" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="UseDefaultProxy" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">True</Value>
+ <Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="UseManualProxy" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">False</Value>
+ <Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="CloudfilesAuthenticationUrl" Type="System.String" Scope="Application">
<Value Profile="(Default)">https://auth.api.rackspacecloud.com</Value>
<Setting Name="PollingInterval" Type="System.Int32" Scope="User">
<Value Profile="(Default)">10</Value>
</Setting>
+ <Setting Name="ProxyDomain" Type="System.String" Scope="User">
+ <Value Profile="(Default)" />
+ </Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
using Hardcodet.Wpf.TaskbarNotification;
using Pithos.Client.WPF.Configuration;
using Pithos.Client.WPF.FileProperties;
+using Pithos.Client.WPF.Preferences;
using Pithos.Client.WPF.SelectiveSynch;
using Pithos.Client.WPF.Services;
using Pithos.Client.WPF.Shell;
if (AbandonRetry(monitor, retries))
return;
- if (IsUnauthorized(exc))
- {
- var message = String.Format("API Key Expired for {0}. Starting Renewal",monitor.UserName);
- Log.Error(message,exc);
- TryAuthorize(monitor,retries).Wait();
- }
- else
- {
- TryLater(monitor, exc,retries);
- }
+ HttpStatusCode statusCode =HttpStatusCode.OK;
+ var response = exc.Response as HttpWebResponse;
+ if(response!=null)
+ statusCode = response.StatusCode;
+
+ switch (statusCode)
+ {
+ case HttpStatusCode.Unauthorized:
+ var message = String.Format("API Key Expired for {0}. Starting Renewal",
+ monitor.UserName);
+ Log.Error(message, exc);
+ TryAuthorize(monitor, retries).Wait();
+ break;
+ case HttpStatusCode.ProxyAuthenticationRequired:
+ TryAuthenticateProxy(monitor,retries);
+ break;
+ default:
+ TryLater(monitor, exc, retries);
+ break;
+ }
}
catch (Exception exc)
{
});
}
- private bool AbandonRetry(PithosMonitor monitor, int retries)
+ private void TryAuthenticateProxy(PithosMonitor monitor,int retries)
+ {
+ Execute.OnUIThread(() =>
+ {
+ var proxyAccount = new ProxyAccountViewModel(this.Settings);
+ if (true == _windowManager.ShowDialog(proxyAccount))
+ {
+
+ StartMonitor(monitor, retries);
+ NotifyOfPropertyChange(() => Accounts);
+ }
+ });
+ }
+
+ private bool AbandonRetry(PithosMonitor monitor, int retries)
{
if (retries > 1)
{
<value />
</setting>
<setting name="ProxyAuthentication" serializeAs="String">
- <value>False</value>
+ <value>True</value>
</setting>
<setting name="ExtensionsActivated" serializeAs="String">
<value>True</value>
<value>False</value>
</setting>
<setting name="UseDefaultProxy" serializeAs="String">
- <value>True</value>
+ <value>False</value>
</setting>
<setting name="UseManualProxy" serializeAs="String">
- <value>False</value>
+ <value>True</value>
</setting>
<setting name="MustUpgrade" serializeAs="String">
<value>True</value>
<setting name="PollingInterval" serializeAs="String">
<value>10</value>
</setting>
+ <setting name="ProxyDomain" serializeAs="String">
+ <value />
+ </setting>
</Pithos.Client.WPF.Properties.Settings>
</userSettings>
<connectionStrings>
public string ProxyPassword { get; set; }
+ public string ProxyDomain { get; set; }
public bool ProxyAuthentication { get; set; }
public bool ExtensionsActivated { get; set; }
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
+using System.Net;
using System.Net.NetworkInformation;
using System.Security.Cryptography;
using System.ServiceModel.Description;
CloudClient=new CloudFilesClient(UserName,ApiKey);
- var proxyUri = ProxyFromSettings();
- CloudClient.Proxy = proxyUri;
+ var proxy = ProxyFromSettings();
+ CloudClient.Proxy = proxy;
CloudClient.UsePithos = true;
CloudClient.AuthenticationUrl = this.AuthenticationUrl;
public string AuthenticationUrl { get; set; }
- private Uri ProxyFromSettings()
+ private WebProxy ProxyFromSettings()
{
if (Settings.UseManualProxy)
{
- var proxyUri = new UriBuilder
- {
- Host = Settings.ProxyServer,
- Port = Settings.ProxyPort
- };
+ var proxy = new WebProxy(Settings.ProxyServer, Settings.ProxyPort);
+ //If the proxy requires specific authentication settings, use them
if (Settings.ProxyAuthentication)
{
- proxyUri.UserName = Settings.ProxyUsername;
- proxyUri.Password = Settings.ProxyPassword;
+ proxy.Credentials=new NetworkCredential(Settings.ProxyUsername,Settings.ProxyPassword,Settings.ProxyDomain);
}
- return proxyUri.Uri;
+ //Otherwise, if there are generic authentication settings, use them
+ if (!String.IsNullOrWhiteSpace(CredentialCache.DefaultNetworkCredentials.UserName))
+ {
+ proxy.Credentials = CredentialCache.DefaultNetworkCredentials;
+ }
+ return proxy;
}
return null;
}
private void StartWorkflowAgent()
{
- //On Vista and up we can check for a network connection
+ WorkflowAgent.StatusNotification = StatusNotification;
+
+/* //On Vista and up we can check for a network connection
bool connected=Environment.OSVersion.Version.Major < 6 || NetworkListManager.IsConnectedToInternet;
//If we are not connected retry later
if (!connected)
{
Task.Factory.StartNewDelayed(10000, StartWorkflowAgent);
return;
- }
+ }*/
try
{
- WorkflowAgent.StatusNotification = StatusNotification;
WorkflowAgent.Start();
}
catch (Exception)
string ProxyUsername { get; set; }
-
-
string ProxyPassword { get; set; }
+ string ProxyDomain { get; set; }
bool ProxyAuthentication{ get; set; }
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
- <CodeContractsRunCodeAnalysis>True</CodeContractsRunCodeAnalysis>
+ <CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
<CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
public int ProxyPort { get; set; }
public string ProxyUsername { get; set; }
public string ProxyPassword { get; set; }
+ public string ProxyDomain { get; set; }
public bool ProxyAuthentication { get; set; }
public bool ExtensionsActivated { get; set; }
public int PollingInterval { get; set; }
ProxyPort = other.ProxyPort;
ProxyUsername = other.ProxyUsername;
ProxyPassword = other.ProxyPassword;
+ ProxyDomain = other.ProxyDomain;
ProxyAuthentication = other.ProxyAuthentication;
ExtensionsActivated = other.ExtensionsActivated;
PollingInterval = other.PollingInterval;
protected Uri RootAddressUri { get; set; }
- private Uri _proxy;
+ private WebProxy _proxy;
+ public WebProxy Proxy
+ {
+ get { return _proxy; }
+ set
+ {
+ _proxy = value;
+ if (_baseClient != null)
+ _baseClient.Proxy = value;
+ }
+ }
+
+
+ /* private Uri _proxy;
public Uri Proxy
{
get { return _proxy; }
if (_baseClient != null)
_baseClient.Proxy = new WebProxy(value);
}
- }
+ }*/
public double DownloadPercentLimit { get; set; }
public double UploadPercentLimit { get; set; }
{
BaseAddress = accountInfo.StorageUri.ToString(),
Timeout = 10000,
- Retries = 3
+ Retries = 3,
+ Proxy=this.Proxy
};
StorageUrl = accountInfo.StorageUri;
Token = accountInfo.Token;
var groups = new List<Group>();
using (var authClient = new RestClient{BaseAddress=AuthenticationUrl})
- {
+ {
if (Proxy != null)
- authClient.Proxy = new WebProxy(Proxy);
+ authClient.Proxy = Proxy;
Contract.Assume(authClient.Headers!=null);
{
BaseAddress = storageUrl,
Timeout = 10000,
- Retries = 3
+ Retries = 3,
+ Proxy=Proxy
};
StorageUrl = new Uri(storageUrl);
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
+using System.Net;
using System.Threading.Tasks;
using Pithos.Interfaces;
bool UsePithos { get; set; }
AccountInfo Authenticate();
- Uri Proxy { get; set; }
+ WebProxy Proxy { get; set; }
double DownloadPercentLimit { get; set; }
double UploadPercentLimit { get; set; }
string AuthenticationUrl { get; set; }
public Uri StorageUrl { get; set; }
public string Token { get; set; }
- public Uri Proxy { get; set; }
+ public WebProxy Proxy { get; set; }
public double DownloadPercentLimit { get; set; }
public double UploadPercentLimit { get; set; }
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
- <CodeContractsRunCodeAnalysis>True</CodeContractsRunCodeAnalysis>
+ <CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
<CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
TimedOut = false;
var webRequest = base.GetWebRequest(address);
var request = (HttpWebRequest)webRequest;
- request.ServicePoint.ConnectionLimit = 10;
+ request.ServicePoint.ConnectionLimit = 50;
if (IfModifiedSince.HasValue)
request.IfModifiedSince = IfModifiedSince.Value;
request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
}, actualRetries);
- var result = task.Result;
- return result;
+ try
+ {
+ var result = task.Result;
+ return result;
+
+ }
+ catch (AggregateException exc)
+ {
+ //If the task fails, propagate the original exception
+ if (exc.InnerException!=null)
+ throw exc.InnerException;
+ throw;
+ }
}
public void Head(string address,int retries=0)
public string ProxyPassword { get; set; }
+ public string ProxyDomain { get; set; }
+
public bool ProxyAuthentication { get; set; }
set { _settings.Value.ProxyPassword = value; }
}
+ public string ProxyDomain
+ {
+ get { return _settings.Value.ProxyDomain; }
+ set { _settings.Value.ProxyDomain = value; }
+ }
+
public bool ProxyAuthentication
{
public string ProxyPassword { get; set; }
+ public string ProxyDomain { get; set; }
+
public bool ExtensionsActivated { get; set; }
public int PollingInterval { get; set; }