#1 2015-10-25 05:41:53

profh
Member
Registered: 2010-07-02
Posts: 161

Http Error 406

ab,

i post a 350M file separately to two servers, server with windows 10 works fine, but client got Http Error 406 message from server with windows server 2003.
is it about default file size limitation?

thanks.

Offline

#2 2015-10-25 07:28:14

profh
Member
Registered: 2010-07-02
Posts: 161

Re: Http Error 406

i found that Http.ReceiveRequestEntityBody got 1450 result.

Last edited by profh (2015-10-25 07:30:30)

Offline

#3 2015-10-26 06:43:51

profh
Member
Registered: 2010-07-02
Posts: 161

Re: Http Error 406

it works after i modify the code of THttpApiServer.Execute in SynCrtSock.pas:

from:

              Err := Http.ReceiveRequestEntityBody(fReqQueue,Req^.RequestId,flags,
                BufRead,InContentLength-InContentLengthRead,BytesRead);

to:

              Err := Http.ReceiveRequestEntityBody(fReqQueue,Req^.RequestId,flags,
                BufRead,2048,BytesRead);

and i can upload file more than 1024M now.

Offline

#4 2015-11-16 08:56:41

akirabbq
Member
Registered: 2012-12-03
Posts: 9

Re: Http Error 406

Thanks you I've just come across the same problem. The buffer shouldn't need to be the same size as the content since the reading part is already being done in a loop. Setting the buffer too large (around 20MB in my case) will throw an ERROR_NO_SYSTEM_RESOURCES (1450) exception.

More info:

https://msdn.microsoft.com/en-us/librar … s.85).aspx

Offline

#5 2015-11-16 09:48:12

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Http Error 406

I've introduced ReceiveBufferSize property to avoid Http Error 406 when serving huge files in THttpApiServer.Execute.

By default, the value is 1MB, which should be fine in most cases.
See http://synopse.info/fossil/info/bf9d307be4

Offline

#6 2015-11-17 00:49:40

profh
Member
Registered: 2010-07-02
Posts: 161

Re: Http Error 406

awesome. smile

Offline

Board footer

Powered by FluxBB