I uploaded a newer version that seems to solve some issues I discovered these last days. I found a condition that triggered a double close, for example, and a more worrying endless loop when the peer closes the socket before the server... POSIX sockets are really as painful as they seem !
I reworked some functions and it changed the behaviour of the browsers, I got the following effects :
- Firefox 57 desktop: works well. No extra socket is opened apparently now. Load score : 24/24 elements, favicon loaded.
- Chrome still has problems : load score = 17/23, 6 extra sockets opened close to the end, no favicon.
Remote (over the internet) :
- Firefox (desktop Linux as well as Android) : 51 extra connections, 19 elements loaded, no favicon...
- Chrome : 8 elements loaded, 17 extra sockets...
The local scores are those that matter because HTTaP is not intended to be used over the WWW (though of course it would be better if it could but then multi-threading would become necessary, and it's out of scope). Normally, HTTaP is used over a simple LAN.
The change is that serving the pages is done in priority, while checking the incoming connections has lost its precedence.
Another problem is when receiving zero-sized packets. TCP/IP seems to allow this, and it might help with sending keepalive packets. However the BSD standards indicate the closure of a socket by reading 0 bytes. It is no obvious/simple to verify this with a different method (I considered testing with poll() and checking for POLLOUT in the .revent...) so I have chosen to simply leave this case alone, and close the socket.
Due to interferences with Facebook's URL hijacks, I added a special HTTaP 400 error message with a link to the main page.
For example http://httap.org:60075/?invalid will return an error 400 with the following clear text message:
HTTaP key not found. main site
The above links work well with Chrome (to the extent that it displays the page). However Firefox will fire 10 sockets and send no data on the first one... and then that connection times out after all the others have been rejected. WTF ???
On the server side, there are two big things to code now :
- the HTTaP custom code / tree build system
- creating the example with both blocking and polling
The second part is partially written so it will be done first, but having the HTTaP keys build API would help too...
Then I'll start to write more JS to be included in HTML, to help with loading the extra external elements (a for-loop to sequentially load the images from reading the HTML source code)
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.