I thought going in that getting HTTP/1.1 pipelining right was going to be the trickiest part, but on further investigation none of the major browsers use it. Apparently enough web servers screw it up to prevent it.
In the absence of pipelining I decided to forgo keep-alive entirely in favor of simplicity. By careful use of TCP options I only need 3 outgoing packets for each request (up to 1.mumble kbytes). The SYN-ACK, an ACK-Data-FIN, and a FIN-ACK.
An interesting performance issue: Safari shotguns me with many simultaneous connections, to which my httpd responds quickly. If I were supporting keep-alive I think Safari would be encouraged to only use two connections and serialize the requests over them. I wonder which is faster? I may have to add keep-alive support just to answer this question.
Another interesting tidbit: Some people on the web maintain that TCP_QUICKACK and TCP_DEFER_ACCEPT are inherited from the listener socket to the accepted socket. I don't think so. At least the only way I can get QUICKACK turned off is to not use TCP_DEFER_ACCEPT on the listening socket and slam TCP_QUICKACK off on the accepted socket before the first data arrives. Otherwise I end up sending an ACK before my first data packet.
And a last tidbit: You can keep your TCP_CORK in all the to shutdown(), that gets your FIN piggybacked on your last data packet.
The application where I was going to use libmicrohttpd requires me to crosscompile and after hours of thrashing about I still can't get it to build.
Back to the bit heap with it. I'll write my own httpd code.
Things fixed so far:
- IE does not have contentDocument, use contentWindow instead.
- addEventListenter/attachEvent silliness.
- The focus and blur events go on the IFRAME's contentWindow, except Firefox needs it on the contentWindow.document. (Not an IE problem, but my first IE fix broke this.)
- The absolute DIV needed an explicit .style.left as it was positioning to the right of the parent.
- Odd problem where a delete n.moseyTimer was leaving the value there. I had to set it to false explicitly.
- Lucky break: accidentally found a problem with which document I use to make the .selection() call while wresting the fleeing tool bar.
- Wash me. Unable to keep the toolbar from taking focus, I have resorted to a timer to notice if a toolbar hide is a result of the toolbar being clicked and suppressing the hide.
- IE is still doing amusing things with the spaces around selections when it wraps them. More hackery to come.
Ok, comments seem to be at least minimally functional with the new editor code in Safari.
- Switch new post editing over to the new style.
- Make sure I didn't break Firefox.
- Patch things up so IE works.
- Make a safe fallback to HTML for browsers without designMode.
When suddenly…
In the process of trying to see how tinyMCE got paste to work, and also realizing that I couldn't find the code they used to move the cursor in response to an arrow key I discovered contentEditable and its buddy designMode which Firefox will require. This is now a much easier problem. I will throw away all my beautiful code and just make a handful of API calls.
And just when I thought there was still a reason for giants to roam the earth.