--- /dev/null
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+#
+# CoreFX - Net configuration
+#
+
+# -- Machine selection
+
+# You can find the host name by logging on to the target machine and typing "hostname" in a cmd console.
+# You can find the IP address by logging on to the target machine and typing "ipconfig" in a cmd console.
+# Requirements:
+# - The machines below should be within the same LAN network.
+# - All machines must have Powershell >3.0 installed.
+
+# IMPORTANT:
+# The state for the following machines will be changed irreversably.
+# The uninstall step will remove the installed components regardless if it existed before the deployment or
+# was altered/customized after deployment.
+#
+
+# A Windows Server SKU hosting Active Directory services. This machine will become the Domain Controller:
+$COREFX_NET_AD_Machine = "" #Example: "TESTAD"
+$COREFX_NET_AD_MachineIP = "" #Example: "192.168.0.1" - must be a Static IPv4 address.
+
+# A Windows Client or Server SKU hosting the IIS Server. This machine will be joined to the Domain.
+$COREFX_NET_IISSERVER_Machine = "" #Example: "TESTIIS"
+$COREFX_NET_IISSERVER_MachineIP = "" #Example: "192.168.0.1" - must be a Static IPv4 address.
+
+# A Windows Client or Server SKU hosting the corefx enlistment. This machine will be joined to the Domain.
+$COREFX_NET_CLIENT_Machine = "" #Example: "TESTCLIENT"
+
+# -- Test parameters
+
+# For security reasons, it's advisable that the default username/password pairs below are changed regularly.
+
+$script:domainName = "corp.contoso.com"
+$script:domainNetbios = "corefx-net-ad"
+
+$script:domainUserName = "testaduser"
+$script:domainUserPassword = "Test-ADPassword"
+
+$script:basicUserName = "testbasic"
+$script:basicUserPassword = "Test-Basic"
+
+# Changing the IISServer FQDN may require changing certificates.
+$script:iisServerFQDN = "testserver.contoso.com"
+
+$script:PreRebootRoles = @(
+ @{Name = "COREFX_NET_AD_CLIENT"; Script = "setup_activedirectory_client.ps1"; MachineName = $COREFX_NET_IISSERVER_Machine},
+ @{Name = "COREFX_NET_AD_CLIENT"; Script = "setup_activedirectory_client.ps1"; MachineName = $COREFX_NET_CLIENT_Machine},
+ @{Name = "COREFX_NET_AD_DC"; Script = "setup_activedirectory_domaincontroller.ps1"; MachineName = $COREFX_NET_AD_Machine; MachineIP = $COREFX_NET_AD_MachineIP}
+)
+
+$script:Roles = @(
+ @{Name = "COREFX_NET_IISSERVER"; Script = "setup_iisserver.ps1"; MachineName = $COREFX_NET_IISSERVER_Machine; MachineIP = $COREFX_NET_IISSERVER_MachineIP},
+ @{Name = "COREFX_NET_CLIENT"; Script = "setup_client.ps1"; MachineName = $COREFX_NET_CLIENT_Machine},
+ @{Name = "COREFX_NET_AD_DC"; Script = "setup_activedirectory_domaincontroller.ps1"; MachineName = $COREFX_NET_AD_Machine; MachineIP = $COREFX_NET_AD_MachineIP}
+)
+
+# The following variable names should match the ones read by Configuration.*.cs code.
+$script:ClientConfiguration = @(
+
+# TODO #9048:
+ # Configuration.Http:
+# @{Name = "COREFX_HTTPHOST"; Value = $script:iisServerFQDN},
+# @{Name = "COREFX_SECUREHTTPHOST"; Value = $script:iisServerFQDN},
+# @{Name = "COREFX_HTTP2HOST"; Value = $script:iisServerFQDN}, # Requires Windows 10 and above.
+# @{Name = "COREFX_DOMAINJOINED_HTTPHOST"; Value = $script:iisServerFQDN},
+# @{Name = "COREFX_DOMAINJOINED_PROXYHOST"; Value = $null}, # TODO 9048: Install & configure ISA/TMG or Squid
+# @{Name = "COREFX_DOMAINJOINED_PROXYPORT"; Value = $null}, # TODO 9048: Install & configure ISA/TMG or Squid
+# @{Name = "COREFX_HTTPHOST_SSL2"; Value = $null}, # TODO 9048: move to a localhost server or configure these websites.
+# @{Name = "COREFX_HTTPHOST_SSL3"; Value = $null},
+# @{Name = "COREFX_HTTPHOST_TLS10"; Value = $null},
+# @{Name = "COREFX_HTTPHOST_TLS11"; Value = $null},
+# @{Name = "COREFX_HTTPHOST_TLS12"; Value = $null},
+# @{Name = "COREFX_HTTPHOST_EXPIREDCERT"; Value = $null},
+# @{Name = "COREFX_HTTPHOST_WRONGHOSTNAME"; Value = $null},
+# @{Name = "COREFX_HTTPHOST_SELFSIGNEDCERT"; Value = $null},
+# @{Name = "COREFX_HTTPHOST_REVOKEDCERT"; Value = $null},
+# @{Name = "COREFX_STRESS_HTTP"; Value = "1"},
+
+ # Configuration.WebSockets:
+# @{Name = "COREFX_WEBSOCKETHOST"; Value = $script:domainNetbios},
+# @{Name = "COREFX_SECUREWEBSOCKETHOST"; Value = $script:domainNetbios},
+
+ # Configuration.Security:
+ @{Name = "COREFX_NET_AD_DOMAINNAME"; Value = $script:domainNetbios},
+ @{Name = "COREFX_NET_AD_USERNAME"; Value = $script:domainUserName},
+ @{Name = "COREFX_NET_AD_PASSWORD"; Value = $script:domainUserPassword},
+ @{Name = "COREFX_NET_SECURITY_NEGOSERVERURI"; Value = "http://$($script:iisServerFQDN)"},
+ @{Name = "COREFX_NET_SECURITY_TLSSERVERURI"; Value = "https://$($script:iisServerFQDN)"},
+
+ @{Name = "COREFX_NET_SOCKETS_SERVERURI"; Value = "http://$($script:iisServerFQDN)"}
+)
--- /dev/null
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+#Requires -RunAsAdministrator
+
+Param (
+ [switch] $uninstall=$false
+)
+
+# Import configuration.
+. .\setup_common.ps1
+
+Function TestMachineStatus($role)
+{
+ try
+ {
+ $status = Invoke-Command -ComputerName $role.MachineName -ArgumentList $role.Name -ErrorAction Stop { [Environment]::GetEnvironmentVariable($args[0], "Machine") }
+
+ $role.Reachable = $true
+ if ($status -eq "Installed")
+ {
+ $role.Installed = $true
+ }
+ else
+ {
+ if (-not [string]::IsNullOrWhiteSpace($status))
+ {
+ Write-Warning "Role $($role.Name) found to have status of: $status."
+ Write-Warning "The script will try to resume the installation. To manually resume installation, manually run the $($role.Script) on $($role.MachineName) as Administrator."
+ }
+ }
+ }
+ catch [System.Exception]
+ {
+ $role.Reachable = $false
+ }
+}
+
+Function CheckRoles
+{
+ Write-Host "Verifying roles:"
+ foreach ($role in ($script:Roles + $script:PreRebootRoles))
+ {
+ Write-Host -ForegroundColor DarkGray "`t" $role.Name
+ if (-not (Test-Path $role.Script))
+ {
+ throw "Cannot find installation script for $($role.Name): $($role.Script)"
+ }
+
+ if ([string]::IsNullOrWhiteSpace($role.MachineName))
+ {
+ throw "Please edit config.ps1 and set a valid value name for $($role.Name)_Machine."
+ }
+
+ TestMachineStatus $role
+ }
+
+ Write-Host "OK."
+}
+
+Function EnsurePreRebootForCurrentMachine
+{
+ $machineInfo = Get-WmiObject win32_computersystem
+ $currentRole = GetPreRebootRoleForMachine($Env:COMPUTERNAME)
+
+ if (($machineInfo.PartOfDomain -eq $true) -and `
+ ($machineInfo.Domain -eq $script:domainName) -and `
+ ($currentRole.Installed -eq $true))
+ {
+ return $true
+ }
+ elseif (($machineInfo.PartOfDomain -eq $true) -and `
+ ($machineInfo.Domain -ne $script:domainName))
+ {
+ Write-Error "The current machine is already joiend to the $($machineInfo.Domain) domain."
+ Write-Error "Either change config.ps1 to use the correct domain information, select a different machine or remove the machine from the current domain."
+ throw "Cannot use the current machine: already joined to a domain."
+ }
+
+ & (".\" + $currentRole.Script)
+}
+
+Function CreateDestinationPath($s)
+{
+ return Invoke-Command -Session $s `
+ {
+ $destPath = Join-Path $env:SystemDrive "COREFX_NET_Scripts"
+ mkdir $destPath -ErrorAction SilentlyContinue | Out-Null
+ return $destPath
+ }
+}
+
+Function CopyScripts($s, $remotePath)
+{
+ foreach ($file in (dir *.ps1))
+ {
+ Copy-Item -Force -Path $file -Destination $remotePath -ToSession $s -ErrorAction Stop
+ }
+}
+
+Function InstallRoles
+{
+ Write-Host -ForegroundColor Cyan "Remotely installing all roles."
+
+ foreach ($role in $script:Roles)
+ {
+ Write-Host -ForegroundColor DarkCyan "Installing role [$($role.Name)]: $($role.MachineName)"
+
+ Write-Host -ForegroundColor DarkGray "`tConnecting"
+ $s = New-PSSession -ComputerName $role.MachineName
+
+ Write-Host -ForegroundColor DarkGray "`tCopying scripts"
+ # Copy scripts
+ $remotePath = CreateDestinationPath $s
+ CopyScripts $s $remotePath
+
+ Write-Host -ForegroundColor DarkGray "`tInstalling"
+ # Run remote scripts
+ Invoke-Command -Session $s -ArgumentList $remotePath, $role.Script `
+ {
+ $path = $args[0]
+ $script = $args[1]
+
+ cd $path
+ & (".\" + $script)
+ }
+
+ Write-Host -ForegroundColor DarkCyan "Role [$($role.Name)]: $($role.MachineName) installation complete."
+ Write-Host
+ Write-Host
+ }
+}
+
+Function Install
+{
+ Write-Host -ForegroundColor Cyan "Install/Update CoreFX Networking multi-machine prerequisites"
+ Write-Host
+ CheckRoles
+
+ EnsurePreRebootForCurrentMachine
+
+ if (($script:Roles | where {$_.Reachable -ne $true}).Count -ne 0)
+ {
+ Write-Warning "Not all roles are reachable from this host."
+ Write-Host "Log-on to the following machines, copy all scripts and run .\setup.ps1 as Administrator:"
+ $script:Roles | where {$_.Reachable -ne $true}
+ Write-Host -ForegroundColor Cyan "Rerun this command after all machines have been started and joined to the $($script:domainNetBios) domain."
+ return
+ }
+
+ InstallRoles
+
+ Write-Host -ForegroundColor Cyan "Role installation complete."
+}
+
+Function UnistallMachines
+{
+ Write-Host -ForegroundColor Cyan "Remotely uninstalling roles."
+
+ foreach ($role in $script:Roles)
+ {
+ Write-Host -ForegroundColor DarkCyan "Uninstalling role [$($role.Name)]: $($role.MachineName)"
+
+ Write-Host -ForegroundColor DarkGray "`tConnecting"
+ $s = New-PSSession -ComputerName $role.MachineName
+
+ Write-Host -ForegroundColor DarkGray "`tCopying scripts"
+ # Copy scripts
+ $remotePath = CreateDestinationPath $s
+ CopyScripts $s $remotePath
+
+ $preRebootRole = GetPreRebootRoleForMachine $role.MachineName
+
+ Write-Host -ForegroundColor DarkGray "`tUninstalling"
+ # Run remote scripts
+ Invoke-Command -Session $s -ArgumentList $remotePath, $role.Script, $preRebootRole.Script `
+ {
+ $path = $args[0]
+ $script = $args[1]
+ $preRebootScript = $args[2]
+
+ cd $path
+ & (".\" + $script) -uninstall
+ & (".\" + $preRebootScript) -uninstall
+ }
+
+ Write-Host -ForegroundColor DarkCyan "Role [$($role.Name)]: $($role.MachineName) uninstall complete."
+ Write-Host
+ Write-Host
+ }
+}
+
+Function Uninstall
+{
+ Write-Host -ForegroundColor Cyan "Uninstall CoreFX Networking multi-machine prerequisites"
+ Write-Host
+ CheckRoles
+ Write-Host
+
+ Write-Warning "Some of the installed components may have existed before or got changes outside of this setup script."
+ Write-Warning "The scripts will attempt to remove all components regardless of these changes."
+ $continue = Read-Host "Do you want to continue? [Y/N]"
+
+ if ($continue.ToUpper() -ne "Y")
+ {
+ Write-Warning "Aborted by user."
+ return
+ }
+
+ UnistallMachines
+}
+
+if ($uninstall)
+{
+ Uninstall
+}
+else
+{
+ Install
+}
--- /dev/null
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+#Requires -RunAsAdministrator
+
+#
+# Run this script on all Active Directory client machines.
+# Tested on Windows 2016 TP5 and Windows 10.
+#
+Param (
+ [switch] $uninstall=$false
+)
+
+# Imports:
+. .\setup_common.ps1
+
+$script:COREFX_ROLE_NAME = "COREFX_NET_AD_CLIENT"
+
+Function ConfigureDNS
+{
+ Write-Host -ForegroundColor Cyan "Configuring DNS"
+
+ $dcRole = GetRole "COREFX_NET_AD_DC"
+
+ if (-not (Test-Connection $dcRole.MachineIP))
+ {
+ throw "The local machine cannot ping the Domain Controller/DNS Server at $($dcRole.MachineIP).`n" + `
+ "Ensure that the setup was completed on the machine then try re-running the script on this machine again."
+ }
+
+ $ipv4DnsInterfaces = Get-DnsClientServerAddress | where {($_.AddressFamily -eq 2) -and ($_.InterfaceAlias -eq "Ethernet")}
+ $ifIndex = $ipv4DnsInterfaces[0].InterfaceIndex
+
+ Set-DnsClientServerAddress -InterfaceIndex $ifIndex -ServerAddresses ($dcRole.MachineIP)
+}
+
+Function EnableAD
+{
+ Write-Host -ForegroundColor Cyan "Adding computer to domain. Please use the domain administrator password for the $($script:domainNetbios) domain."
+ Add-Computer -DomainName $script:domainNetbios
+}
+
+Function Install
+{
+ Write-Host -ForegroundColor Cyan "Installing prerequisites for test role: $($script:COREFX_ROLE_NAME)"
+
+ CheckPreRebootMachineInfo
+ ConfigureDNS
+ EnableAD
+ Enable-PSRemoting
+ EnvironmentSetRebootPendingRoleStatus
+ Write-Host -ForegroundColor Cyan "Please re-start one instance of the script on any of the machines after reboot to resume the installation."
+ Read-Host "[Press ENTER to reboot.]"
+ Restart-Computer
+ EnvironmentSetInstalledRoleStatus
+}
+
+Function Uninstall
+{
+ Write-Host -ForegroundColor Cyan "Removing prerequisites for test role: $($script:COREFX_ROLE_NAME)."
+
+ EnvironmentCheckUninstallRoleStatus
+
+ Remove-Computer
+ EnvironmentRemoveRoleStatus
+
+ Write-Warning "Current DNS configuration:"
+ Get-DnsClientServerAddress
+ Write-Warning "To complete the uninstallation, you may need to change the DNS client address configuration."
+ Read-Host "[Press ENTER to reboot.]"
+ Restart-Computer
+}
+
+if ($uninstall)
+{
+ Uninstall
+}
+else
+{
+ Install
+}
--- /dev/null
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+#Requires -RunAsAdministrator
+
+#
+# Run this script on the Active Directory Domain Controller machine.
+# Tested on Windows 2016 TP5
+#
+
+Param (
+ [switch] $uninstall=$false
+)
+
+# Import configuration.
+. .\setup_common.ps1
+
+$script:COREFX_ROLE_NAME = "COREFX_NET_AD_DC"
+
+Function EnableAD
+{
+ Write-Host -ForegroundColor Cyan "Installing Active Directory."
+ CheckPreRebootMachineInfo
+
+ # From https://technet.microsoft.com/en-us/library/hh472162.aspx
+ Install-Windowsfeature -name AD-Domain-Services -IncludeManagementTools
+
+ # Will prompt for SafeModeAdministratorPassword:
+ Install-ADDSForest -domainname $script:domainName -DomainNetbiosName $script:domainNetbios -NoRebootOnCompletion
+}
+
+Function AddUser
+{
+ Write-Host -ForegroundColor Cyan "Creating domain user."
+ Remove-ADUser $script:domainUserName -Confirm:$false -ErrorAction SilentlyContinue | Out-Null
+ New-ADUser $script:domainUserName -Enabled $true -PasswordNeverExpires $true -AccountPassword (ConvertTo-SecureString $script:domainUserPassword -AsPlainText -force)
+}
+
+Function ConfigureDNS
+{
+ Write-Host -ForegroundColor Cyan "Configuring DNS."
+
+ # TODO: Extract IIS Machine IP from Config.
+ $iisServer = GetRole "COREFX_NET_IISSERVER"
+
+ $serverName = ($script:iisServerFQDN).Split('.')[0];
+ $zoneName = ($script:iisServerFQDN).Substring($serverName.Length + 1)
+
+ Remove-DnsServerZone -Name $zoneName -Force -ErrorAction SilentlyContinue | Out-Null
+ Add-DnsServerPrimaryZone -Name $zoneName -ReplicationScope "Forest"
+ Add-DnsServerResourceRecordA -Name $serverName -ZoneName $zoneName -AllowUpdateAny -IPv4Address $iisServer.MachineIP -TimeToLive 01:00:00
+}
+
+Function Install
+{
+ Write-Host -ForegroundColor Cyan "Installing prerequisites for test role: $($script:COREFX_ROLE_NAME)."
+
+ if ((-not (EnvironmentIsRoleInstalled)) -and (-not (EnvironmentIsRoleRebootPending)))
+ {
+ EnableAD
+ EnvironmentSetRebootPendingRoleStatus
+ Write-Host -ForegroundColor Cyan "Please re-start the script after the machine reboots."
+ Read-Host "[Press ENTER to reboot.]"
+ Restart-Computer
+ }
+ else
+ {
+ AddUser
+ ConfigureDNS
+ Enable-PSRemoting
+ EnvironmentSetInstalledRoleStatus
+ Write-Host -ForegroundColor Cyan "Prerequisites installed for $($script:COREFX_ROLE_NAME)."
+ Write-Host
+ }
+}
+
+Function Uninstall
+{
+ Write-Host -ForegroundColor Cyan "Removing prerequisites for test role: $($script:COREFX_ROLE_NAME)."
+
+ EnvironmentCheckUninstallRoleStatus
+ EnvironmentRemoveRoleStatus
+
+ # Will reboot.
+ Uninstall-ADDSDomainController -LastDomainControllerInDomain -RemoveApplicationPartitions -IgnoreLastDNSServerForZone
+}
+
+if ($uninstall)
+{
+ Uninstall
+}
+else
+{
+ Install
+}
--- /dev/null
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+#Requires -RunAsAdministrator
+
+# Certificate configuration
+
+$script:testDataUri = "https://github.com/dotnet/corefx-testdata/archive/master.zip"
+$script:testData = "corefx-testdata"
+$script:certificatePath = "$($script:testData)\corefx-testdata-master\System.Net.TestData"
+
+$script:clientPrivateKeyPath = Join-Path $script:certificatePath "testclient1_at_contoso.com.pfx"
+$script:clientPrivateKeyPassword = "testcertificate"
+
+$script:serverPrivateKeyPath = Join-Path $script:certificatePath "contoso.com.pfx"
+$script:serverPrivateKeyPassword = "testcertificate"
+
+Function GetFullPath($relativePath)
+{
+ return (Get-Item $relativePath).FullName
+}
+
+Function DeleteTestData
+{
+ if (Test-Path $script:testData)
+ {
+ rmdir $script:testData -Recurse -Force
+ }
+
+ del ($testData + ".zip") -ErrorAction SilentlyContinue
+}
+
+Function DownloadTestData
+{
+ DeleteTestData
+ DownloadFile $script:testDataUri ($testData + ".zip")
+ Expand-Archive ($testData + ".zip")
+}
+
+Function LoadCertificateAndRoot($fileName, $password)
+{
+ $privateCerts = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection
+ $fullPath = GetFullPath $fileName
+
+ $privateCerts.Import($fullPath, $password, ("MachineKeySet", "PersistKeySet", "Exportable"))
+
+ $privateKeyCert = $null
+ foreach ($cert in $privateCerts)
+ {
+ if ($privateKeyCert -eq $null -and $cert.HasPrivateKey)
+ {
+ $privateKeyCert = $cert
+ }
+ }
+
+ $rootCACert = $privateCerts | where {$_.Subject -eq $privateKeyCert.Issuer}
+
+ return ($privateKeyCert, $rootCACert)
+}
+
+Function AddCertificateToStore($certificate, $storeName, $storeLocation)
+{
+ $rootStore = New-Object System.Security.Cryptography.X509Certificates.X509Store($storeName, $storeLocation)
+ $rootStore.Open("ReadWrite")
+ $rootStore.Add($certificate)
+ $rootStore.Close()
+}
+
+Function InstallCertificates($fileName, $password)
+{
+ Write-Host "Acquiring test data."
+ DownloadTestData
+
+ Write-Host "Adding certificates"
+ ($private, $root) = LoadCertificateAndRoot $fileName $password
+
+ Write-Host -ForegroundColor DarkGray "`tAdding root certificate: $($root.Subject)"
+ AddCertificateToStore $root "Root" "LocalMachine"
+
+ Write-Host -ForegroundColor DarkGray "`tAdding private key certificate: $($private.Subject)"
+ AddCertificateToStore $private "My" "LocalMachine"
+
+ Write-Host "Removing temporary files"
+ DeleteTestData
+}
+
+Function InstallClientCertificates
+{
+ Write-Host -ForegroundColor Cyan "Installing Client Certificates"
+ InstallCertificates $script:clientPrivateKeyPath $script:clientPrivateKeyPassword
+}
+
+Function InstallServerCertificates
+{
+ Write-Host -ForegroundColor Cyan "Installing Server Certificates"
+ InstallCertificates $script:serverPrivateKeyPath $script:serverPrivateKeyPassword
+}
+
+Function GetServerCertificate
+{
+ return dir Cert:\LocalMachine\My | where { $_.DnsNameList | where{$_.Punycode -eq $script:iisServerFQDN} }
+}
+
+Function RemoveCertificates($filename, $password)
+{
+ Write-Host "Acquiring test data."
+ DownloadTestData
+ ($private, $root) = LoadCertificateAndRoot $fileName $password
+
+ Write-Host -ForegroundColor DarkGray "`tRemoving root certificate: $($root.Subject)"
+ dir Cert:\LocalMachine\Root | where {$_.Subject -eq $root.Subject} | foreach { rm (Join-Path Cert:\LocalMachine\Root $_.Thumbprint) }
+ Write-Host -ForegroundColor DarkGray "`tRemoving private key certificate: $($private.Subject)"
+ dir Cert:\LocalMachine\My | where {$_.Subject -eq $private.Subject} | foreach { rm (Join-Path Cert:\LocalMachine\My $_.Thumbprint) -DeleteKey }
+
+ DeleteTestData
+}
+
+Function RemoveClientCertificates
+{
+ Write-Host -ForegroundColor Cyan "Removing Client Certificates"
+ RemoveCertificates $script:clientPrivateKeyPath $script:clientPrivateKeyPassword
+}
+
+Function RemoveServerCertificates
+{
+ Write-Host -ForegroundColor Cyan "Removing Server Certificates"
+ RemoveCertificates $script:serverPrivateKeyPath $script:serverPrivateKeyPassword
+}
\ No newline at end of file
--- /dev/null
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Param (
+ [switch] $uninstall=$false
+)
+
+# Imports:
+. .\setup_common.ps1
+. .\setup_certificates.ps1
+
+$script:COREFX_ROLE_NAME = "COREFX_NET_CLIENT"
+
+Function InstallClientEnvironmentConfiguration
+{
+ Write-Host -ForegroundColor Cyan "Installing client configuration."
+
+ foreach ($configEntry in $script:ClientConfiguration)
+ {
+ [Environment]::SetEnvironmentVariable($configEntry.Name, $configEntry.Value, "Machine")
+ }
+}
+
+Function UninstallClientEnvironmentConfiguration
+{
+ Write-Host -ForegroundColor Cyan "Removing client configuration."
+
+ foreach ($configEntry in $script:ClientConfiguration)
+ {
+ [Environment]::SetEnvironmentVariable($configEntry.Name, $null, "Machine")
+ }
+}
+
+Function Install
+{
+ Write-Host -ForegroundColor Cyan "Installing prerequisites for test role: $($script:COREFX_ROLE_NAME)."
+ CheckMachineInfo
+
+ InstallClientCertificates
+ InstallClientEnvironmentConfiguration
+
+ EnvironmentSetInstalledRoleStatus
+}
+
+Function Uninstall
+{
+ Write-Host -ForegroundColor Cyan "Removing prerequisites for test role: $($script:COREFX_ROLE_NAME)."
+ EnvironmentCheckUninstallRoleStatus
+
+ RemoveClientCertificates
+ UninstallClientEnvironmentConfiguration
+
+ EnvironmentRemoveRoleStatus
+}
+
+if ($uninstall)
+{
+ Uninstall
+}
+else
+{
+ Install
+}
--- /dev/null
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+. .\config.ps1
+
+Function GetRoleForMachine($machineName)
+{
+ return $script:Roles | where {$_.MachineName.ToUpper() -eq $machineName.ToUpper()}
+}
+
+Function GetPreRebootRoleForMachine($machineName)
+{
+ return $script:PreRebootRoles | where {$_.MachineName.ToUpper() -eq $machineName.ToUpper()}
+}
+
+Function GetRole($roleName)
+{
+ return $script:Roles | where {$_.Name.ToUpper() -eq $roleName.ToUpper()}
+}
+
+Function CheckPreRebootMachineInfo
+{
+ $role = GetPreRebootRoleForMachine $Env:COMPUTERNAME
+
+ if ($role.Name -ne $script:COREFX_ROLE_NAME)
+ {
+ throw "This script needs to run on machines part of the $($role.Name) role."
+ }
+
+ if ((-not [string]::IsNullOrWhiteSpace($role.MachineIP)) -and ((Get-NetIPAddress | where {$_.IPAddress -eq $role.MachineIP}).Count -eq 0))
+ {
+ throw "The current machine doesn't have the expected Static IP address: $($role.MachineIP)"
+ }
+}
+
+Function CheckMachineInfo
+{
+ $role = GetRoleForMachine $Env:COMPUTERNAME
+
+ if ($role.Name -ne $script:COREFX_ROLE_NAME)
+ {
+ throw "This script needs to run on machines part of the $($role.Name) role."
+ }
+
+ if ((-not [string]::IsNullOrWhiteSpace($role.MachineIP)) -and ((Get-NetIPAddress | where {$_.IPAddress -eq $role.MachineIP}).Count -eq 0))
+ {
+ throw "The current machine doesn't have the expected Static IP address: $($role.MachineIP)"
+ }
+}
+
+Function EnvironmentAddRoleStatus($status)
+{
+ [Environment]::SetEnvironmentVariable($script:COREFX_ROLE_NAME, $status, "Machine")
+}
+
+Function EnvironmentSetInstalledRoleStatus
+{
+ EnvironmentAddRoleStatus "Installed"
+}
+
+Function EnvironmentSetRebootPendingRoleStatus
+{
+ EnvironmentAddRoleStatus "PendingReboot"
+}
+
+Function EnvironmentRemoveRoleStatus
+{
+ [Environment]::SetEnvironmentVariable($script:COREFX_ROLE_NAME, $null, "Machine")
+}
+
+Function EnvironmentCheckUninstallRoleStatus
+{
+ if ([Environment]::GetEnvironmentVariable($script:COREFX_ROLE_NAME, "Machine") -ne "Installed")
+ {
+ Write-Warning "The machine doesn't appear to be in the $($script:COREFX_ROLE_NAME) role."
+ $continue = Read-Host "Do you want to continue? [Y/N]"
+ if ($continue.ToUpper() -ne "Y")
+ {
+ Write-Warning "Aborted by user."
+ exit
+ }
+ }
+}
+
+Function EnvironmentIsRoleRebootPending
+{
+ return [Environment]::GetEnvironmentVariable($script:COREFX_ROLE_NAME, "Machine") -eq "PendingReboot"
+}
+
+Function EnvironmentIsRoleInstalled
+{
+ return [Environment]::GetEnvironmentVariable($script:COREFX_ROLE_NAME, "Machine") -eq "Installed"
+}
+
+Function DownloadFile($source, $destination)
+{
+ # BITS remoting doesn't work on systems <= TH2.
+ if ([System.Environment]::OSVersion.Version -gt (new-object 'Version' 10,0,10586,0))
+ {
+ Start-BitsTransfer -Source $source -Destination $destination
+ }
+ else
+ {
+ # BUG: taking very long: Invoke-WebRequest $source -OutFile $destination
+ $fqDestination = Join-Path (pwd) $destination
+ $wc = New-Object System.Net.WebClient
+ $wc.Downloadfile($source, $fqDestination.ToString())
+ }
+}
--- /dev/null
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+#Requires -RunAsAdministrator
+
+# Firewall configuration
+$script:firewallGroup = "CoreFX Testing"
+$script:firewallRules = @(
+ @{Name = "CoreFXNet - HTTP 80"; Port = 80},
+ @{Name = "CoreFXNet - HTTP 443"; Port = 443}
+)
+
+Function InstallServerFirewall
+{
+ Write-Host -ForegroundColor Cyan "Installing Firewall rules."
+ foreach ($rule in $script:firewallRules)
+ {
+ Write-Host -ForegroundColor DarkGray "`t" $rule.Name
+ New-NetFirewallRule -DisplayName $rule.Name -Group $script:firewallGroup -Direction Inbound -Protocol TCP -LocalPort $rule.Port -Action Allow | Out-Null
+ }
+}
+
+Function RemoveServerFirewall
+{
+ Write-Host -ForegroundColor Cyan "Removing Firewall rules."
+ foreach ($rule in $script:firewallRules)
+ {
+ Write-Host -ForegroundColor DarkGray "`t" $rule.Name
+ Remove-NetFirewallRule -DisplayName $rule.Name | Out-Null
+ }
+}
--- /dev/null
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+#Requires -RunAsAdministrator
+
+#
+# Run this script on the IIS server machine.
+# Tested on Windows 2016 TP5
+#
+
+Param (
+ [switch] $uninstall=$false
+)
+
+# Imports:
+. .\setup_common.ps1
+. .\setup_certificates.ps1
+. .\setup_firewall.ps1
+
+# Server application configuration
+$script:serverCodeUri = "https://github.com/davidsh/corefx-net-testservers/archive/master.zip"
+$script:serverCodeZip = "serverCode"
+$script:iisWwwRoot = "$env:systemdrive\inetpub\wwwroot"
+$script:serverCodeRootPath = "$($script:serverCodeZip)\corefx-net-testservers-master\CoreFxNetCloudService"
+$script:defaultWebSite = "Default Web Site"
+
+$script:webApps = @(
+ @{Name = "NoAuth";
+ IISRelativePath = "";
+ SourceRelativePath = "WebServer";
+
+ Configuration = @()
+ },
+
+ @{Name = "BasicAuth";
+ IISRelativePath = "BasicAuth";
+ SourceRelativePath = "WebServer";
+ Configuration = @(
+ @{ Path = "/system.webServer/security/authentication/anonymousAuthentication"; Name = "Enabled"; Value = "False" }
+ @{ Path = "/system.webServer/security/authentication/basicAuthentication"; Name = "Enabled"; Value = "True" }
+ );
+ UserAccess = @( $script:basicUserName )
+ },
+
+ @{Name = "DigestAuth";
+ IISRelativePath = "DigestAuth";
+ SourceRelativePath = "WebServer";
+ Configuration = @(
+ @{ Path = "/system.webServer/security/authentication/anonymousAuthentication"; Name = "Enabled"; Value = "False" }
+ @{ Path = "/system.webServer/security/authentication/digestAuthentication"; Name = "Enabled"; Value = "True" }
+ );
+ UserAccess = @( $script:basicUserName )
+ },
+
+ @{Name = "WindowsAuth";
+ IISRelativePath = "WindowsAuth";
+ SourceRelativePath = "WebServer";
+ Configuration = @(
+ @{ Path = "/system.webServer/security/authentication/anonymousAuthentication"; Name = "Enabled"; Value = "False" }
+ @{ Path = "/system.webServer/security/authentication/windowsAuthentication"; Name = "Enabled"; Value = "True" }
+ );
+ UserAccess = @( "$($script:domainNetbios)\$($script:domainUserName)" )
+ }
+)
+
+$script:COREFX_ROLE_NAME = "COREFX_NET_IISSERVER"
+
+Function InstallIIS
+{
+ Write-Host -ForegroundColor Cyan "Installing IIS components."
+ Install-WindowsFeature -Name Web-Server,Web-Basic-Auth,Web-Digest-Auth,Web-Windows-Auth,Web-Cert-Auth,Web-Asp-Net45,Web-WebSockets -IncludeManagementTools -ErrorAction Stop | Out-Null
+}
+
+Function RemoveIIS
+{
+ Write-Host -ForegroundColor Cyan "Removing IIS components."
+ Uninstall-WindowsFeature -Name Web-Server -IncludeManagementTools
+}
+
+Function CreateLocalUser
+{
+ # A local user is required to allow Basic and Digest authentication. (WDigest not supported.)
+ Write-Host -ForegroundColor Cyan "Creating local user account."
+ Remove-LocalUser $script:basicUserName -Confirm:$false -ErrorAction SilentlyContinue
+ New-LocalUser $script:basicUserName -PasswordNeverExpires -Password (ConvertTo-SecureString $script:basicUserPassword -AsPlainText -force) | Out-Null
+}
+
+Function RemoveLocalUser
+{
+ Write-Host -ForegroundColor Cyan "Removing local user account."
+ Remove-LocalUser $script:basicUserName -Confirm:$false
+}
+
+Function DeleteTemporaryFiles
+{
+ if (Test-Path $script:serverCodeZip)
+ {
+ rmdir $script:serverCodeZip -Recurse -Force
+ }
+
+ del ($script:serverCodeZip + ".zip") -ErrorAction SilentlyContinue
+}
+
+Function DownloadServerCode
+{
+ DeleteTemporaryFiles
+ DownloadFile $script:serverCodeUri ($script:serverCodeZip + ".zip")
+ Expand-Archive ($script:serverCodeZip + ".zip")
+}
+
+Function ConfigureWebSites
+{
+ Write-Host -ForegroundColor Cyan "Configuring IIS websites."
+
+ # SSL Bindings
+ $sslCert = GetServerCertificate
+
+ Get-WebBinding -Port 443 -Name $script:defaultWebSite | Remove-WebBinding
+ New-WebBinding -Name $script:defaultWebSite -Protocol https -Port 443
+
+ Remove-Item -Path "IIS:\SslBindings\*"
+ New-Item -Path "IIS:\SslBindings\0.0.0.0!443" -Value $sslCert -Force | Out-Null
+}
+
+Function GrantUserAccess($path, $userAccess)
+{
+ foreach ($user in $userAccess)
+ {
+ $acl = Get-Acl $path
+ $ar = New-Object System.Security.AccessControl.FileSystemAccessRule($user, "ReadAndExecute", "Allow")
+ $acl.SetAccessRule($ar)
+ Set-Acl $path $acl
+ }
+}
+
+Function InstallServerCode
+{
+ Write-Host -ForegroundColor Cyan "Acquiring server code."
+ DownloadServerCode
+
+ Write-Host -ForegroundColor Cyan "Installing applications."
+
+ foreach ($app in $script:webApps)
+ {
+ Write-Host -ForegroundColor DarkGray "`tInstalling webApp: $($app.Name)"
+
+ $appPath = Join-Path $script:iisWwwRoot $app.IISRelativePath
+
+ if ($(Get-WebApplication $app.Name) -ne $null)
+ {
+ Write-Host "`tRemoving $($app.Name)"
+ Remove-WebApplication -Site $script:defaultWebSite -Name $app.Name
+ Remove-Item ($appPath + "\*") -Recurse -Force -ErrorAction SilentlyContinue
+ }
+
+ Write-Host "`tAdding $($app.Name)"
+
+ $tempPath = Join-Path $script:serverCodeRootPath $app.SourceRelativePath
+ mkdir $appPath -ErrorAction SilentlyContinue | Out-Null
+ Copy-Item ($tempPath + "\*") $appPath -Recurse -ErrorAction Stop
+
+ New-WebApplication -Site $script:defaultWebSite -Name $app.Name -PhysicalPath $appPath | Out-Null
+
+ foreach ($config in $app.Configuration)
+ {
+ Set-WebConfigurationProperty -Filter $config.Path -Name $config.Name -Value $config.Value -PSPath IIS:\ -location "$($script:defaultWebSite)/$($app.Name)" -ErrorAction Stop
+ }
+
+ GrantUserAccess $appPath $app.UserAccess
+ }
+
+ Write-Host "Removing temporary files."
+ DeleteTemporaryFiles
+}
+
+Function RemoveServerCode
+{
+ Write-Host -ForegroundColor Cyan "Removing server code."
+ foreach ($app in $script:webApps)
+ {
+ Write-Host -ForegroundColor DarkGray "`tRemoving webApp files: $($app.Name)"
+ $appPath = Join-Path $script:iisWwwRoot $app.IISRelativePath
+ rmdir -Recurse -Force $appPath -ErrorAction SilentlyContinue
+ }
+}
+
+Function Install
+{
+ Write-Host -ForegroundColor Cyan "Installing prerequisites for test role: $($script:COREFX_ROLE_NAME)"
+ CheckMachineInfo
+
+ InstallIIS
+ InstallServerCertificates
+ CreateLocalUser
+ ConfigureWebSites
+ InstallServerCode
+ InstallServerFirewall
+
+ EnvironmentSetInstalledRoleStatus
+ # TODO:
+ # - Grant AD user permissions for all auth methods and sites.
+}
+
+Function Uninstall
+{
+ Write-Host -ForegroundColor Cyan "Removing prerequisites for test role: $($script:COREFX_ROLE_NAME)"
+
+ EnvironmentCheckUninstallRoleStatus
+
+ RemoveServerFirewall
+ RemoveIIS
+ RemoveServerCertificates
+ RemoveLocalUser
+ RemoveServerCode
+
+ EnvironmentRemoveRoleStatus
+}
+
+if ($uninstall)
+{
+ Uninstall
+}
+else
+{
+ Install
+}
public static bool IsDomainAvailable()
{
- return !string.IsNullOrWhiteSpace(Configuration.ActiveDirectoryName);
+ return !string.IsNullOrWhiteSpace(Configuration.Security.ActiveDirectoryName);
}
public static bool IsNegotiateServerAvailable()
{
- return !(Configuration.NegotiateServer == null);
+ return !(Configuration.Security.NegotiateServer == null);
}
private static bool InitializeTrustedRootCertificateCapability()
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-
-using Xunit;
-
-namespace System.Net.Tests
-{
- internal static class CertificateConfiguration
- {
- private const string CertificatePassword = "testcertificate";
- private const string TestDataFolder = "TestData";
-
- public static X509Certificate2 GetServerCertificate() => GetCertWithPrivateKey(GetServerCertificateCollection());
-
- public static X509Certificate2 GetClientCertificate() => GetCertWithPrivateKey(GetClientCertificateCollection());
-
- public static X509Certificate2Collection GetServerCertificateCollection() => GetCertificateCollection("contoso.com.pfx");
-
- public static X509Certificate2Collection GetClientCertificateCollection() => GetCertificateCollection("testclient1_at_contoso.com.pfx");
-
- private static X509Certificate2Collection GetCertificateCollection(string certificateFileName)
- {
- var certCollection = new X509Certificate2Collection();
- certCollection.Import(Path.Combine(TestDataFolder, certificateFileName), CertificatePassword, X509KeyStorageFlags.DefaultKeySet);
- return certCollection;
- }
-
- private static X509Certificate2 GetCertWithPrivateKey(X509Certificate2Collection certCollection)
- {
- X509Certificate2 certificate = null;
-
- foreach (X509Certificate2 c in certCollection)
- {
- if (certificate == null && c.HasPrivateKey)
- {
- certificate = c;
- }
- else
- {
- c.Dispose();
- }
- }
-
- Assert.NotNull(certificate);
- return certificate;
- }
- }
-}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+
+using Xunit;
+
+namespace System.Net.Test.Common
+{
+ public static partial class Configuration
+ {
+ public static partial class Certificates
+ {
+ private const string CertificatePassword = "testcertificate";
+ private const string TestDataFolder = "TestData";
+
+ public static X509Certificate2 GetServerCertificate() => GetCertWithPrivateKey(GetServerCertificateCollection());
+
+ public static X509Certificate2 GetClientCertificate() => GetCertWithPrivateKey(GetClientCertificateCollection());
+
+ public static X509Certificate2Collection GetServerCertificateCollection() => GetCertificateCollection("contoso.com.pfx");
+
+ public static X509Certificate2Collection GetClientCertificateCollection() => GetCertificateCollection("testclient1_at_contoso.com.pfx");
+
+ private static X509Certificate2Collection GetCertificateCollection(string certificateFileName)
+ {
+ var certCollection = new X509Certificate2Collection();
+ certCollection.Import(Path.Combine(TestDataFolder, certificateFileName), CertificatePassword, X509KeyStorageFlags.DefaultKeySet);
+ return certCollection;
+ }
+
+ private static X509Certificate2 GetCertWithPrivateKey(X509Certificate2Collection certCollection)
+ {
+ X509Certificate2 certificate = null;
+
+ foreach (X509Certificate2 c in certCollection)
+ {
+ if (certificate == null && c.HasPrivateKey)
+ {
+ certificate = c;
+ }
+ else
+ {
+ c.Dispose();
+ }
+ }
+
+ Assert.NotNull(certificate);
+ return certificate;
+ }
+ }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Net.Test.Common
+{
+ public static partial class Configuration
+ {
+ public static partial class Http
+ {
+ private readonly static string DefaultAzureServer = "corefx-net.cloudapp.net";
+
+ public static string Host => GetValue("COREFX_HTTPHOST", DefaultAzureServer);
+
+ public static string SecureHost => GetValue("COREFX_SECUREHTTPHOST", DefaultAzureServer);
+
+ public static string Http2Host => GetValue("COREFX_HTTP2HOST", "http2.akamai.com");
+
+ public static string DomainJoinedHttpHost => GetValue("COREFX_DOMAINJOINED_HTTPHOST");
+
+ public static string DomainJoinedProxyHost => GetValue("COREFX_DOMAINJOINED_PROXYHOST");
+
+ public static string DomainJoinedProxyPort => GetValue("COREFX_DOMAINJOINED_PROXYPORT");
+
+ public static bool StressEnabled => GetValue("COREFX_STRESS_HTTP", "0") == "1";
+
+ public static string SSLv2RemoteServer => GetValue("COREFX_HTTPHOST_SSL2", "https://www.ssllabs.com:10200/");
+ public static string SSLv3RemoteServer => GetValue("COREFX_HTTPHOST_SSL3", "https://www.ssllabs.com:10300/");
+ public static string TLSv10RemoteServer => GetValue("COREFX_HTTPHOST_TLS10", "https://www.ssllabs.com:10301/");
+ public static string TLSv11RemoteServer => GetValue("COREFX_HTTPHOST_TLS11", "https://www.ssllabs.com:10302/");
+ public static string TLSv12RemoteServer => GetValue("COREFX_HTTPHOST_TLS12", "https://www.ssllabs.com:10303/");
+
+ public static string ExpiredCertRemoteServer => GetValue("COREFX_HTTPHOST_EXPIREDCERT", "https://expired.badssl.com/");
+ public static string WrongHostNameCertRemoteServer => GetValue("COREFX_HTTPHOST_WRONGHOSTNAME", "https://wrong.host.badssl.com/");
+ public static string SelfSignedCertRemoteServer => GetValue("COREFX_HTTPHOST_SELFSIGNEDCERT", "https://self-signed.badssl.com/");
+ public static string RevokedCertRemoteServer => GetValue("COREFX_HTTPHOST_REVOKEDCERT", "https://revoked.grc.com/");
+
+ private const string HttpScheme = "http";
+ private const string HttpsScheme = "https";
+
+ private const string EchoHandler = "Echo.ashx";
+ private const string EmptyContentHandler = "EmptyContent.ashx";
+ private const string StatusCodeHandler = "StatusCode.ashx";
+ private const string RedirectHandler = "Redirect.ashx";
+ private const string VerifyUploadHandler = "VerifyUpload.ashx";
+ private const string DeflateHandler = "Deflate.ashx";
+ private const string GZipHandler = "GZip.ashx";
+
+ public readonly static Uri RemoteEchoServer = new Uri("http://" + Host + "/" + EchoHandler);
+ public readonly static Uri SecureRemoteEchoServer = new Uri("https://" + SecureHost + "/" + EchoHandler);
+
+ public readonly static Uri RemoteVerifyUploadServer = new Uri("http://" + Host + "/" + VerifyUploadHandler);
+ public readonly static Uri SecureRemoteVerifyUploadServer = new Uri("https://" + SecureHost + "/" + VerifyUploadHandler);
+
+ public readonly static Uri RemoteEmptyContentServer = new Uri("http://" + Host + "/" + EmptyContentHandler);
+ public readonly static Uri RemoteDeflateServer = new Uri("http://" + Host + "/" + DeflateHandler);
+ public readonly static Uri RemoteGZipServer = new Uri("http://" + Host + "/" + GZipHandler);
+
+ public readonly static object[][] EchoServers = { new object[] { RemoteEchoServer }, new object[] { SecureRemoteEchoServer } };
+ public readonly static object[][] VerifyUploadServers = { new object[] { RemoteVerifyUploadServer }, new object[] { SecureRemoteVerifyUploadServer } };
+ public readonly static object[][] CompressedServers = { new object[] { RemoteDeflateServer }, new object[] { RemoteGZipServer } };
+ public readonly static object[][] Http2Servers = { new object[] { new Uri("https://" + Http2Host) } };
+
+ public static Uri NegotiateAuthUriForDefaultCreds(bool secure)
+ {
+ return new Uri(
+ string.Format(
+ "{0}://{1}/{2}?auth=negotiate",
+ secure ? HttpsScheme : HttpScheme,
+ Host,
+ EchoHandler));
+ }
+
+ public static Uri BasicAuthUriForCreds(bool secure, string userName, string password)
+ {
+ return new Uri(
+ string.Format(
+ "{0}://{1}/{2}?auth=basic&user={3}&password={4}",
+ secure ? HttpsScheme : HttpScheme,
+ Host,
+ EchoHandler,
+ userName,
+ password));
+ }
+
+ public static Uri StatusCodeUri(bool secure, int statusCode)
+ {
+ return new Uri(
+ string.Format(
+ "{0}://{1}/{2}?statuscode={3}",
+ secure ? HttpsScheme : HttpScheme,
+ Host,
+ StatusCodeHandler,
+ statusCode));
+ }
+
+ public static Uri StatusCodeUri(bool secure, int statusCode, string statusDescription)
+ {
+ return new Uri(
+ string.Format(
+ "{0}://{1}/{2}?statuscode={3}&statusDescription={4}",
+ secure ? HttpsScheme : HttpScheme,
+ Host,
+ StatusCodeHandler,
+ statusCode,
+ statusDescription));
+ }
+
+ public static Uri RedirectUriForDestinationUri(bool secure, int statusCode, Uri destinationUri, int hops, bool relative = false)
+ {
+ string uriString;
+ string destination = Uri.EscapeDataString(relative ? destinationUri.PathAndQuery : destinationUri.AbsoluteUri);
+
+ if (hops > 1)
+ {
+ uriString = string.Format("{0}://{1}/{2}?statuscode={3}&uri={4}&hops={5}",
+ secure ? HttpsScheme : HttpScheme,
+ Host,
+ RedirectHandler,
+ statusCode,
+ destination,
+ hops);
+ }
+ else
+ {
+ uriString = string.Format("{0}://{1}/{2}?statuscode={3}&uri={4}",
+ secure ? HttpsScheme : HttpScheme,
+ Host,
+ RedirectHandler,
+ statusCode,
+ destination);
+ }
+
+ return new Uri(uriString);
+ }
+
+ public static Uri RedirectUriForCreds(bool secure, int statusCode, string userName, string password)
+ {
+ Uri destinationUri = BasicAuthUriForCreds(secure, userName, password);
+ string destination = Uri.EscapeDataString(destinationUri.AbsoluteUri);
+
+ return new Uri(string.Format("{0}://{1}/{2}?statuscode={3}&uri={4}",
+ secure ? HttpsScheme : HttpScheme,
+ Host,
+ RedirectHandler,
+ statusCode,
+ destination));
+ }
+ }
+ }
+}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System.Text;
-
namespace System.Net.Test.Common
{
public static partial class Configuration
{
- public static string ActiveDirectoryName => GetValue("COREFX_NET_AD_DOMAINNAME");
+ public static partial class Security
+ {
+ private readonly static string DefaultAzureServer = "corefx-net.cloudapp.net";
+
+ public static string ActiveDirectoryName => GetValue("COREFX_NET_AD_DOMAINNAME");
+
+ public static string ActiveDirectoryUserName => GetValue("COREFX_NET_AD_USERNAME");
- public static string ActiveDirectoryUserName => GetValue("COREFX_NET_AD_USERNAME");
+ public static string ActiveDirectoryUserPassword => GetValue("COREFX_NET_AD_PASSWORD");
- public static string ActiveDirectoryUserPassword => GetValue("COREFX_NET_AD_PASSWORD");
+ public static Uri TlsServer => GetUriValue("COREFX_NET_SECURITY_TLSSERVERURI", new Uri("https://" + DefaultAzureServer));
- public static Uri NegotiateServer => GetUriValue("COREFX_NET_NEGO_SERVER");
+ public static Uri NegotiateServer => GetUriValue("COREFX_NET_SECURITY_NEGOSERVERURI");
+ }
}
}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Net.Sockets;
+
+namespace System.Net.Test.Common
+{
+ public static partial class Configuration
+ {
+ public static partial class Sockets
+ {
+ public static Uri SocketServer => GetUriValue("COREFX_NET_SOCKETS_SERVERURI", new Uri("http://" + DefaultAzureServer));
+ }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Net.Test.Common
+{
+ public static partial class Configuration
+ {
+ public static partial class WebSockets
+ {
+ public static string Host => GetValue("COREFX_WEBSOCKETHOST", DefaultAzureServer);
+
+ public static string SecureHost => GetValue("COREFX_SECUREWEBSOCKETHOST", DefaultAzureServer);
+
+ private const string EchoHandler = "WebSocket/EchoWebSocket.ashx";
+ private const string EchoHeadersHandler = "WebSocket/EchoWebSocketHeaders.ashx";
+
+ public readonly static Uri RemoteEchoServer = new Uri("ws://" + Host + "/" + EchoHandler);
+ public readonly static Uri SecureRemoteEchoServer = new Uri("wss://" + SecureHost + "/" + EchoHandler);
+
+ public readonly static Uri RemoteEchoHeadersServer = new Uri("ws://" + Host + "/" + EchoHeadersHandler);
+ public readonly static Uri SecureRemoteEchoHeadersServer = new Uri("wss://" + SecureHost + "/" + EchoHeadersHandler);
+
+ public readonly static object[][] EchoServers = { new object[] { RemoteEchoServer }, new object[] { SecureRemoteEchoServer } };
+ public readonly static object[][] EchoHeadersServers = { new object[] { RemoteEchoHeadersServer }, new object[] { SecureRemoteEchoHeadersServer } };
+ }
+ }
+}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-
namespace System.Net.Test.Common
{
public static partial class Configuration
{
+ #pragma warning disable 414
+ private readonly static string DefaultAzureServer = "corefx-net.cloudapp.net";
+ #pragma warning restore 414
+
private static string GetValue(string envName, string defaultValue=null)
{
string envValue = Environment.GetEnvironmentVariable(envName);
using System.Net.NetworkInformation;
using System.Net.Security;
using System.Net.Sockets;
-using System.Net.Tests;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Text;
if (options.UseSsl)
{
var sslStream = new SslStream(stream, false, delegate { return true; });
- using (var cert = CertificateConfiguration.GetServerCertificate())
+ using (var cert = Configuration.Certificates.GetServerCertificate())
{
await sslStream.AuthenticateAsServerAsync(
cert,
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Net.Test.Common
-{
- internal class HttpTestServers
- {
- public readonly static string Host = TestSettings.Http.Host;
- public readonly static string SecureHost = TestSettings.Http.SecureHost;
- public readonly static string Http2Host = TestSettings.Http.Http2Host;
-
- public const string SSLv2RemoteServer = "https://www.ssllabs.com:10200/";
- public const string SSLv3RemoteServer = "https://www.ssllabs.com:10300/";
- public const string TLSv10RemoteServer = "https://www.ssllabs.com:10301/";
- public const string TLSv11RemoteServer = "https://www.ssllabs.com:10302/";
- public const string TLSv12RemoteServer = "https://www.ssllabs.com:10303/";
-
- public const string ExpiredCertRemoteServer = "https://expired.badssl.com/";
- public const string WrongHostNameCertRemoteServer = "https://wrong.host.badssl.com/";
- public const string SelfSignedCertRemoteServer = "https://self-signed.badssl.com/";
- public const string RevokedCertRemoteServer = "https://revoked.grc.com/";
-
- private const string HttpScheme = "http";
- private const string HttpsScheme = "https";
-
- private const string EchoHandler = "Echo.ashx";
- private const string EmptyContentHandler = "EmptyContent.ashx";
- private const string StatusCodeHandler = "StatusCode.ashx";
- private const string RedirectHandler = "Redirect.ashx";
- private const string VerifyUploadHandler = "VerifyUpload.ashx";
- private const string DeflateHandler = "Deflate.ashx";
- private const string GZipHandler = "GZip.ashx";
-
- public readonly static Uri RemoteEchoServer = new Uri("http://" + Host + "/" + EchoHandler);
- public readonly static Uri SecureRemoteEchoServer = new Uri("https://" + SecureHost + "/" + EchoHandler);
-
- public readonly static Uri RemoteVerifyUploadServer = new Uri("http://" + Host + "/" + VerifyUploadHandler);
- public readonly static Uri SecureRemoteVerifyUploadServer = new Uri("https://" + SecureHost + "/" + VerifyUploadHandler);
-
- public readonly static Uri RemoteEmptyContentServer = new Uri("http://" + Host + "/" + EmptyContentHandler);
- public readonly static Uri RemoteDeflateServer = new Uri("http://" + Host + "/" + DeflateHandler);
- public readonly static Uri RemoteGZipServer = new Uri("http://" + Host + "/" + GZipHandler);
-
- public readonly static object[][] EchoServers = { new object[] { RemoteEchoServer }, new object[] { SecureRemoteEchoServer } };
- public readonly static object[][] VerifyUploadServers = { new object[] { RemoteVerifyUploadServer }, new object[] { SecureRemoteVerifyUploadServer } };
- public readonly static object[][] CompressedServers = { new object[] { RemoteDeflateServer }, new object[] { RemoteGZipServer } };
- public readonly static object[][] Http2Servers = { new object[] { new Uri("https://" + Http2Host) } };
-
- public static Uri NegotiateAuthUriForDefaultCreds(bool secure)
- {
- return new Uri(
- string.Format(
- "{0}://{1}/{2}?auth=negotiate",
- secure ? HttpsScheme : HttpScheme,
- Host,
- EchoHandler));
- }
-
- public static Uri BasicAuthUriForCreds(bool secure, string userName, string password)
- {
- return new Uri(
- string.Format(
- "{0}://{1}/{2}?auth=basic&user={3}&password={4}",
- secure ? HttpsScheme : HttpScheme,
- Host,
- EchoHandler,
- userName,
- password));
- }
-
- public static Uri StatusCodeUri(bool secure, int statusCode)
- {
- return new Uri(
- string.Format(
- "{0}://{1}/{2}?statuscode={3}",
- secure ? HttpsScheme : HttpScheme,
- Host,
- StatusCodeHandler,
- statusCode));
- }
-
- public static Uri StatusCodeUri(bool secure, int statusCode, string statusDescription)
- {
- return new Uri(
- string.Format(
- "{0}://{1}/{2}?statuscode={3}&statusDescription={4}",
- secure ? HttpsScheme : HttpScheme,
- Host,
- StatusCodeHandler,
- statusCode,
- statusDescription));
- }
-
- public static Uri RedirectUriForDestinationUri(bool secure, int statusCode, Uri destinationUri, int hops, bool relative = false)
- {
- string uriString;
- string destination = Uri.EscapeDataString(relative ? destinationUri.PathAndQuery : destinationUri.AbsoluteUri);
-
- if (hops > 1)
- {
- uriString = string.Format("{0}://{1}/{2}?statuscode={3}&uri={4}&hops={5}",
- secure ? HttpsScheme : HttpScheme,
- Host,
- RedirectHandler,
- statusCode,
- destination,
- hops);
- }
- else
- {
- uriString = string.Format("{0}://{1}/{2}?statuscode={3}&uri={4}",
- secure ? HttpsScheme : HttpScheme,
- Host,
- RedirectHandler,
- statusCode,
- destination);
- }
-
- return new Uri(uriString);
- }
-
- public static Uri RedirectUriForCreds(bool secure, int statusCode, string userName, string password)
- {
- Uri destinationUri = BasicAuthUriForCreds(secure, userName, password);
- string destination = Uri.EscapeDataString(destinationUri.AbsoluteUri);
-
- return new Uri(string.Format("{0}://{1}/{2}?statuscode={3}&uri={4}",
- secure ? HttpsScheme : HttpScheme,
- Host,
- RedirectHandler,
- statusCode,
- destination));
- }
- }
-}
}
_log.WriteLine(this.GetHashCode() + " StartAccept(_numConnectedSockets={0})", _numConnectedSockets);
- Assert.True(_maxNumberAcceptedClientsSemaphore.WaitOne(Configuration.PassingTestTimeout), "Timeout waiting for client connection.");
+ Assert.True(_maxNumberAcceptedClientsSemaphore.WaitOne(TestSettings.PassingTestTimeout), "Timeout waiting for client connection.");
if (_listenSocket == null)
{
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System.Net.Sockets;
-
namespace System.Net.Sockets.Tests
{
- public static class Configuration
+ public static class TestSettings
{
// Timeout values in milliseconds.
public const int PassingTestTimeout = 5000;
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Net.Test.Common
-{
- internal static class TestSettings
- {
- public static class Http
- {
- public static string Host
- {
- get
- {
- string server = Environment.GetEnvironmentVariable("COREFX_HTTPHOST");
- if (string.IsNullOrEmpty(server))
- {
- return "corefx-net.cloudapp.net";
- }
- else
- {
- return server;
- }
- }
- }
-
- public static string SecureHost
- {
- get
- {
- string server = Environment.GetEnvironmentVariable("COREFX_SECUREHTTPHOST");
- if (string.IsNullOrEmpty(server))
- {
- return "corefx-net.cloudapp.net";
- }
- else
- {
- return server;
- }
- }
- }
-
- public static string Http2Host
- {
- get
- {
- string server = Environment.GetEnvironmentVariable("COREFX_HTTP2HOST");
- if (string.IsNullOrEmpty(server))
- {
- return "http2.akamai.com";
- }
- else
- {
- return server;
- }
- }
- }
-
- public static string DomainJoinedHttpHost => Environment.GetEnvironmentVariable("COREFX_DOMAINJOINED_HTTPHOST");
- public static string DomainJoinedProxyHost => Environment.GetEnvironmentVariable("COREFX_DOMAINJOINED_PROXYHOST");
- public static string DomainJoinedProxyPort => Environment.GetEnvironmentVariable("COREFX_DOMAINJOINED_PROXYPORT");
-
- public static bool StressEnabled => Environment.GetEnvironmentVariable("COREFX_STRESS_HTTP") == "1";
- }
-
- public static class WebSocket
- {
- public static string Host
- {
- get
- {
- string server = Environment.GetEnvironmentVariable("COREFX_WEBSOCKETHOST");
- if (string.IsNullOrEmpty(server))
- {
- return "corefx-net.cloudapp.net";
- }
- else
- {
- return server;
- }
- }
- }
-
- public static string SecureHost
- {
- get
- {
- string server = Environment.GetEnvironmentVariable("COREFX_SECUREWEBSOCKETHOST");
- if (string.IsNullOrEmpty(server))
- {
- return "corefx-net.cloudapp.net";
- }
- else
- {
- return server;
- }
- }
- }
- }
- }
-}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Net.Test.Common
-{
- internal class WebSocketTestServers
- {
- public readonly static string Host = TestSettings.WebSocket.Host;
- public readonly static string SecureHost = TestSettings.WebSocket.SecureHost;
-
- private const string EchoHandler = "WebSocket/EchoWebSocket.ashx";
- private const string EchoHeadersHandler = "WebSocket/EchoWebSocketHeaders.ashx";
-
- public readonly static Uri RemoteEchoServer = new Uri("ws://" + Host + "/" + EchoHandler);
- public readonly static Uri SecureRemoteEchoServer = new Uri("wss://" + SecureHost + "/" + EchoHandler);
-
- public readonly static Uri RemoteEchoHeadersServer = new Uri("ws://" + Host + "/" + EchoHeadersHandler);
- public readonly static Uri SecureRemoteEchoHeadersServer = new Uri("wss://" + SecureHost + "/" + EchoHeadersHandler);
-
- public readonly static object[][] EchoServers = { new object[] { RemoteEchoServer }, new object[] { SecureRemoteEchoServer } };
- public readonly static object[][] EchoHeadersServers = { new object[] { RemoteEchoHeadersServer }, new object[] { SecureRemoteEchoHeadersServer } };
- }
-}
var handler = new WinHttpHandler();
using (var client = new HttpClient(handler))
{
- HttpResponseMessage response = await client.GetAsync(HttpTestServers.SecureRemoteEchoServer);
+ HttpResponseMessage response = await client.GetAsync(Configuration.Http.SecureRemoteEchoServer);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.False(_validationCallbackHistory.WasCalled);
}
handler.ServerCertificateValidationCallback = CustomServerCertificateValidationCallback;
using (var client = new HttpClient(handler))
{
- HttpResponseMessage response = await client.GetAsync(HttpTestServers.RemoteEchoServer);
+ HttpResponseMessage response = await client.GetAsync(Configuration.Http.RemoteEchoServer);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.False(_validationCallbackHistory.WasCalled);
}
handler.ServerCertificateValidationCallback = CustomServerCertificateValidationCallback;
using (var client = new HttpClient(handler))
{
- HttpResponseMessage response = await client.GetAsync(HttpTestServers.SecureRemoteEchoServer);
+ HttpResponseMessage response = await client.GetAsync(Configuration.Http.SecureRemoteEchoServer);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.True(_validationCallbackHistory.WasCalled);
- ConfirmValidCertificate(HttpTestServers.Host);
+ ConfirmValidCertificate(Configuration.Http.Host);
}
}
[Fact]
public async Task UseCallback_RedirectandValidCertificate_ExpectedValuesDuringCallback()
{
- Uri uri = HttpTestServers.RedirectUriForDestinationUri(true, 302, HttpTestServers.SecureRemoteEchoServer, 1);
+ Uri uri = Configuration.Http.RedirectUriForDestinationUri(true, 302, Configuration.Http.SecureRemoteEchoServer, 1);
var handler = new WinHttpHandler();
handler.ServerCertificateValidationCallback = CustomServerCertificateValidationCallback;
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.True(_validationCallbackHistory.WasCalled);
- ConfirmValidCertificate(HttpTestServers.Host);
+ ConfirmValidCertificate(Configuration.Http.Host);
}
}
handler.ServerCertificateValidationCallback = CustomServerCertificateValidationCallback;
using (var client = new HttpClient(handler))
{
- var request = new HttpRequestMessage(HttpMethod.Get, HttpTestServers.SecureRemoteEchoServer);
+ var request = new HttpRequestMessage(HttpMethod.Get, Configuration.Http.SecureRemoteEchoServer);
_validationCallbackHistory.ReturnFailure = true;
HttpRequestException ex = await Assert.ThrowsAsync<HttpRequestException>(() =>
- client.GetAsync(HttpTestServers.SecureRemoteEchoServer));
+ client.GetAsync(Configuration.Http.SecureRemoteEchoServer));
var innerEx = (Win32Exception)ex.InnerException;
Assert.Equal(ERROR_WINHTTP_SECURE_FAILURE, innerEx.NativeErrorCode);
}
using (var client = new HttpClient(handler))
{
_validationCallbackHistory.ThrowException = true;
- await Assert.ThrowsAsync<CustomException>(() => client.GetAsync(HttpTestServers.SecureRemoteEchoServer));
+ await Assert.ThrowsAsync<CustomException>(() => client.GetAsync(Configuration.Http.SecureRemoteEchoServer));
}
}
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Release|AnyCPU'" />
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' ">
- <Compile Include="$(CommonTestPath)\System\Net\HttpTestServers.cs">
- <Link>Common\System\Net\HttpTestServers.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.cs">
+ <Link>Common\System\Net\Configuration.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\TestSettings.cs">
- <Link>Common\System\Net\TestSettings.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.Http.cs">
+ <Link>Common\System\Net\Configuration.Http.cs</Link>
</Compile>
<Compile Include="ServerCertificateTest.cs" />
<Compile Include="WinHttpHandlerTest.cs" />
using (var client = new HttpClient(handler))
{
// TODO: This is a placeholder until GitHub Issue #2383 gets resolved.
- var response = client.GetAsync(HttpTestServers.RemoteEchoServer).Result;
+ var response = client.GetAsync(Configuration.Http.RemoteEchoServer).Result;
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
var responseContent = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
_output.WriteLine(responseContent);
string cookieName,
string cookieValue)
{
- Uri uri = HttpTestServers.RedirectUriForDestinationUri(false, 302, HttpTestServers.RemoteEchoServer, 1);
+ Uri uri = Configuration.Http.RedirectUriForDestinationUri(false, 302, Configuration.Http.RemoteEchoServer, 1);
var handler = new WinHttpHandler();
handler.WindowsProxyUsePolicy = WindowsProxyUsePolicy.UseWinInetProxy;
handler.CookieUsePolicy = cookieUsePolicy;
// TODO: #2383 - Consolidate the use of the environment variable settings to Common/tests.
public class DefaultCredentialsTest
{
- private static string DomainJoinedTestServer => TestSettings.Http.DomainJoinedHttpHost;
+ private static string DomainJoinedTestServer => Configuration.Http.DomainJoinedHttpHost;
private static bool DomainJoinedTestsEnabled => !string.IsNullOrEmpty(DomainJoinedTestServer);
private static string SpecificUserName = "test";
private static string SpecificPassword = "Password1";
handler.Proxy = new AuthenticatedProxy(null);
using (var client = new HttpClient(handler))
- using (HttpResponseMessage response = await client.GetAsync(HttpTestServers.RemoteEchoServer))
+ using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.RemoteEchoServer))
{
Assert.Equal(HttpStatusCode.ProxyAuthenticationRequired, response.StatusCode);
}
handler.Proxy = new AuthenticatedProxy(CredentialCache.DefaultCredentials);
using (var client = new HttpClient(handler))
- using (HttpResponseMessage response = await client.GetAsync(HttpTestServers.RemoteEchoServer))
+ using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.RemoteEchoServer))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
handler.Proxy = new AuthenticatedProxy(wrappedCreds);
using (var client = new HttpClient(handler))
- using (HttpResponseMessage response = await client.GetAsync(HttpTestServers.RemoteEchoServer))
+ using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.RemoteEchoServer))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
{
_credentials = credentials;
- string host = TestSettings.Http.DomainJoinedProxyHost;
+ string host = Configuration.Http.DomainJoinedProxyHost;
Assert.False(string.IsNullOrEmpty(host), "TestSettings.Http.DomainJoinedProxyHost must specify proxy hostname");
- string portString = TestSettings.Http.DomainJoinedProxyPort;
+ string portString = Configuration.Http.DomainJoinedProxyPort;
Assert.False(string.IsNullOrEmpty(portString), "TestSettings.Http.DomainJoinedProxyPort must specify proxy port number");
int port;
diagnosticListenerObserver.Enable();
using (var client = new HttpClient())
{
- var response = client.GetAsync(HttpTestServers.RemoteEchoServer).Result;
+ var response = client.GetAsync(Configuration.Http.RemoteEchoServer).Result;
}
Assert.True(requestLogged, "Request was not logged.");
{
using (var client = new HttpClient())
{
- var response = client.GetAsync(HttpTestServers.RemoteEchoServer).Result;
+ var response = client.GetAsync(Configuration.Http.RemoteEchoServer).Result;
}
Assert.False(requestLogged, "Request was logged while logging disabled.");
byte[] expectedData = Enumerable.Range(0, 20000).Select(i => (byte)i).ToArray();
HttpContent content = new ByteArrayContent(expectedData);
content.Headers.ContentMD5 = TestHelper.ComputeMD5Hash(expectedData);
- using (HttpResponseMessage response = await client.PostAsync(HttpTestServers.RemoteEchoServer, content))
+ using (HttpResponseMessage response = await client.PostAsync(Configuration.Http.RemoteEchoServer, content))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
using System.Net.Security;
using System.Net.Sockets;
using System.Net.Test.Common;
-using System.Net.Tests;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
{
using (var client = new HttpClient(new HttpClientHandler() { ClientCertificateOptions = ClientCertificateOption.Automatic }))
{
- await Assert.ThrowsAsync<PlatformNotSupportedException>(() => client.GetAsync(HttpTestServers.SecureRemoteEchoServer));
+ await Assert.ThrowsAsync<PlatformNotSupportedException>(() => client.GetAsync(Configuration.Http.SecureRemoteEchoServer));
}
}
public async Task Manual_SSLBackendNotSupported_ThrowsPlatformNotSupportedException()
{
var handler = new HttpClientHandler();
- handler.ClientCertificates.Add(CertificateConfiguration.GetClientCertificate());
+ handler.ClientCertificates.Add(Configuration.Certificates.GetClientCertificate());
using (var client = new HttpClient(handler))
{
- await Assert.ThrowsAsync<PlatformNotSupportedException>(() => client.GetAsync(HttpTestServers.SecureRemoteEchoServer));
+ await Assert.ThrowsAsync<PlatformNotSupportedException>(() => client.GetAsync(Configuration.Http.SecureRemoteEchoServer));
}
}
bool reuseClient) // validate behavior with and without connection pooling, which impacts client cert usage
{
var options = new LoopbackServer.Options { UseSsl = true };
- using (X509Certificate2 cert = CertificateConfiguration.GetClientCertificate())
+ using (X509Certificate2 cert = Configuration.Certificates.GetClientCertificate())
{
Func<HttpClient> createClient = () =>
{
handler.Proxy = new UseSpecifiedUriWebProxy(proxyUrl, rightCreds);
handler.DefaultProxyCredentials = wrongCreds;
- Task<HttpResponseMessage> responseTask = client.GetAsync(HttpTestServers.RemoteEchoServer);
+ Task<HttpResponseMessage> responseTask = client.GetAsync(Configuration.Http.RemoteEchoServer);
Task<string> responseStringTask = responseTask.ContinueWith(t => t.Result.Content.ReadAsStringAsync(), TaskScheduler.Default).Unwrap();
Task.WaitAll(proxyTask, responseTask, responseStringTask);
var creds = new NetworkCredential(ExpectedUsername, ExpectedPassword);
handler.DefaultProxyCredentials = creds;
- Task<HttpResponseMessage> responseTask = client.GetAsync(HttpTestServers.RemoteEchoServer);
+ Task<HttpResponseMessage> responseTask = client.GetAsync(Configuration.Http.RemoteEchoServer);
Task<string> responseStringTask = responseTask.ContinueWith(t => t.Result.Content.ReadAsStringAsync(), TaskScheduler.Default).Unwrap();
Task.WaitAll(responseTask, responseStringTask);
await Task.WhenAll(
from i in Enumerable.Range(0, 5)
- select client.GetAsync(HttpTestServers.RemoteEchoServer));
+ select client.GetAsync(Configuration.Http.RemoteEchoServer));
}
}
}
using (var client = new HttpClient(handler))
{
handler.MaxResponseHeadersLength = int.MaxValue;
- await client.GetStreamAsync(HttpTestServers.RemoteEchoServer);
+ await client.GetStreamAsync(Configuration.Http.RemoteEchoServer);
Assert.Throws<InvalidOperationException>(() => handler.MaxResponseHeadersLength = int.MaxValue);
}
}
Assert.Null(handler.ServerCertificateCustomValidationCallback);
Assert.False(handler.CheckCertificateRevocationList);
- using (HttpResponseMessage response = await client.GetAsync(HttpTestServers.SecureRemoteEchoServer))
+ using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.SecureRemoteEchoServer))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
bool callbackCalled = false;
handler.ServerCertificateCustomValidationCallback = delegate { callbackCalled = true; return true; };
- using (HttpResponseMessage response = await client.GetAsync(HttpTestServers.RemoteEchoServer))
+ using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.RemoteEchoServer))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
{
foreach (bool checkRevocation in new[] { true, false })
{
- yield return new object[] { HttpTestServers.SecureRemoteEchoServer, checkRevocation };
+ yield return new object[] { Configuration.Http.SecureRemoteEchoServer, checkRevocation };
yield return new object[] {
- HttpTestServers.RedirectUriForDestinationUri(
+ Configuration.Http.RedirectUriForDestinationUri(
secure:true,
statusCode:302,
- destinationUri:HttpTestServers.SecureRemoteEchoServer,
+ destinationUri:Configuration.Http.SecureRemoteEchoServer,
hops:1),
checkRevocation };
}
using (var client = new HttpClient(handler))
{
handler.ServerCertificateCustomValidationCallback = delegate { return false; };
- await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(HttpTestServers.SecureRemoteEchoServer));
+ await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(Configuration.Http.SecureRemoteEchoServer));
}
}
{
var e = new DivideByZeroException();
handler.ServerCertificateCustomValidationCallback = delegate { throw e; };
- Assert.Same(e, await Assert.ThrowsAsync<DivideByZeroException>(() => client.GetAsync(HttpTestServers.SecureRemoteEchoServer)));
+ Assert.Same(e, await Assert.ThrowsAsync<DivideByZeroException>(() => client.GetAsync(Configuration.Http.SecureRemoteEchoServer)));
}
}
+ public readonly static object[][] CertificateValidationServers =
+ {
+ new object[] { Configuration.Http.ExpiredCertRemoteServer },
+ new object[] { Configuration.Http.SelfSignedCertRemoteServer },
+ new object[] { Configuration.Http.WrongHostNameCertRemoteServer },
+ };
+
[Theory]
- [InlineData(HttpTestServers.ExpiredCertRemoteServer)]
- [InlineData(HttpTestServers.SelfSignedCertRemoteServer)]
- [InlineData(HttpTestServers.WrongHostNameCertRemoteServer)]
+ [MemberData(nameof(CertificateValidationServers))]
public async Task NoCallback_BadCertificate_ThrowsException(string url)
{
using (var client = new HttpClient())
public async Task NoCallback_RevokedCertificate_NoRevocationChecking_Succeeds()
{
using (var client = new HttpClient())
- using (HttpResponseMessage response = await client.GetAsync(HttpTestServers.RevokedCertRemoteServer))
+ using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.RevokedCertRemoteServer))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
var handler = new HttpClientHandler() { CheckCertificateRevocationList = true };
using (var client = new HttpClient(handler))
{
- await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(HttpTestServers.RevokedCertRemoteServer));
+ await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(Configuration.Http.RevokedCertRemoteServer));
}
}
+ public readonly static object[][] CertificateValidationServersAndExpectedPolicies =
+ {
+ new object[] { Configuration.Http.ExpiredCertRemoteServer, SslPolicyErrors.RemoteCertificateChainErrors },
+ new object[] { Configuration.Http.SelfSignedCertRemoteServer, SslPolicyErrors.RemoteCertificateChainErrors },
+ new object[] { Configuration.Http.WrongHostNameCertRemoteServer , SslPolicyErrors.RemoteCertificateNameMismatch},
+ };
+
[ActiveIssue(7812, PlatformID.Windows)]
[ConditionalTheory(nameof(BackendSupportsCustomCertificateHandling))]
- [InlineData(HttpTestServers.ExpiredCertRemoteServer, SslPolicyErrors.RemoteCertificateChainErrors)]
- [InlineData(HttpTestServers.SelfSignedCertRemoteServer, SslPolicyErrors.RemoteCertificateChainErrors)]
- [InlineData(HttpTestServers.WrongHostNameCertRemoteServer, SslPolicyErrors.RemoteCertificateNameMismatch)]
+ [MemberData(nameof(CertificateValidationServersAndExpectedPolicies))]
public async Task UseCallback_BadCertificate_ExpectedPolicyErrors(string url, SslPolicyErrors expectedErrors)
{
var handler = new HttpClientHandler();
{
using (var client = new HttpClient(new HttpClientHandler() { ServerCertificateCustomValidationCallback = delegate { return true; } }))
{
- await Assert.ThrowsAsync<PlatformNotSupportedException>(() => client.GetAsync(HttpTestServers.SecureRemoteEchoServer));
+ await Assert.ThrowsAsync<PlatformNotSupportedException>(() => client.GetAsync(Configuration.Http.SecureRemoteEchoServer));
}
}
{
using (var client = new HttpClient(new HttpClientHandler() { CheckCertificateRevocationList = true }))
{
- await Assert.ThrowsAsync<PlatformNotSupportedException>(() => client.GetAsync(HttpTestServers.SecureRemoteEchoServer));
+ await Assert.ThrowsAsync<PlatformNotSupportedException>(() => client.GetAsync(Configuration.Http.SecureRemoteEchoServer));
}
}
{
var content = new ChannelBindingAwareContent("Test contest");
using (var client = new HttpClient())
- using (HttpResponseMessage response = await client.PostAsync(HttpTestServers.SecureRemoteEchoServer, content))
+ using (HttpResponseMessage response = await client.PostAsync(Configuration.Http.SecureRemoteEchoServer, content))
{
// Validate status.
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
}
+ public readonly static object [][] SupportedSSLVersionServers =
+ {
+ new object[] {"TLSv1.0", Configuration.Http.TLSv10RemoteServer},
+ new object[] {"TLSv1.1", Configuration.Http.TLSv11RemoteServer},
+ new object[] {"TLSv1.2", Configuration.Http.TLSv12RemoteServer},
+ };
+
// This test is logically the same as the above test, albeit using remote servers
// instead of local ones. We're keeping it for now (as outerloop) because it helps
// to validate against another SSL implementation that what we mean by a particular
// TLS version matches that other implementation.
[OuterLoop] // avoid www.ssllabs.com dependency in innerloop
[Theory]
- [InlineData("TLSv1.0", HttpTestServers.TLSv10RemoteServer)]
- [InlineData("TLSv1.1", HttpTestServers.TLSv11RemoteServer)]
- [InlineData("TLSv1.2", HttpTestServers.TLSv12RemoteServer)]
+ [MemberData(nameof(SupportedSSLVersionServers))]
public async Task GetAsync_SupportedSSLVersion_Succeeds(string name, string url)
{
using (var client = new HttpClient())
}
}
+ public readonly static object[][] NotSupportedSSLVersionServers =
+ {
+ new object[] {"SSLv2", Configuration.Http.SSLv2RemoteServer},
+ new object[] {"SSLv3", Configuration.Http.SSLv3RemoteServer},
+ };
+
// It would be easy to remove the dependency on these remote servers if we didn't
// explicitly disallow creating SslStream with SSLv2/3. Since we explicitly throw
// when trying to use such an SslStream, we can't stand up a localhost server that
// only speaks those protocols.
[OuterLoop] // avoid www.ssllabs.com dependency in innerloop
[Theory]
- [InlineData("SSLv2", HttpTestServers.SSLv2RemoteServer)]
- [InlineData("SSLv3", HttpTestServers.SSLv3RemoteServer)]
+ [MemberData(nameof(NotSupportedSSLVersionServers))]
public async Task GetAsync_UnsupportedSSLVersion_Throws(string name, string url)
{
using (var client = new HttpClient())
private readonly NetworkCredential _credential = new NetworkCredential(Username, Password);
- public readonly static object[][] EchoServers = HttpTestServers.EchoServers;
- public readonly static object[][] VerifyUploadServers = HttpTestServers.VerifyUploadServers;
- public readonly static object[][] CompressedServers = HttpTestServers.CompressedServers;
+ public readonly static object[][] EchoServers = Configuration.Http.EchoServers;
+ public readonly static object[][] VerifyUploadServers = Configuration.Http.VerifyUploadServers;
+ public readonly static object[][] CompressedServers = Configuration.Http.CompressedServers;
public readonly static object[][] HeaderValueAndUris = {
- new object[] { "X-CustomHeader", "x-value", HttpTestServers.RemoteEchoServer },
- new object[] { "X-Cust-Header-NoValue", "" , HttpTestServers.RemoteEchoServer },
- new object[] { "X-CustomHeader", "x-value", HttpTestServers.RedirectUriForDestinationUri(
+ new object[] { "X-CustomHeader", "x-value", Configuration.Http.RemoteEchoServer },
+ new object[] { "X-Cust-Header-NoValue", "" , Configuration.Http.RemoteEchoServer },
+ new object[] { "X-CustomHeader", "x-value", Configuration.Http.RedirectUriForDestinationUri(
secure:false,
statusCode:302,
- destinationUri:HttpTestServers.RemoteEchoServer,
+ destinationUri:Configuration.Http.RemoteEchoServer,
hops:1) },
- new object[] { "X-Cust-Header-NoValue", "" , HttpTestServers.RedirectUriForDestinationUri(
+ new object[] { "X-Cust-Header-NoValue", "" , Configuration.Http.RedirectUriForDestinationUri(
secure:false,
statusCode:302,
- destinationUri:HttpTestServers.RemoteEchoServer,
+ destinationUri:Configuration.Http.RemoteEchoServer,
hops:1) },
};
- public readonly static object[][] Http2Servers = HttpTestServers.Http2Servers;
+ public readonly static object[][] Http2Servers = Configuration.Http.Http2Servers;
public readonly static object[][] RedirectStatusCodes = {
new object[] { 300 },
handler.UseDefaultCredentials = false;
using (var client = new HttpClient(handler))
{
- Uri uri = HttpTestServers.NegotiateAuthUriForDefaultCreds(secure:false);
+ Uri uri = Configuration.Http.NegotiateAuthUriForDefaultCreds(secure:false);
_output.WriteLine("Uri: {0}", uri);
using (HttpResponseMessage response = await client.GetAsync(uri))
{
HttpResponseMessage response;
for (int i = 0; i < 3; i++)
{
- response = await client.GetAsync(HttpTestServers.RemoteEchoServer);
+ response = await client.GetAsync(Configuration.Http.RemoteEchoServer);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
response.Dispose();
}
using (var handler = new HttpClientHandler())
using (var client = new HttpClient(handler))
{
- response = await client.GetAsync(HttpTestServers.SecureRemoteEchoServer);
+ response = await client.GetAsync(Configuration.Http.SecureRemoteEchoServer);
}
Assert.NotNull(response);
string responseContent = await response.Content.ReadAsStringAsync();
cts.Cancel();
using (var client = new HttpClient())
{
- var request = new HttpRequestMessage(HttpMethod.Post, HttpTestServers.RemoteEchoServer);
+ var request = new HttpRequestMessage(HttpMethod.Post, Configuration.Http.RemoteEchoServer);
TaskCanceledException ex = await Assert.ThrowsAsync<TaskCanceledException>(() =>
client.SendAsync(request, cts.Token));
Assert.True(cts.Token.IsCancellationRequested, "cts token IsCancellationRequested");
handler.Credentials = _credential;
using (var client = new HttpClient(handler))
{
- Uri uri = HttpTestServers.BasicAuthUriForCreds(secure:false, userName:Username, password:Password);
+ Uri uri = Configuration.Http.BasicAuthUriForCreds(secure:false, userName:Username, password:Password);
using (HttpResponseMessage response = await client.GetAsync(uri))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
{
using (var client = new HttpClient())
{
- Uri uri = HttpTestServers.BasicAuthUriForCreds(secure:false, userName:Username, password:Password);
+ Uri uri = Configuration.Http.BasicAuthUriForCreds(secure:false, userName:Username, password:Password);
using (HttpResponseMessage response = await client.GetAsync(uri))
{
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
handler.AllowAutoRedirect = false;
using (var client = new HttpClient(handler))
{
- Uri uri = HttpTestServers.RedirectUriForDestinationUri(
+ Uri uri = Configuration.Http.RedirectUriForDestinationUri(
secure:false,
statusCode:statusCode,
- destinationUri:HttpTestServers.RemoteEchoServer,
+ destinationUri:Configuration.Http.RemoteEchoServer,
hops:1);
_output.WriteLine("Uri: {0}", uri);
using (HttpResponseMessage response = await client.GetAsync(uri))
handler.AllowAutoRedirect = true;
using (var client = new HttpClient(handler))
{
- Uri uri = HttpTestServers.RedirectUriForDestinationUri(
+ Uri uri = Configuration.Http.RedirectUriForDestinationUri(
secure:false,
statusCode:statusCode,
- destinationUri:HttpTestServers.RemoteEchoServer,
+ destinationUri:Configuration.Http.RemoteEchoServer,
hops:1);
_output.WriteLine("Uri: {0}", uri);
using (HttpResponseMessage response = await client.GetAsync(uri))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
- Assert.Equal(HttpTestServers.RemoteEchoServer, response.RequestMessage.RequestUri);
+ Assert.Equal(Configuration.Http.RemoteEchoServer, response.RequestMessage.RequestUri);
}
}
}
handler.AllowAutoRedirect = true;
using (var client = new HttpClient(handler))
{
- Uri uri = HttpTestServers.RedirectUriForDestinationUri(
+ Uri uri = Configuration.Http.RedirectUriForDestinationUri(
secure:false,
statusCode:302,
- destinationUri:HttpTestServers.SecureRemoteEchoServer,
+ destinationUri:Configuration.Http.SecureRemoteEchoServer,
hops:1);
_output.WriteLine("Uri: {0}", uri);
using (HttpResponseMessage response = await client.GetAsync(uri))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
- Assert.Equal(HttpTestServers.SecureRemoteEchoServer, response.RequestMessage.RequestUri);
+ Assert.Equal(Configuration.Http.SecureRemoteEchoServer, response.RequestMessage.RequestUri);
}
}
}
handler.AllowAutoRedirect = true;
using (var client = new HttpClient(handler))
{
- Uri uri = HttpTestServers.RedirectUriForDestinationUri(
+ Uri uri = Configuration.Http.RedirectUriForDestinationUri(
secure:true,
statusCode:302,
- destinationUri:HttpTestServers.RemoteEchoServer,
+ destinationUri:Configuration.Http.RemoteEchoServer,
hops:1);
_output.WriteLine("Uri: {0}", uri);
using (HttpResponseMessage response = await client.GetAsync(uri))
{
var handler = new HttpClientHandler();
handler.AllowAutoRedirect = true;
- Uri targetUri = HttpTestServers.BasicAuthUriForCreds(secure:false, userName:Username, password:Password);
+ Uri targetUri = Configuration.Http.BasicAuthUriForCreds(secure:false, userName:Username, password:Password);
using (var client = new HttpClient(handler))
{
- Uri uri = HttpTestServers.RedirectUriForDestinationUri(
+ Uri uri = Configuration.Http.RedirectUriForDestinationUri(
secure:false,
statusCode:302,
destinationUri:targetUri,
{
using (var client = new HttpClient(new HttpClientHandler() { MaxAutomaticRedirections = maxHops }))
{
- Task<HttpResponseMessage> t = client.GetAsync(HttpTestServers.RedirectUriForDestinationUri(
+ Task<HttpResponseMessage> t = client.GetAsync(Configuration.Http.RedirectUriForDestinationUri(
secure: false,
statusCode: 302,
- destinationUri: HttpTestServers.RemoteEchoServer,
+ destinationUri: Configuration.Http.RemoteEchoServer,
hops: hops));
if (hops <= maxHops)
using (HttpResponseMessage response = await t)
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
- Assert.Equal(HttpTestServers.RemoteEchoServer, response.RequestMessage.RequestUri);
+ Assert.Equal(Configuration.Http.RemoteEchoServer, response.RequestMessage.RequestUri);
}
}
else
{
using (var client = new HttpClient(new HttpClientHandler() { AllowAutoRedirect = true }))
{
- Uri uri = HttpTestServers.RedirectUriForDestinationUri(
+ Uri uri = Configuration.Http.RedirectUriForDestinationUri(
secure: false,
statusCode: 302,
- destinationUri: HttpTestServers.RemoteEchoServer,
+ destinationUri: Configuration.Http.RemoteEchoServer,
hops: 1,
relative: true);
_output.WriteLine("Uri: {0}", uri);
using (HttpResponseMessage response = await client.GetAsync(uri))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
- Assert.Equal(HttpTestServers.RemoteEchoServer, response.RequestMessage.RequestUri);
+ Assert.Equal(Configuration.Http.RemoteEchoServer, response.RequestMessage.RequestUri);
}
}
}
handler.Credentials = _credential;
using (var client = new HttpClient(handler))
{
- Uri redirectUri = HttpTestServers.RedirectUriForCreds(
+ Uri redirectUri = Configuration.Http.RedirectUriForCreds(
secure:false,
statusCode:302,
userName:Username,
[Theory, MemberData(nameof(RedirectStatusCodes))]
public async Task GetAsync_CredentialIsCredentialCacheUriRedirect_StatusCodeOK(int statusCode)
{
- Uri uri = HttpTestServers.BasicAuthUriForCreds(secure:false, userName:Username, password:Password);
- Uri redirectUri = HttpTestServers.RedirectUriForCreds(
+ Uri uri = Configuration.Http.BasicAuthUriForCreds(secure:false, userName:Username, password:Password);
+ Uri redirectUri = Configuration.Http.RedirectUriForCreds(
secure:false,
statusCode:statusCode,
userName:Username,
{
using (HttpClient client = new HttpClient())
{
- using (HttpResponseMessage httpResponse = await client.GetAsync(HttpTestServers.RemoteEchoServer))
+ using (HttpResponseMessage httpResponse = await client.GetAsync(Configuration.Http.RemoteEchoServer))
{
string responseText = await httpResponse.Content.ReadAsStringAsync();
_output.WriteLine(responseText);
{
var handler = new HttpClientHandler();
var cookieContainer = new CookieContainer();
- cookieContainer.Add(HttpTestServers.RemoteEchoServer, new Cookie(cookieName, cookieValue));
+ cookieContainer.Add(Configuration.Http.RemoteEchoServer, new Cookie(cookieName, cookieValue));
handler.CookieContainer = cookieContainer;
using (var client = new HttpClient(handler))
{
- using (HttpResponseMessage httpResponse = await client.GetAsync(HttpTestServers.RemoteEchoServer))
+ using (HttpResponseMessage httpResponse = await client.GetAsync(Configuration.Http.RemoteEchoServer))
{
Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);
string responseText = await httpResponse.Content.ReadAsStringAsync();
[InlineData("cookieName1", "cookieValue1")]
public async Task GetAsync_RedirectResponseHasCookie_CookieSentToFinalUri(string cookieName, string cookieValue)
{
- Uri uri = HttpTestServers.RedirectUriForDestinationUri(
+ Uri uri = Configuration.Http.RedirectUriForDestinationUri(
secure:false,
statusCode:302,
- destinationUri:HttpTestServers.RemoteEchoServer,
+ destinationUri:Configuration.Http.RemoteEchoServer,
hops:1);
using (HttpClient client = new HttpClient())
{
{
const int NumGets = 5;
Task<HttpResponseMessage>[] responseTasks = (from _ in Enumerable.Range(0, NumGets)
- select client.GetAsync(HttpTestServers.RemoteEchoServer, HttpCompletionOption.ResponseHeadersRead)).ToArray();
+ select client.GetAsync(Configuration.Http.RemoteEchoServer, HttpCompletionOption.ResponseHeadersRead)).ToArray();
for (int i = responseTasks.Length - 1; i >= 0; i--) // read backwards to increase likelihood that we wait on a different task than has data available
{
using (HttpResponseMessage response = await responseTasks[i])
[Fact]
public async Task SendAsync_HttpRequestMsgResponseHeadersRead_StatusCodeOK()
{
- HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, HttpTestServers.SecureRemoteEchoServer);
+ HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, Configuration.Http.SecureRemoteEchoServer);
using (var client = new HttpClient())
{
using (HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead))
{
const string ContentString = "This is the content string.";
var content = new StringContent(ContentString);
- Uri redirectUri = HttpTestServers.RedirectUriForDestinationUri(
+ Uri redirectUri = Configuration.Http.RedirectUriForDestinationUri(
secure,
302,
- secure ? HttpTestServers.SecureRemoteEchoServer : HttpTestServers.RemoteEchoServer,
+ secure ? Configuration.Http.SecureRemoteEchoServer : Configuration.Http.RemoteEchoServer,
1);
using (var client = new HttpClient())
fs.Flush(flushToDisk: true);
fs.Position = 0;
- Uri redirectUri = HttpTestServers.RedirectUriForDestinationUri(false, statusCode, HttpTestServers.SecureRemoteEchoServer, 1);
+ Uri redirectUri = Configuration.Http.RedirectUriForDestinationUri(false, statusCode, Configuration.Http.SecureRemoteEchoServer, 1);
using (var client = new HttpClient())
using (HttpResponseMessage response = await client.PostAsync(redirectUri, new StreamContent(fs)))
{
using (var client = new HttpClient())
{
- using (HttpResponseMessage response = await client.GetAsync(HttpTestServers.StatusCodeUri(
+ using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.StatusCodeUri(
false,
(int)statusCode,
reasonPhrase)))
{
string expectedContent = "Test contest";
var content = new ChannelBindingAwareContent(expectedContent);
- using (HttpResponseMessage response = await client.PostAsync(HttpTestServers.SecureRemoteEchoServer, content))
+ using (HttpResponseMessage response = await client.PostAsync(Configuration.Http.SecureRemoteEchoServer, content))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
{
var request = new HttpRequestMessage(
new HttpMethod(method),
- secureServer ? HttpTestServers.SecureRemoteEchoServer : HttpTestServers.RemoteEchoServer);
+ secureServer ? Configuration.Http.SecureRemoteEchoServer : Configuration.Http.RemoteEchoServer);
using (HttpResponseMessage response = await client.SendAsync(request))
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
{
var request = new HttpRequestMessage(
new HttpMethod(method),
- secureServer ? HttpTestServers.SecureRemoteEchoServer : HttpTestServers.RemoteEchoServer);
+ secureServer ? Configuration.Http.SecureRemoteEchoServer : Configuration.Http.RemoteEchoServer);
request.Content = new StringContent(ExpectedContent);
using (HttpResponseMessage response = await client.SendAsync(request))
{
var content = new MemoryStream();
content.Write(byteContent, 0, byteContent.Length);
content.Position = startingPosition;
- var request = new HttpRequestMessage(HttpMethod.Post, HttpTestServers.RemoteEchoServer) { Content = new StreamContent(content) };
+ var request = new HttpRequestMessage(HttpMethod.Post, Configuration.Http.RemoteEchoServer) { Content = new StreamContent(content) };
for (int iter = 0; iter < 2; iter++)
{
{
var request = new HttpRequestMessage(
new HttpMethod(method),
- secureServer ? HttpTestServers.SecureRemoteEchoServer : HttpTestServers.RemoteEchoServer)
+ secureServer ? Configuration.Http.SecureRemoteEchoServer : Configuration.Http.RemoteEchoServer)
{
Content = new StringContent(ExpectedContent)
};
using (var handler = new HttpClientHandler() { Proxy = new UseSpecifiedUriWebProxy(proxyUrl, creds) })
using (var client = new HttpClient(handler))
{
- Task<HttpResponseMessage> responseTask = client.GetAsync(HttpTestServers.RemoteEchoServer);
+ Task<HttpResponseMessage> responseTask = client.GetAsync(Configuration.Http.RemoteEchoServer);
Task<string> responseStringTask = responseTask.ContinueWith(t => t.Result.Content.ReadAsStringAsync(), TaskScheduler.Default).Unwrap();
Task.WaitAll(proxyTask, responseTask, responseStringTask);
public async Task Proxy_BypassTrue_GetRequestDoesntGoesThroughCustomProxy(IWebProxy proxy)
{
using (var client = new HttpClient(new HttpClientHandler() { Proxy = proxy }))
- using (HttpResponseMessage response = await client.GetAsync(HttpTestServers.RemoteEchoServer))
+ using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.RemoteEchoServer))
{
TestHelper.VerifyResponseBody(
await response.Content.ReadAsStringAsync(),
using (var handler = new HttpClientHandler() { Proxy = new UseSpecifiedUriWebProxy(proxyUrl, null) })
using (var client = new HttpClient(handler))
{
- Task<HttpResponseMessage> responseTask = client.GetAsync(HttpTestServers.RemoteEchoServer);
+ Task<HttpResponseMessage> responseTask = client.GetAsync(Configuration.Http.RemoteEchoServer);
Task.WaitAll(proxyTask, responseTask);
Assert.Equal(HttpStatusCode.ProxyAuthenticationRequired, responseTask.Result.StatusCode);
{
public class HttpClientMiniStress
{
- private static bool HttpStressEnabled => TestSettings.Http.StressEnabled;
+ private static bool HttpStressEnabled => Configuration.Http.StressEnabled;
[ConditionalTheory(nameof(HttpStressEnabled))]
[MemberData(nameof(GetStressOptions))]
using (var client = new HttpClient())
{
client.MaxResponseContentBufferSize = 1;
- await Assert.ThrowsAsync<HttpRequestException>(() => client.GetStringAsync(HttpTestServers.RemoteEchoServer));
+ await Assert.ThrowsAsync<HttpRequestException>(() => client.GetStringAsync(Configuration.Http.RemoteEchoServer));
}
}
private const string UserName = "user1";
private const string Password = "password1";
private readonly static Uri BasicAuthServerUri =
- HttpTestServers.BasicAuthUriForCreds(false, UserName, Password);
+ Configuration.Http.BasicAuthUriForCreds(false, UserName, Password);
private readonly static Uri SecureBasicAuthServerUri =
- HttpTestServers.BasicAuthUriForCreds(true, UserName, Password);
+ Configuration.Http.BasicAuthUriForCreds(true, UserName, Password);
private readonly ITestOutputHelper _output;
- public readonly static object[][] EchoServers = HttpTestServers.EchoServers;
+ public readonly static object[][] EchoServers = Configuration.Http.EchoServers;
public readonly static object[][] BasicAuthEchoServers =
new object[][]
}
string content = sb.ToString();
- await PostHelper(HttpTestServers.RemoteEchoServer, content, new StringContent(content),
+ await PostHelper(Configuration.Http.RemoteEchoServer, content, new StringContent(content),
useContentLengthUpload: true, useChunkedEncodingUpload: false);
}
var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-ResponseStreamTest", customHeaderValue);
- Stream stream = await client.GetStreamAsync(HttpTestServers.RemoteEchoServer);
+ Stream stream = await client.GetStreamAsync(Configuration.Http.RemoteEchoServer);
using (var reader = new StreamReader(stream))
{
string responseBody = reader.ReadToEnd();
var client = new HttpClient();
HttpResponseMessage response =
- await client.GetAsync(HttpTestServers.RemoteEchoServer, HttpCompletionOption.ResponseHeadersRead);
+ await client.GetAsync(Configuration.Http.RemoteEchoServer, HttpCompletionOption.ResponseHeadersRead);
await response.Content.LoadIntoBufferAsync();
string responseBody = await response.Content.ReadAsStringAsync();
var client = new HttpClient();
HttpResponseMessage response =
- await client.GetAsync(HttpTestServers.RemoteEchoServer, HttpCompletionOption.ResponseHeadersRead);
+ await client.GetAsync(Configuration.Http.RemoteEchoServer, HttpCompletionOption.ResponseHeadersRead);
var memoryStream = new MemoryStream();
await response.Content.CopyToAsync(memoryStream);
using (var client = new HttpClient())
using (HttpResponseMessage response =
- await client.GetAsync(HttpTestServers.RemoteEchoServer, HttpCompletionOption.ResponseHeadersRead))
+ await client.GetAsync(Configuration.Http.RemoteEchoServer, HttpCompletionOption.ResponseHeadersRead))
using (Stream stream = await response.Content.ReadAsStreamAsync())
{
var buffer = new byte[2048];
using System.Net.Security.Tests;
using System.Net.Test.Common;
-using System.Net.Tests;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
[PlatformSpecific(PlatformID.Windows)]
public async Task HttpClient_ClientUsesAuxRecord_Ok()
{
- X509Certificate2 serverCert = CertificateConfiguration.GetServerCertificate();
+ X509Certificate2 serverCert = Configuration.Certificates.GetServerCertificate();
var server = new SchSendAuxRecordTestServer(serverCert);
int port = server.StartServer();
<Compile Include="$(CommonTestPath)\System\IO\FileCleanupTestBase.cs">
<Link>Common\System\IO\FileCleanupTestBase.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\CertificateConfiguration.cs">
- <Link>Common\System\Net\CertificateConfiguration.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.Certificates.cs">
+ <Link>Common\System\Net\Configuration.Certificates.cs</Link>
</Compile>
<Compile Include="$(CommonTestPath)\System\Net\EventSourceTestLogging.cs">
<Link>Common\System\Net\EventSourceTestLogging.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\HttpTestServers.cs">
- <Link>Common\System\Net\HttpTestServers.cs</Link>
- </Compile>
<Compile Include="$(CommonTestPath)\System\Net\SchSendAuxRecordTestServer.cs">
<Link>Common\System\Net\SchSendAuxRecordTestServer.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\TestSettings.cs">
- <Link>Common\System\Net\TestSettings.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.cs">
+ <Link>Common\System\Net\Configuration.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.Http.cs">
+ <Link>Common\System\Net\Configuration.Http.cs</Link>
</Compile>
<Compile Include="$(CommonTestPath)\System\Net\TestWebProxies.cs">
<Link>Common\System\Net\TestWebProxies.cs</Link>
[Fact]
public void GetHostByName_HostName_GetHostByAddr()
{
- IPHostEntry hostEntry1 = NameResolutionPal.GetHostByName(TestSettings.Http.Http2Host);
+ IPHostEntry hostEntry1 = NameResolutionPal.GetHostByName(Configuration.Http.Http2Host);
Assert.NotNull(hostEntry1);
IPAddress[] list1 = hostEntry1.AddressList;
<Link>Common\System\Net\IPEndPointStatics.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\TestSettings.cs">
- <Link>Common\System\Net\TestSettings.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.cs">
+ <Link>Common\System\Net\Configuration.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.Http.cs">
+ <Link>Common\System\Net\Configuration.Http.cs</Link>
</Compile>
</ItemGroup>
private int _responseCallbackCallCount = 0;
private readonly ITestOutputHelper _output;
- public readonly static object[][] EchoServers = HttpTestServers.EchoServers;
+ public readonly static object[][] EchoServers = Configuration.Http.EchoServers;
public HttpWebRequestTest(ITestOutputHelper output)
{
{
strContent = sr.ReadToEnd();
}
- Assert.True(strContent.Contains("\"Host\": \"" + HttpTestServers.Host + "\""));
+ Assert.True(strContent.Contains("\"Host\": \"" + Configuration.Http.Host + "\""));
}
[Theory, MemberData(nameof(EchoServers))]
}
public static object[][] StatusCodeServers = {
- new object[] { HttpTestServers.StatusCodeUri(false, 404) },
- new object[] { HttpTestServers.StatusCodeUri(true, 404) },
+ new object[] { Configuration.Http.StatusCodeUri(false, 404) },
+ new object[] { Configuration.Http.StatusCodeUri(true, 404) },
};
[Theory, MemberData(nameof(StatusCodeServers))]
[Fact]
public async Task ContentType_ServerResponseHasContentTypeHeader_ContentTypeIsNonEmptyString()
{
- HttpWebRequest request = WebRequest.CreateHttp(HttpTestServers.RemoteEchoServer);
+ HttpWebRequest request = WebRequest.CreateHttp(Configuration.Http.RemoteEchoServer);
request.Method = HttpMethod.Get.Method;
WebResponse response = await request.GetResponseAsync();
Assert.True(!string.IsNullOrEmpty(response.ContentType));
private Stream GetRequestStream()
{
- HttpWebRequest request = HttpWebRequest.CreateHttp(HttpTestServers.RemoteEchoServer);
+ HttpWebRequest request = HttpWebRequest.CreateHttp(Configuration.Http.RemoteEchoServer);
request.Method = "POST";
return request.GetRequestStreamAsync().GetAwaiter().GetResult();
}
<Compile Include="RequestStreamTest.cs" />
<Compile Include="WebRequestTest.cs" />
- <Compile Include="$(CommonTestPath)\System\Net\CertificateConfiguration.cs">
- <Link>Common\System\Net\CertificateConfiguration.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.cs">
+ <Link>Common\System\Net\Configuration.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\HttpTestServers.cs">
- <Link>Common\System\Net\HttpTestServers.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.Certificates.cs">
+ <Link>Common\System\Net\Configuration.Certificates.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\TestSettings.cs">
- <Link>Common\System\Net\TestSettings.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.Http.cs">
+ <Link>Common\System\Net\Configuration.Http.cs</Link>
</Compile>
<Compile Include="$(CommonTestPath)\System\Net\Http\LoopbackServer.cs">
<Link>Common\System\Net\Http\LoopbackServer.cs</Link>
using System.Net.Sockets;
using System.Net.Test.Common;
-using System.Net.Tests;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
public CertificateValidationClientServer()
{
- _serverCertificateCollection = CertificateConfiguration.GetServerCertificateCollection();
- _serverCertificate = CertificateConfiguration.GetServerCertificate();
+ _serverCertificateCollection = Configuration.Certificates.GetServerCertificateCollection();
+ _serverCertificate = Configuration.Certificates.GetServerCertificate();
- _clientCertificateCollection = CertificateConfiguration.GetClientCertificateCollection();
- _clientCertificate = CertificateConfiguration.GetClientCertificate();
+ _clientCertificateCollection = Configuration.Certificates.GetClientCertificateCollection();
+ _clientCertificate = Configuration.Certificates.GetClientCertificate();
}
public void Dispose()
{
using (var client = new TcpClient(AddressFamily.InterNetwork))
{
- await client.ConnectAsync(TestSettings.Http.SecureHost, 443);
+ await client.ConnectAsync(Configuration.Security.TlsServer.IdnHost, Configuration.Security.TlsServer.Port);
using (SslStream sslStream = new SslStream(client.GetStream(), false, RemoteHttpsCertValidation, null))
{
- await sslStream.AuthenticateAsClientAsync(TestSettings.Http.SecureHost);
+ await sslStream.AuthenticateAsClientAsync(Configuration.Security.TlsServer.IdnHost);
}
}
}
using System.IO;
using System.Net.Sockets;
using System.Net.Test.Common;
-using System.Net.Tests;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
SslStream sslStream = null;
- X509Certificate2 certificate = CertificateConfiguration.GetServerCertificate();
+ X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate();
try
{
{
yield return new object[] { CredentialCache.DefaultNetworkCredentials };
yield return new object[] { new NetworkCredential(
- Configuration.ActiveDirectoryUserName,
- Configuration.ActiveDirectoryUserPassword,
- Configuration.ActiveDirectoryName) };
+ Configuration.Security.ActiveDirectoryUserName,
+ Configuration.Security.ActiveDirectoryUserPassword,
+ Configuration.Security.ActiveDirectoryName) };
// Anonymous (with domain name).
yield return new object[] { new NetworkCredential(
- Configuration.ActiveDirectoryUserName,
+ Configuration.Security.ActiveDirectoryUserName,
null,
- Configuration.ActiveDirectoryName) };
+ Configuration.Security.ActiveDirectoryName) };
// Anonymous (without domain).
yield return new object[] { new NetworkCredential(
- Configuration.ActiveDirectoryUserName,
+ Configuration.Security.ActiveDirectoryUserName,
null,
null) };
}
{
get
{
- yield return new object[] { new NetworkCredential(null, null, Configuration.ActiveDirectoryName) };
+ yield return new object[] { new NetworkCredential(null, null, Configuration.Security.ActiveDirectoryName) };
yield return new object[] { new NetworkCredential(null, null, null) };
yield return new object[] { new NetworkCredential(
"baduser",
null,
- Configuration.ActiveDirectoryName) };
+ Configuration.Security.ActiveDirectoryName) };
yield return new object[] { new NetworkCredential(
"baduser",
"badpassword",
- Configuration.ActiveDirectoryName) };
+ Configuration.Security.ActiveDirectoryName) };
}
}
private async Task VerifyAuthentication(NetworkCredential credential)
{
- string serverName = Configuration.NegotiateServer.Host;
- int port = Configuration.NegotiateServer.Port;
+ string serverName = Configuration.Security.NegotiateServer.Host;
+ int port = Configuration.Security.NegotiateServer.Port;
string serverSPN = "HOST/" + serverName;
bool isLocalhost = await IsLocalHost(serverName);
using System.Collections.Generic;
using System.Net.Sockets;
using System.Net.Test.Common;
-using System.Net.Tests;
using System.Runtime.ExceptionServices;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
{
_log = TestLogging.GetInstance();
_logVerbose = VerboseTestLogging.GetInstance();
- _serverCertificate = CertificateConfiguration.GetServerCertificate();
+ _serverCertificate = Configuration.Certificates.GetServerCertificate();
}
public void Dispose()
// See the LICENSE file in the project root for more information.
using System.Net.Sockets;
-using System.Net.Tests;
+using System.Net.Test.Common;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
{
TcpListener listener = new TcpListener(IPAddress.Any, 0);
- using (X509Certificate2 serverCertificate = CertificateConfiguration.GetServerCertificate())
+ using (X509Certificate2 serverCertificate = Configuration.Certificates.GetServerCertificate())
using (TcpClient client = new TcpClient())
{
listener.Start();
using System.Net.Sockets;
using System.Net.Test.Common;
-using System.Net.Tests;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
[PlatformSpecific(PlatformID.Windows)]
public async Task SslStream_ClientAndServerUsesAuxRecord_Ok()
{
- X509Certificate2 serverCert = CertificateConfiguration.GetServerCertificate();
+ X509Certificate2 serverCert = Configuration.Certificates.GetServerCertificate();
var server = new SchSendAuxRecordTestServer(serverCert);
int port = server.StartServer();
using System.Linq;
using System.Net.Test.Common;
-using System.Net.Tests;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using (var serverStream = new VirtualNetworkStream(network, isServer: true))
using (var client = new SslStream(clientStream, false, AllowAnyServerCertificate))
using (var server = new SslStream(serverStream))
- using (X509Certificate2 certificate = CertificateConfiguration.GetServerCertificate())
+ using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate())
{
Task[] auth = new Task[2];
auth[0] = client.AuthenticateAsClientAsync(certificate.GetNameInfo(X509NameType.SimpleName, false));
using (var serverStream = new VirtualNetworkStream(network, isServer: true))
using (var client = new SslStream(clientStream))
using (var server = new SslStream(serverStream))
- using (var certificate = CertificateConfiguration.GetServerCertificate())
+ using (var certificate = Configuration.Certificates.GetServerCertificate())
{
Task[] auth = new Task[2];
auth[0] = client.AuthenticateAsClientAsync("incorrectServer");
private bool DoHandshake(SslStream clientSslStream, SslStream serverSslStream)
{
- using (X509Certificate2 certificate = CertificateConfiguration.GetServerCertificate())
+ using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate())
{
Task[] auth = new Task[2];
<Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
<Link>Common\System\PlatformDetection.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\CertificateConfiguration.cs">
- <Link>Common\System\Net\CertificateConfiguration.cs</Link>
- </Compile>
<Compile Include="$(CommonTestPath)\System\Net\Capability.Security.cs">
<Link>Common\System\Net\Capability.Security.cs</Link>
</Compile>
<Compile Include="$(CommonTestPath)\System\Net\Configuration.Security.cs">
<Link>Common\System\Net\Configuration.Security.cs</Link>
</Compile>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.Certificates.cs">
+ <Link>Common\System\Net\Configuration.Certificates.cs</Link>
+ </Compile>
<Compile Include="$(CommonTestPath)\System\Net\SchSendAuxRecordTestServer.cs">
<Link>Common\System\Net\SchSendAuxRecordTestServer.cs</Link>
</Compile>
<Compile Include="$(CommonTestPath)\System\Net\TestLogging.cs">
<Link>Common\System\Net\TestLogging.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\TestSettings.cs">
- <Link>Common\System\Net\TestSettings.cs</Link>
- </Compile>
<Compile Include="$(CommonTestPath)\System\Net\VerboseTestLogging.cs">
<Link>Common\System\Net\VerboseTestLogging.cs</Link>
</Compile>
<Compile Include="IdentityValidator.Unix.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsLinux)' == 'true' ">
- <None Include="..\Scripts\setup-kdc.sh">
+ <None Include="..\Scripts\Unix\setup-kdc.sh">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
- <None Include="..\Scripts\krb5.conf">
+ <None Include="..\Scripts\Unix\krb5.conf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
- <None Include="..\Scripts\kdc.conf.ubuntu">
+ <None Include="..\Scripts\Unix\kdc.conf.ubuntu">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
- <None Include="..\Scripts\kdc.conf.centos">
+ <None Include="..\Scripts\Unix\kdc.conf.centos">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
- <None Include="..\Scripts\kdc.conf.opensuse">
+ <None Include="..\Scripts\Unix\kdc.conf.opensuse">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="NegotiateStreamTestForUnix.cs" />
}
Assert.True(
- accepted.WaitOne(Configuration.PassingTestTimeout), "Test completed in alotted time");
+ accepted.WaitOne(TestSettings.PassingTestTimeout), "Test completed in alotted time");
Assert.Equal(
SocketError.Success, acceptArgs.SocketError);
using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
{
Assert.True(client.ConnectAsync(args));
- Assert.True(completed.WaitOne(Configuration.PassingTestTimeout), "IPv4: Timed out while waiting for connection");
+ Assert.True(completed.WaitOne(TestSettings.PassingTestTimeout), "IPv4: Timed out while waiting for connection");
Assert.Equal<SocketError>(SocketError.Success, args.SocketError);
}
}
using (Socket client = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp))
{
Assert.True(client.ConnectAsync(args));
- Assert.True(completed.WaitOne(Configuration.PassingTestTimeout), "IPv6: Timed out while waiting for connection");
+ Assert.True(completed.WaitOne(TestSettings.PassingTestTimeout), "IPv6: Timed out while waiting for connection");
Assert.Equal<SocketError>(SocketError.Success, args.SocketError);
}
}
args.UserToken = complete;
Assert.True(sock.ConnectAsync(args));
- Assert.True(complete.WaitOne(Configuration.PassingTestTimeout), "IPv4: Timed out while waiting for connection");
+ Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "IPv4: Timed out while waiting for connection");
Assert.True(args.SocketError == SocketError.Success);
sock.Dispose();
complete.Reset();
Assert.True(sock.ConnectAsync(args));
- Assert.True(complete.WaitOne(Configuration.PassingTestTimeout), "IPv6: Timed out while waiting for connection");
+ Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "IPv6: Timed out while waiting for connection");
Assert.True(args.SocketError == SocketError.Success);
}
finally
bool willRaiseEvent = sock.ConnectAsync(args);
if (willRaiseEvent)
{
- Assert.True(complete.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
+ Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
}
Assert.Equal(SocketError.Success, args.SocketError);
bool willRaiseEvent = sock.ConnectAsync(args);
if (willRaiseEvent)
{
- Assert.True(complete.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
+ Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
}
AssertHostNotFoundOrNoData(args);
bool willRaiseEvent = sock.ConnectAsync(args);
if (willRaiseEvent)
{
- Assert.True(complete.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
+ Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
}
Assert.Equal(SocketError.ConnectionRefused, args.SocketError);
Assert.True(Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, args));
- Assert.True(complete.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
+ Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
Assert.Equal(SocketError.Success, args.SocketError);
Assert.Null(args.ConnectByNameError);
Assert.True(Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, args));
- Assert.True(complete.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
+ Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
Assert.Equal(SocketError.Success, args.SocketError);
Assert.Null(args.ConnectByNameError);
OnConnectAsyncCompleted(null, args);
}
- Assert.True(complete.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
+ Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
AssertHostNotFoundOrNoData(args);
OnConnectAsyncCompleted(null, args);
}
- Assert.True(complete.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
+ Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
Assert.Equal(SocketError.ConnectionRefused, args.SocketError);
Assert.True(args.ConnectByNameError is SocketException);
socket.ConnectAsync(args);
- Assert.True(waitHandle.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
+ Assert.True(waitHandle.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
if (args.SocketError != SocketError.Success)
{
throw new SocketException((int)args.SocketError);
socket.ConnectAsync(args);
- Assert.True(waitHandle.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
+ Assert.True(waitHandle.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
if (args.SocketError != SocketError.Success)
{
throw new SocketException((int)args.SocketError);
Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, args);
- Assert.True(waitHandle.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
+ Assert.True(waitHandle.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
if (args.SocketError != SocketError.Success)
{
throw new SocketException((int)args.SocketError);
catch (SocketException) { }
Assert.True(
- client.WaitHandle.WaitOne(Configuration.PassingTestTimeout),
+ client.WaitHandle.WaitOne(TestSettings.PassingTestTimeout),
"Timed out while waiting for connection");
if (client.Error != SocketError.Success)
waitHandles[0] = waitHandle;
waitHandles[1] = client.WaitHandle;
- int completedHandle = WaitHandle.WaitAny(waitHandles, Configuration.PassingTestTimeout);
+ int completedHandle = WaitHandle.WaitAny(waitHandles, TestSettings.PassingTestTimeout);
if (completedHandle == WaitHandle.WaitTimeout)
{
using (SocketUdpServer server = new SocketUdpServer(_log, listenOn, dualModeServer, out port))
{
// Send a few packets, in case they aren't delivered reliably.
- for (int i = 0; i < (expectedToTimeout ? 1 : Configuration.UDPRedundancy); i++)
+ for (int i = 0; i < (expectedToTimeout ? 1 : TestSettings.UDPRedundancy); i++)
{
int sent = client.SendTo(new byte[1], new IPEndPoint(connectTo, port));
Assert.Equal(1, sent);
}
- bool success = server.WaitHandle.WaitOne(expectedToTimeout ? Configuration.FailingTestTimeout : Configuration.PassingTestTimeout); // Make sure the bytes were received
+ bool success = server.WaitHandle.WaitOne(expectedToTimeout ? TestSettings.FailingTestTimeout : TestSettings.PassingTestTimeout); // Make sure the bytes were received
if (!success)
{
throw new TimeoutException();
using (SocketUdpServer server = new SocketUdpServer(_log, listenOn, dualModeServer, out port))
{
// Send a few packets, in case they aren't delivered reliably.
- for (int i = 0; i < (expectedToTimeout ? 1 : Configuration.UDPRedundancy); i++)
+ for (int i = 0; i < (expectedToTimeout ? 1 : TestSettings.UDPRedundancy); i++)
{
IAsyncResult async = client.BeginSendTo(new byte[1], 0, 1, SocketFlags.None, new IPEndPoint(connectTo, port), null, null);
Assert.Equal(1, sent);
}
- bool success = server.WaitHandle.WaitOne(expectedToTimeout ? Configuration.FailingTestTimeout : Configuration.PassingTestTimeout); // Make sure the bytes were received
+ bool success = server.WaitHandle.WaitOne(expectedToTimeout ? TestSettings.FailingTestTimeout : TestSettings.PassingTestTimeout); // Make sure the bytes were received
if (!success)
{
throw new TimeoutException();
using (SocketUdpServer server = new SocketUdpServer(_log, listenOn, dualModeServer, out port))
{
// Send a few packets, in case they aren't delivered reliably.
- for (int i = 0; i < (expectedToTimeout ? 1 : Configuration.UDPRedundancy); i++)
+ for (int i = 0; i < (expectedToTimeout ? 1 : TestSettings.UDPRedundancy); i++)
{
using (ManualResetEvent waitHandle = new ManualResetEvent(false))
{
bool async = client.SendToAsync(args);
if (async)
{
- Assert.True(waitHandle.WaitOne(Configuration.PassingTestTimeout), "Timeout while waiting for connection");
+ Assert.True(waitHandle.WaitOne(TestSettings.PassingTestTimeout), "Timeout while waiting for connection");
}
Assert.Equal(1, args.BytesTransferred);
}
}
- bool success = server.WaitHandle.WaitOne(expectedToTimeout ? Configuration.FailingTestTimeout : Configuration.PassingTestTimeout); // Make sure the bytes were received
+ bool success = server.WaitHandle.WaitOne(expectedToTimeout ? TestSettings.FailingTestTimeout : TestSettings.PassingTestTimeout); // Make sure the bytes were received
if (!success)
{
throw new TimeoutException();
// Assert.Equal(connectTo.MapToIPv6(), remoteEndPoint.Address);
SocketUdpClient client = new SocketUdpClient(_log, serverSocket, connectTo, port, redundant: !expectedToTimeout);
- bool success = async.AsyncWaitHandle.WaitOne(expectedToTimeout ? Configuration.FailingTestTimeout : Configuration.PassingTestTimeout);
+ bool success = async.AsyncWaitHandle.WaitOne(expectedToTimeout ? TestSettings.FailingTestTimeout : TestSettings.PassingTestTimeout);
if (!success)
{
throw new TimeoutException();
bool async = serverSocket.ReceiveFromAsync(args);
SocketUdpClient client = new SocketUdpClient(_log, serverSocket, connectTo, port, redundant: !expectedToTimeout);
- if (async && !waitHandle.WaitOne(expectedToTimeout ? Configuration.FailingTestTimeout : Configuration.PassingTestTimeout))
+ if (async && !waitHandle.WaitOne(expectedToTimeout ? TestSettings.FailingTestTimeout : TestSettings.PassingTestTimeout))
{
throw new TimeoutException();
}
IPPacketInformation ipPacketInformation;
int received = 0;
- serverSocket.ReceiveTimeout = Configuration.FailingTestTimeout;
+ serverSocket.ReceiveTimeout = TestSettings.FailingTestTimeout;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
});
}
- serverSocket.ReceiveTimeout = expectedToTimeout ? Configuration.FailingTestTimeout : Configuration.PassingTestTimeout;
+ serverSocket.ReceiveTimeout = expectedToTimeout ? TestSettings.FailingTestTimeout : TestSettings.PassingTestTimeout;
SocketUdpClient client = new SocketUdpClient(_log, serverSocket, connectTo, port);
// Assert.Equal(connectTo.MapToIPv6(), remoteEndPoint.Address);
SocketUdpClient client = new SocketUdpClient(_log, serverSocket, connectTo, port, redundant: !expectedToTimeout);
- bool success = async.AsyncWaitHandle.WaitOne(expectedToTimeout ? Configuration.FailingTestTimeout : Configuration.PassingTestTimeout);
+ bool success = async.AsyncWaitHandle.WaitOne(expectedToTimeout ? TestSettings.FailingTestTimeout : TestSettings.PassingTestTimeout);
if (!success)
{
throw new TimeoutException();
{
using (Socket serverSocket = new Socket(SocketType.Dgram, ProtocolType.Udp))
{
- serverSocket.ReceiveTimeout = expectedToTimeout ? Configuration.FailingTestTimeout : Configuration.PassingTestTimeout;
+ serverSocket.ReceiveTimeout = expectedToTimeout ? TestSettings.FailingTestTimeout : TestSettings.PassingTestTimeout;
int port = serverSocket.BindToAnonymousPort(listenOn);
ManualResetEvent waitHandle = new ManualResetEvent(false);
catch (SocketException ex)
{
Error = ex.SocketErrorCode;
- Task.Delay(Configuration.FailingTestTimeout).Wait(); // Give the other end a chance to call Accept().
+ Task.Delay(TestSettings.FailingTestTimeout).Wait(); // Give the other end a chance to call Accept().
_serverSocket.Dispose(); // Cancels the test
_waitHandle.Set();
}
Error = e.SocketError;
if (Error != SocketError.Success)
{
- Task.Delay(Configuration.FailingTestTimeout).Wait(); // Give the other end a chance to call Accept().
+ Task.Delay(TestSettings.FailingTestTimeout).Wait(); // Give the other end a chance to call Accept().
_serverSocket.Dispose(); // Cancels the test
}
handle.Set();
{
Socket socket = new Socket(_connectTo.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
- for (int i = 0; i < (redundant ? Configuration.UDPRedundancy : 1); i++)
+ for (int i = 0; i < (redundant ? TestSettings.UDPRedundancy : 1); i++)
{
SocketAsyncEventArgs e = new SocketAsyncEventArgs();
e.RemoteEndPoint = new IPEndPoint(_connectTo, _port);
Assert.True(receiver.ReceiveMessageFromAsync(receiveArgs));
// Send a few packets, in case they aren't delivered reliably.
- for (int i = 0; i < Configuration.UDPRedundancy; i++)
+ for (int i = 0; i < TestSettings.UDPRedundancy; i++)
{
sender.SendTo(new byte[1], new IPEndPoint(IPAddress.Loopback, port));
}
Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
sender.Bind(new IPEndPoint(IPAddress.Loopback, 0));
- for (int i = 0; i < Configuration.UDPRedundancy; i++)
+ for (int i = 0; i < TestSettings.UDPRedundancy; i++)
{
sender.SendTo(new byte[1024], new IPEndPoint(IPAddress.Loopback, port));
}
Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
sender.Bind(new IPEndPoint(IPAddress.Loopback, 0));
- for (int i = 0; i < Configuration.UDPRedundancy; i++)
+ for (int i = 0; i < TestSettings.UDPRedundancy; i++)
{
sender.SendTo(new byte[1024], new IPEndPoint(IPAddress.Loopback, port));
}
Assert.True(receiver.ReceiveMessageFromAsync(args));
- Assert.True(completed.WaitOne(Configuration.PassingTestTimeout), "Timeout while waiting for connection");
+ Assert.True(completed.WaitOne(TestSettings.PassingTestTimeout), "Timeout while waiting for connection");
Assert.Equal(1024, args.BytesTransferred);
Assert.Equal(sender.LocalEndPoint, args.RemoteEndPoint);
int receiverPort = receiver.BindToAnonymousPort(IPAddress.Loopback);
var receiverEndpoint = new IPEndPoint(IPAddress.Loopback, receiverPort);
- for (int i = 0; i < Configuration.UDPRedundancy; i++)
+ for (int i = 0; i < TestSettings.UDPRedundancy; i++)
{
sender.SendTo(new byte[1], SocketFlags.None, receiverEndpoint);
}
int secondReceiverPort = secondReceiver.BindToAnonymousPort(IPAddress.Loopback);
var secondReceiverEndpoint = new IPEndPoint(IPAddress.Loopback, secondReceiverPort);
- for (int i = 0; i < Configuration.UDPRedundancy; i++)
+ for (int i = 0; i < TestSettings.UDPRedundancy; i++)
{
sender.SendTo(new byte[1], SocketFlags.None, firstReceiverEndpoint);
sender.SendTo(new byte[1], SocketFlags.None, secondReceiverEndpoint);
int secondReceiverPort = secondReceiver.BindToAnonymousPort(IPAddress.Loopback);
var secondReceiverEndpoint = new IPEndPoint(IPAddress.Loopback, secondReceiverPort);
- for (int i = 0; i < Configuration.UDPRedundancy; i++)
+ for (int i = 0; i < TestSettings.UDPRedundancy; i++)
{
sender.SendTo(new byte[1], SocketFlags.None, secondReceiverEndpoint);
}
int receiverPort = receiver.BindToAnonymousPort(IPAddress.Loopback);
var receiverEndpoint = new IPEndPoint(IPAddress.Loopback, receiverPort);
- for (int i = 0; i < Configuration.UDPRedundancy; i++)
+ for (int i = 0; i < TestSettings.UDPRedundancy; i++)
{
sender.SendTo(new byte[1], SocketFlags.None, receiverEndpoint);
}
if (sock.SendPacketsAsync(args))
{
- Assert.True(completed.WaitOne(Configuration.PassingTestTimeout), "Timed out");
+ Assert.True(completed.WaitOne(TestSettings.PassingTestTimeout), "Timed out");
}
Assert.Equal(SocketError.Success, args.SocketError);
Assert.Equal(0, args.BytesTransferred);
if (sock.SendPacketsAsync(args))
{
- Assert.True(completed.WaitOne(Configuration.PassingTestTimeout), "Timed out");
+ Assert.True(completed.WaitOne(TestSettings.PassingTestTimeout), "Timed out");
}
Assert.Equal(SocketError.Success, args.SocketError);
Assert.Equal(4, args.BytesTransferred);
if (sock.SendPacketsAsync(args))
{
- Assert.True(completed.WaitOne(Configuration.PassingTestTimeout), "Timed out");
+ Assert.True(completed.WaitOne(TestSettings.PassingTestTimeout), "Timed out");
}
Assert.Equal(expectedResut, args.SocketError);
Assert.Equal(bytesExpected, args.BytesTransferred);
sendSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, IPAddress.HostToNetworkOrder(interfaceIndex));
- for (int i = 0; i < Configuration.UDPRedundancy; i++)
+ for (int i = 0; i < TestSettings.UDPRedundancy; i++)
{
sendSocket.SendTo(Encoding.UTF8.GetBytes(message), new IPEndPoint(multicastAddress, port));
}
<Compile Include="UnixDomainSocketTest.cs" />
<!-- Common Sockets files -->
- <Compile Include="$(CommonTestPath)\System\Net\Sockets\Configuration.cs">
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.cs">
<Link>SocketCommon\Configuration.cs</Link>
</Compile>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.Sockets.cs">
+ <Link>SocketCommon\Configuration.Sockets.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonTestPath)\System\Net\Sockets\TestSettings.cs">
+ <Link>SocketCommon\TestSettings.cs</Link>
+ </Compile>
<Compile Include="$(CommonTestPath)\System\Net\Sockets\Fletcher32.cs">
<Link>SocketCommon\Fletcher32.cs</Link>
</Compile>
<Compile Include="$(CommonTestPath)\System\Net\TestLogging.cs">
<Link>Common\System\Net\TestLogging.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\TestSettings.cs">
- <Link>Common\System\Net\TestSettings.cs</Link>
- </Compile>
<Compile Include="$(CommonTestPath)\System\Net\VerboseTestLogging.cs">
<Link>Common\System\Net\VerboseTestLogging.cs</Link>
</Compile>
{
Assert.False(client.Connected);
- string host = TestSettings.Http.Host;
- const int port = 80;
+ string host = Configuration.Sockets.SocketServer.IdnHost;
+ int port = Configuration.Sockets.SocketServer.Port;
if (mode == 0)
{
client.ReceiveTimeout = 42;
client.SendTimeout = 84;
- await client.ConnectAsync(TestSettings.Http.Host, 80);
+ await client.ConnectAsync(Configuration.Sockets.SocketServer.IdnHost, Configuration.Sockets.SocketServer.Port);
// Verify their values remain as were set before connecting
Assert.True(client.LingerState.Enabled);
remoteSocket.Connect(IPAddress.IPv6Loopback, port);
Socket acceptedSocket = localSocket.EndAccept(localAsync);
- acceptedSocket.ReceiveTimeout = Configuration.FailingTestTimeout;
+ acceptedSocket.ReceiveTimeout = TestSettings.FailingTestTimeout;
SocketException sockEx = Assert.Throws<SocketException>(() =>
{
remoteSocket.Connect(IPAddress.IPv6Loopback, port);
Socket acceptedSocket = localSocket.EndAccept(localAsync);
- acceptedSocket.SendTimeout = Configuration.PassingTestTimeout;
+ acceptedSocket.SendTimeout = TestSettings.PassingTestTimeout;
// Note that Send almost never times out because it only has to copy the data to the native buffer.
int bytes = acceptedSocket.Send(new byte[100]);
_waitHandle.Reset();
udpClient.BeginSend(sendBytes, sendBytes.Length, remoteServer, new AsyncCallback(AsyncCompleted), udpClient);
- Assert.True(_waitHandle.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
+ Assert.True(_waitHandle.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection");
}
[Fact]
<Compile Include="SocketTestServerAPMMock.cs" />
<!-- Common Sockets files -->
- <Compile Include="$(CommonTestPath)\System\Net\Sockets\Configuration.cs">
- <Link>SocketCommon\Configuration.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Sockets\TestSettings.cs">
+ <Link>SocketCommon\TestSettings.cs</Link>
</Compile>
<Compile Include="$(CommonTestPath)\System\Net\Sockets\SocketTestServer.cs">
<Link>SocketCommon\SocketTestServer.cs</Link>
/// </summary>
public class ClientWebSocketTestBase
{
- public readonly static object[][] EchoServers = WebSocketTestServers.EchoServers;
- public readonly static object[][] EchoHeadersServers = WebSocketTestServers.EchoHeadersServers;
+ public readonly static object[][] EchoServers = Configuration.WebSockets.EchoServers;
+ public readonly static object[][] EchoHeadersServers = Configuration.WebSockets.EchoHeadersServers;
public const int TimeOutMilliseconds = 10000;
public const int CloseDescriptionMaxLength = 123;
// Known server but not a real websocket endpoint.
{
- server = HttpTestServers.RemoteEchoServer;
+ server = Configuration.Http.RemoteEchoServer;
var ub = new UriBuilder("ws", server.Host, server.Port, server.PathAndQuery);
yield return new object[] { ub.Uri };
[OuterLoop] // involves long delay
public async Task KeepAlive_LongDelayBetweenSendReceives_Succeeds()
{
- using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(WebSocketTestServers.RemoteEchoServer, TimeOutMilliseconds, _output, TimeSpan.FromSeconds(10)))
+ using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(Configuration.WebSockets.RemoteEchoServer, TimeOutMilliseconds, _output, TimeSpan.FromSeconds(10)))
{
await cws.SendAsync(new ArraySegment<byte>(new byte[1] { 42 }), WebSocketMessageType.Binary, true, CancellationToken.None);
<Compile Include="$(CommonTestPath)\System\AssertExtensions.cs">
<Link>Common\System\AssertExtensions.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\HttpTestServers.cs">
- <Link>Common\System\Net\HttpTestServers.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.cs">
+ <Link>Common\System\Net\Configuration.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\TestSettings.cs">
- <Link>Common\System\Net\TestSettings.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.Http.cs">
+ <Link>Common\System\Net\Configuration.Http.cs</Link>
</Compile>
- <Compile Include="$(CommonTestPath)\System\Net\WebSocketTestServers.cs">
- <Link>Common\System\Net\WebSocketTestServers.cs</Link>
+ <Compile Include="$(CommonTestPath)\System\Net\Configuration.WebSockets.cs">
+ <Link>Common\System\Net\Configuration.WebSockets.cs</Link>
</Compile>
<Compile Include="AbortTest.cs" />
<Compile Include="CancelTest.cs" />