OK, added 2 lines marked below 

 

      do_close = (c->ch.connection.v_vec.len >= vec.len 

      && !_shttpd_strncasecmp(vec.ptr,c->ch.connection.v_vec.ptr,vec.len)

            ) ||

          (c->major_version < 1 ||

          (c->major_version >= 1 && c->minor_version < 1));

 

      if (c->loc.content_len > 0)         // Added these lines to force 
connection

            do_close = 1;                 // to close if len > 0

 

I also tried commenting out _shttpd_set_nonblocking_mode() in 
shttpd_socketpair() as I saw some follow-ups about trying this as well.   It 
didn’t seem to make any difference.  Both the shttpd executable and the web 
browser are run on same machine.

 

In any event, modifying the do_close  provides a major improvement, but it does 
not fix the problem.   Without the patch, I get anywhere from 1-16 refreshes.  
With the patch, I ranged from low of 1 to high of 4314 refreshes.  (But 
regardless, both read and write socket can fail).   

Here is dump of 941 iterations, then I ran it again immediately afterword and 
it only got one refresh.    Here is the full dump of the iteration that only 
ran through one cycle before losing the socket.

 

Is there a hack that can be added to just reestablish the socket if it closes 
and then just move on?   

 

(TAIL END OF RUN THAT LASTED 941 ITERATIONS)

decide_what_to_do: [/people-list.txt?_dc=1227620095607]

is_alias: aliases [/extjs=extjs,/images=images,/icons=icons,/data=root]

loc: 191 [HTTP/1.1 200 OK

Date: Tue, 25 Nov 2008 07:34:55 GMT

Last-Modified: Tue, 25 Nov 2008 07:33:18 GMT

Etag: "492bfe9e.3d"

Content-Type: text/plain

Content-Length: 61

Accept-Ranges: bytes

 

]

rem: 0 []

write_stream (1844 socket): written -1/191 bytes (errno 10054)

1844 (null) stopped. 0 of content data, 0 now in a buffer

wrndebugw --- socket closed, this is bad, unless program just started. 
ERRNO=10054,RemMethod=1

nIterations = 941

New instance that runs for just one iteration….  

 

C:\msdevstd\projects\VideoAgent\vc2005\Release>videoagent

shttpd_listen: added socket 1936

shttpd_listen: added socket 1936

shttpd_listen: added socket 1908

Started on ports(s) 4079,4080, serving HTML

FD_SET(1936) (listening)

FD_SET(1908) (listening)

192.168.1.155:4079 connected (socket 1848)

192.168.1.155:4079 connected (socket 1836)

0.0.0.0:4079 connected (socket 1824)

0.0.0.0:4079 connected (socket 1812)

192.168.1.155:4079 connected (socket 1800)

loc: 0 []

rem: 0 []

loc: 0 []

rem: 0 []

loc: 0 []

rem: 0 []

loc: 0 []

rem: 0 []

loc: 0 []

rem: 0 []

FD_SET(1936) (listening)

FD_SET(1908) (listening)

read_stream (1848 socket): read 496/16384/496 bytes (errno 0)

Conn 1848: parsing request: [GET /people-list.txt?_dc=1227620166970 HTTP/1.1

Accept: */*

Accept-Language: en-us

Referer: http://192.168.1.155:4079/index5.html

x-requested-with: XMLHttpRequest

UA-CPU: x86

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 
1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; 
InfoPath.

2; .NET CLR 3.5.21022; FDM; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

Host: 192.168.1.155:4079

Connection: Keep-Alive

 

]

parsing headers (len 447): [Accept: */*

Accept-Language: en-us

Referer: http://192.168.1.155:4079/index5.html

x-requested-with: XMLHttpRequest

UA-CPU: x86

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 
1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; 
InfoPath.

2; .NET CLR 3.5.21022; FDM; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

Host: 192.168.1.155:4079

Connection: Keep-Alive

 

]

decide_what_to_do: [/people-list.txt?_dc=1227620166970]

is_alias: aliases [/extjs=extjs,/images=images,/icons=icons,/data=root]

loc: 191 [HTTP/1.1 200 OK

Date: Tue, 25 Nov 2008 07:36:09 GMT

Last-Modified: Tue, 25 Nov 2008 07:36:08 GMT

Etag: "492bff48.3d"

Content-Type: text/plain

Content-Length: 61

Accept-Ranges: bytes

 

]

rem: 0 []

write_stream (1848 socket): written 191/191 bytes (errno 0)

1836 (null) stopped. 0 of content data, 0 now in a buffer

read_stream (1836 (null)): read 0/16384/0 bytes (errno 0)

loc: 0 []

rem: 0 []

Disconnecting 1836 ()

1824 (null) stopped. 0 of content data, 0 now in a buffer

read_stream (1824 (null)): read -1/16384/0 bytes (errno 10054)

debug --- socket closed, this is bad, unless program just started. 
ERRNO=10054,RemMethod=1

nIterations = 1

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
shttpd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shttpd-general

Reply via email to