Skip to content

Commit 7dd3f9f

Browse files
committed
Update src/SharpGIS.GZipWebClient/GZipHttpWebRequest.cs
Better support for clients that relies on specific HttpWebRequest properties
1 parent 468de2e commit 7dd3f9f

1 file changed

Lines changed: 87 additions & 0 deletions

File tree

src/SharpGIS.GZipWebClient/GZipHttpWebRequest.cs

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,93 @@ public override WebHeaderCollection Headers
7373
set { _internalWebRequest.Headers = value; }
7474
}
7575

76+
public override bool SupportsCookieContainer
77+
{
78+
get
79+
{
80+
if (_internalWebRequest is HttpWebRequest)
81+
return (_internalWebRequest as HttpWebRequest).SupportsCookieContainer;
82+
else
83+
return base.SupportsCookieContainer;
84+
}
85+
}
86+
87+
public override CookieContainer CookieContainer
88+
{
89+
get
90+
{
91+
if (_internalWebRequest is HttpWebRequest)
92+
return (_internalWebRequest as HttpWebRequest).CookieContainer;
93+
else
94+
return base.CookieContainer;
95+
}
96+
set
97+
{
98+
if (_internalWebRequest is HttpWebRequest)
99+
(_internalWebRequest as HttpWebRequest).CookieContainer = value;
100+
else
101+
throw new NotSupportedException();
102+
}
103+
}
104+
105+
public override bool AllowAutoRedirect
106+
{
107+
get
108+
{
109+
if (_internalWebRequest is HttpWebRequest)
110+
return (_internalWebRequest as HttpWebRequest).AllowAutoRedirect;
111+
else
112+
return base.AllowAutoRedirect;
113+
}
114+
set
115+
{
116+
if (_internalWebRequest is HttpWebRequest)
117+
(_internalWebRequest as HttpWebRequest).AllowAutoRedirect = value;
118+
else
119+
throw new NotSupportedException();
120+
}
121+
}
122+
123+
public override bool HaveResponse
124+
{
125+
get
126+
{
127+
if (_internalWebRequest is HttpWebRequest)
128+
return (_internalWebRequest as HttpWebRequest).HaveResponse;
129+
else
130+
return base.HaveResponse;
131+
}
132+
}
133+
134+
public override bool AllowReadStreamBuffering
135+
{
136+
get
137+
{
138+
if (_internalWebRequest is HttpWebRequest)
139+
return (_internalWebRequest as HttpWebRequest).AllowReadStreamBuffering;
140+
else
141+
return base.AllowReadStreamBuffering;
142+
}
143+
set
144+
{
145+
if (_internalWebRequest is HttpWebRequest)
146+
(_internalWebRequest as HttpWebRequest).AllowReadStreamBuffering = value;
147+
else
148+
throw new NotSupportedException();
149+
}
150+
}
151+
152+
public override IWebRequestCreate CreatorInstance
153+
{
154+
get
155+
{
156+
if (_internalWebRequest is HttpWebRequest)
157+
return (_internalWebRequest as HttpWebRequest).CreatorInstance;
158+
else
159+
return base.CreatorInstance;
160+
}
161+
}
162+
76163
public override void Abort()
77164
{
78165
_internalWebRequest.Abort();

0 commit comments

Comments
 (0)