Skip to content

Commit cd6478a

Browse files
committed
Added Timeout for large files. Unfortunately .NET doesn't distinguish between read and write timeouts and assumes if there isn't a response it must have failed - despite the write queue being active. The assumption of setting this to Infinite is that the other end (Akamai Edge) will terminate the connection properly if it is sufficiently idle.
1 parent 75b3a8d commit cd6478a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

NetStorage/NetstorageCMSv35Signer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ public Stream Execute(WebRequest request = null)
210210
{
211211
//Disable the nastiness of Expect100Continue
212212
ServicePointManager.Expect100Continue = false;
213+
//Another hack to avoid problems with the read timeout even though the
214+
//bytes are being sent to the client. .NET doesn't distinguish between
215+
//a read timeout and a writetimeout.
216+
request.Timeout = System.Threading.Timeout.Infinite;
217+
213218

214219
if (this.UploadStream == null)
215220
request.ContentLength = 0;

NetStorageTest/HttpWebRequestTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class HttpWebRequestTest : WebRequest
4949
public override string Method { get; set; }
5050
public override WebHeaderCollection Headers { get; set; }
5151
public override long ContentLength { get; set; }
52+
public override int Timeout { get; set; }
5253

5354
private Uri itemUri;
5455
public WebResponse NextResponse = null;

0 commit comments

Comments
 (0)