Skip to content

Commit bfbd515

Browse files
committed
Add PCL provider overloads for Config(WebRequest)
1 parent 13eeb80 commit bfbd515

5 files changed

Lines changed: 83 additions & 18 deletions

File tree

src/ServiceStack.Pcl.Android/PclExport.Net40.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,19 @@ public virtual void EndThreadAffinity()
384384
Thread.EndThreadAffinity();
385385
}
386386

387-
public override void Config(HttpWebRequest webReq, bool? allowAutoRedirect = null, TimeSpan? timeout = null, TimeSpan? readWriteTimeout = null)
388-
{
389-
webReq.MaximumResponseHeadersLength = int.MaxValue; //throws "The message length limit was exceeded" exception
390-
if (allowAutoRedirect.HasValue) webReq.AllowAutoRedirect = allowAutoRedirect.Value;
391-
if (readWriteTimeout.HasValue) webReq.ReadWriteTimeout = (int)readWriteTimeout.Value.TotalMilliseconds;
392-
if (timeout.HasValue) webReq.Timeout = (int)timeout.Value.TotalMilliseconds;
387+
public override void Config(HttpWebRequest req,
388+
bool? allowAutoRedirect = null,
389+
TimeSpan? timeout = null,
390+
TimeSpan? readWriteTimeout = null,
391+
string userAgent = null,
392+
bool? preAuthenticate = null)
393+
{
394+
req.MaximumResponseHeadersLength = int.MaxValue; //throws "The message length limit was exceeded" exception
395+
if (allowAutoRedirect.HasValue) req.AllowAutoRedirect = allowAutoRedirect.Value;
396+
if (readWriteTimeout.HasValue) req.ReadWriteTimeout = (int)readWriteTimeout.Value.TotalMilliseconds;
397+
if (timeout.HasValue) req.Timeout = (int)timeout.Value.TotalMilliseconds;
398+
if (userAgent != null) req.UserAgent = userAgent;
399+
if (preAuthenticate.HasValue) req.PreAuthenticate = preAuthenticate.Value;
393400
}
394401

395402
#if !__IOS__

src/ServiceStack.Pcl.Net45/PclExport.Net40.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,19 @@ public virtual void EndThreadAffinity()
384384
Thread.EndThreadAffinity();
385385
}
386386

387-
public override void Config(HttpWebRequest webReq, bool? allowAutoRedirect = null, TimeSpan? timeout = null, TimeSpan? readWriteTimeout = null)
388-
{
389-
webReq.MaximumResponseHeadersLength = int.MaxValue; //throws "The message length limit was exceeded" exception
390-
if (allowAutoRedirect.HasValue) webReq.AllowAutoRedirect = allowAutoRedirect.Value;
391-
if (readWriteTimeout.HasValue) webReq.ReadWriteTimeout = (int)readWriteTimeout.Value.TotalMilliseconds;
392-
if (timeout.HasValue) webReq.Timeout = (int)timeout.Value.TotalMilliseconds;
387+
public override void Config(HttpWebRequest req,
388+
bool? allowAutoRedirect = null,
389+
TimeSpan? timeout = null,
390+
TimeSpan? readWriteTimeout = null,
391+
string userAgent = null,
392+
bool? preAuthenticate = null)
393+
{
394+
req.MaximumResponseHeadersLength = int.MaxValue; //throws "The message length limit was exceeded" exception
395+
if (allowAutoRedirect.HasValue) req.AllowAutoRedirect = allowAutoRedirect.Value;
396+
if (readWriteTimeout.HasValue) req.ReadWriteTimeout = (int)readWriteTimeout.Value.TotalMilliseconds;
397+
if (timeout.HasValue) req.Timeout = (int)timeout.Value.TotalMilliseconds;
398+
if (userAgent != null) req.UserAgent = userAgent;
399+
if (preAuthenticate.HasValue) req.PreAuthenticate = preAuthenticate.Value;
393400
}
394401

395402
#if !__IOS__

src/ServiceStack.Pcl.iOS/PclExport.Net40.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,19 @@ public virtual void EndThreadAffinity()
384384
Thread.EndThreadAffinity();
385385
}
386386

387-
public override void Config(HttpWebRequest webReq, bool? allowAutoRedirect = null, TimeSpan? timeout = null, TimeSpan? readWriteTimeout = null)
388-
{
389-
webReq.MaximumResponseHeadersLength = int.MaxValue; //throws "The message length limit was exceeded" exception
390-
if (allowAutoRedirect.HasValue) webReq.AllowAutoRedirect = allowAutoRedirect.Value;
391-
if (readWriteTimeout.HasValue) webReq.ReadWriteTimeout = (int)readWriteTimeout.Value.TotalMilliseconds;
392-
if (timeout.HasValue) webReq.Timeout = (int)timeout.Value.TotalMilliseconds;
387+
public override void Config(HttpWebRequest req,
388+
bool? allowAutoRedirect = null,
389+
TimeSpan? timeout = null,
390+
TimeSpan? readWriteTimeout = null,
391+
string userAgent = null,
392+
bool? preAuthenticate = null)
393+
{
394+
req.MaximumResponseHeadersLength = int.MaxValue; //throws "The message length limit was exceeded" exception
395+
if (allowAutoRedirect.HasValue) req.AllowAutoRedirect = allowAutoRedirect.Value;
396+
if (readWriteTimeout.HasValue) req.ReadWriteTimeout = (int)readWriteTimeout.Value.TotalMilliseconds;
397+
if (timeout.HasValue) req.Timeout = (int)timeout.Value.TotalMilliseconds;
398+
if (userAgent != null) req.UserAgent = userAgent;
399+
if (preAuthenticate.HasValue) req.PreAuthenticate = preAuthenticate.Value;
393400
}
394401

395402
#if !__IOS__

src/ServiceStack.Pcl.sln

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PclTest.Wpf", "..\tests\Pcl
4040
EndProject
4141
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PclTest.Ios", "..\tests\PclTest.Ios\PclTest.Ios.csproj", "{99D4E441-2BF2-4F4C-AA0C-25211A3FACC1}"
4242
EndProject
43+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.PCL", "..\..\ServiceStack.Text\src\ServiceStack.Text\ServiceStack.Text.PCL.csproj", "{579B3FDB-CDAD-44E1-8417-885C38E49A0E}"
44+
EndProject
4345
Global
4446
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4547
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@@ -596,6 +598,42 @@ Global
596598
{99D4E441-2BF2-4F4C-AA0C-25211A3FACC1}.Release|Mixed Platforms.Build.0 = Release|iPhone
597599
{99D4E441-2BF2-4F4C-AA0C-25211A3FACC1}.Release|x64.ActiveCfg = Release|iPhone
598600
{99D4E441-2BF2-4F4C-AA0C-25211A3FACC1}.Release|x86.ActiveCfg = Release|iPhone
601+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
602+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
603+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU
604+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
605+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
606+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU
607+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU
608+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU
609+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
610+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
611+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.AppStore|Any CPU.Build.0 = Release|Any CPU
612+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.AppStore|ARM.ActiveCfg = Release|Any CPU
613+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.AppStore|iPhone.ActiveCfg = Release|Any CPU
614+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
615+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU
616+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU
617+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.AppStore|x64.ActiveCfg = Release|Any CPU
618+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.AppStore|x86.ActiveCfg = Release|Any CPU
619+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
620+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
621+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|ARM.ActiveCfg = Debug|Any CPU
622+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
623+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
624+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
625+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
626+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|x64.ActiveCfg = Debug|Any CPU
627+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|x86.ActiveCfg = Debug|Any CPU
628+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
629+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.Build.0 = Release|Any CPU
630+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|ARM.ActiveCfg = Release|Any CPU
631+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|iPhone.ActiveCfg = Release|Any CPU
632+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
633+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
634+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
635+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|x64.ActiveCfg = Release|Any CPU
636+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|x86.ActiveCfg = Release|Any CPU
599637
EndGlobalSection
600638
GlobalSection(SolutionProperties) = preSolution
601639
HideSolutionNode = FALSE

src/ServiceStack.SL5.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{84C3EC13
1616
..\build\copy-sl5.bat = ..\build\copy-sl5.bat
1717
EndProjectSection
1818
EndProject
19+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.SL5", "..\..\ServiceStack.Text\src\ServiceStack.Text\ServiceStack.Text.SL5.csproj", "{579B3FDB-CDAD-44E1-8417-885C38E49A0E}"
20+
EndProject
1921
Global
2022
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2123
Debug|Any CPU = Debug|Any CPU
@@ -42,6 +44,10 @@ Global
4244
{42E1C8C0-A163-44CC-92B1-8F416F2C0B01}.Debug|Any CPU.Build.0 = Debug|Any CPU
4345
{42E1C8C0-A163-44CC-92B1-8F416F2C0B01}.Release|Any CPU.ActiveCfg = Release|Any CPU
4446
{42E1C8C0-A163-44CC-92B1-8F416F2C0B01}.Release|Any CPU.Build.0 = Release|Any CPU
47+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
48+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
49+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
50+
{579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.Build.0 = Release|Any CPU
4551
EndGlobalSection
4652
GlobalSection(SolutionProperties) = preSolution
4753
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)