http://wiki.armagetronad.org/index.php?title=Embedded_Web_Server&feed=atom&action=historyEmbedded Web Server - Revision history2024-03-28T15:20:38ZRevision history for this page on the wikiMediaWiki 1.35.3http://wiki.armagetronad.org/index.php?title=Embedded_Web_Server&diff=56690&oldid=prevCadillac at 15:08, 23 August 20212021-08-23T15:08:41Z<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 15:08, 23 August 2021</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l77" >Line 77:</td>
<td colspan="2" class="diff-lineno">Line 77:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>ANd, in the process there's no telling what I broke. Hopefully not much, because tDirectories is the only file I've touched outside of uWebInterface and the shttpd files.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>ANd, in the process there's no telling what I broke. Hopefully not much, because tDirectories is the only file I've touched outside of uWebInterface and the shttpd files.</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:Development]]</ins></div></td></tr>
</table>Cadillachttp://wiki.armagetronad.org/index.php?title=Embedded_Web_Server&diff=2268&oldid=prevPhilippeqc: Removed MAP_URI2005-11-20T21:26:36Z<p>Removed MAP_URI</p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 21:26, 20 November 2005</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l74" >Line 74:</td>
<td colspan="2" class="diff-lineno">Line 74:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Still need to add the config option that tells the client to get resources from the embedded webserver and then the code to the client that actually does it. Anything else in this area is dressing. But as it stands right now, the URI should be http://SERVER:PORT/resource/PATH/TO/RESOURCE as Luke-Jr requested. So the client needs to know what the PORT is as well. To add that the way I was wanting I need to transfer the webserver config items to nSettingItems as appropriate, others to other types of course, and then add a series of calls in uWebInterface::Initialize() to initialize the webserver with them, and remove the webserver's call to open its own config file, adding that instead to the dedicated server itself. Most of the options should just stay the same as in the webserver, but some need to be changed (PORT being one of them, it's taken, and too ambiguous anyway).</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Still need to add the config option that tells the client to get resources from the embedded webserver and then the code to the client that actually does it. Anything else in this area is dressing. But as it stands right now, the URI should be http://SERVER:PORT/resource/PATH/TO/RESOURCE as Luke-Jr requested. So the client needs to know what the PORT is as well. To add that the way I was wanting I need to transfer the webserver config items to nSettingItems as appropriate, others to other types of course, and then add a series of calls in uWebInterface::Initialize() to initialize the webserver with them, and remove the webserver's call to open its own config file, adding that instead to the dedicated server itself. Most of the options should just stay the same as in the webserver, but some need to be changed (PORT being one of them, it's taken, and too ambiguous anyway).</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Other than that, I'm not too far off from having a basic web-based admin GUI for the server and also having it serve up its own resources. Technically it can already do that if you put the right MAP_URI in your config file for it.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">''</ins>Other than that, I'm not too far off from having a basic web-based admin GUI for the server and also having it serve up its own resources. Technically it can already do that if you put the right MAP_URI in your config file for it<ins class="diffchange diffchange-inline">.'' This is no longer true. MAP_URI has been removed, as it is possible to write the MAP_FILE as "directory/file (http://some.server.com/another_directory/file; http://alternative.server.com/alternative_dir/file)". Also, I think there are 2 resource repository configuration items, one for the client, one for the server. IIRC, the server could point to its onw web server this way</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>ANd, in the process there's no telling what I broke. Hopefully not much, because tDirectories is the only file I've touched outside of uWebInterface and the shttpd files.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>ANd, in the process there's no telling what I broke. Hopefully not much, because tDirectories is the only file I've touched outside of uWebInterface and the shttpd files.</div></td></tr>
</table>Philippeqchttp://wiki.armagetronad.org/index.php?title=Embedded_Web_Server&diff=1692&oldid=prevLucifer at 08:14, 23 October 20052005-10-23T08:14:26Z<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 08:14, 23 October 2005</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>''<del class="diffchange diffchange-inline">Also </del>taken from the forums''</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">The embedded web server is intended to provide a default installation of the dedicated server that is capable of serving its own resources to clients, providing a statistics page for players, and providing a remote administration function for administrators. It</ins>'<ins class="diffchange diffchange-inline">s not intended to replace in-game admin, of course, but to supplement it. As additional stuff gets added, it should be possible to add things to the web interface like managing tournaments and other things I</ins>'<ins class="diffchange diffchange-inline">m not thinking of right now.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">== shttpd ==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">The web server uses a neat little program called shttpd. It's a program written with the intent of being an embeddable webserver and is used on some routers. It has a very liberal license that is compatible with the GPL, allowing us to include it in the game. It's a C API that supports callbacks, CGI, and some other things.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">== Serving Resources ==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">This is only partially implemented. I added to the web server the ability to put multiple mount points under the web root so that we can put the <code>resource</code> directory under the web root. There's a couple of things here left to implement. Mainly the game server needs to be able to tell clients a proper URL for resources that uses this web server. Then there needs to be some config items for administrators to use to configure the web server's resource service.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">It is this need that primarily introduces the requirement that the webserver be available in the regular client distribution. When a player wants to host a game from his machine using his game client, he should have this web server available to serve ''his'' resources.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">=== How the embedded server will interact with the resource server ===</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">TODO</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">== Player Web Pages ==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">This is only half-baked right now. We have several options.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">* CGI</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">The CGI doesn't currently work in our embedded setup. This needs some troubleshooting. We should support it since it's there and server admins will probably want to be able to use it, even if we don't. In any case, we can provide an interface for players by writing simple CGI scripts, or even writing some C++ programs to do it if we don't want to introduce a scripting dependency for this.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">* Callbacks</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">This is the most likely way we'll go in the foreseeable future. Using the callback interface of the webserver, we can provide pages generated by C++ code in the armagetronad-dedicated process.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">* Python</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">After we have embedded Python, this is the most logical way to go, in which case we will likely still have the scripts executed inside the armagetronad-dedicated process, they'll just be Python scripts instead of C++ code.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">== Administrator Web Pages ==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">So I created a callback for the /admin url. Smile So after you have it running you can visit http://YOURSERVERWITHPORT/admin?cmd=SOMECOMMAND&value=VALUE</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">And that command will be executed. Smile I'm going to look next hopefully into putting some protection on that url so a user and pass will be required, hopefully configurable somewhere. Smile But I figured that would be a good start to see if I could do it, anyway.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">== Configuring the Web Server ==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">TODO</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">== Old Stuff (left here for reference) ==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">''Remainder </ins>taken from the forums''</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>In any case, the web interface now uses its config file. It's still a little messy in one spot, but I'll clean it up. I logged in to the dedicated server with a game client and then hit the web server and noticed no problems with the polling or anything. Since I set the web server to compile in multi-threaded mode, it should start a new thread for every page request, so they shouldn't be served from within the game loop, although the polling for new connections is done in the game loop. (This is what has so far saved me from having to make the uWebInterface class start its own thread) </div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>In any case, the web interface now uses its config file. It's still a little messy in one spot, but I'll clean it up. I logged in to the dedicated server with a game client and then hit the web server and noticed no problems with the polling or anything. Since I set the web server to compile in multi-threaded mode, it should start a new thread for every page request, so they shouldn't be served from within the game loop, although the polling for new connections is done in the game loop. (This is what has so far saved me from having to make the uWebInterface class start its own thread) </div></td></tr>
</table>Luciferhttp://wiki.armagetronad.org/index.php?title=Embedded_Web_Server&diff=1477&oldid=prevLucifer at 08:11, 22 October 20052005-10-22T08:11:06Z<p></p>
<p><b>New page</b></p><div>''Also taken from the forums''<br />
<br />
In any case, the web interface now uses its config file. It's still a little messy in one spot, but I'll clean it up. I logged in to the dedicated server with a game client and then hit the web server and noticed no problems with the polling or anything. Since I set the web server to compile in multi-threaded mode, it should start a new thread for every page request, so they shouldn't be served from within the game loop, although the polling for new connections is done in the game loop. (This is what has so far saved me from having to make the uWebInterface class start its own thread) <br />
<br />
----<br />
<br />
For the repository thing, there's a reason I don't want to make a configuration option for the embedded web server as a repository. It should happen automatically. I.e. you set MAP_FILE and if you set no repository, the embedded web server should serve it automatically, and it should already know where the file is located and the client shoudl request it properly. But you want to support the resource repository, where if the client doesn't have the map, it knows about the resource repository. So, to support both scenarios, a simple flag should tell the server to tell the client to look at the resource repository instead.<br />
<br />
This isn't mutually exclusive with the RESOURCE_REPOSITORY item you've mentioned, because a third and perfectly valid scenario is for the server to direct the client to a different resource repository that's not the central repository you're building.<br />
<br />
----<br />
<br />
Let's see. Sets the webroot to the repository directory. I have a small problem here. I'd like to make it work with cgi scripts and let server admins stick their own scripts on there if they have a cli php or python. If I set the webroot to the repository directory, then server admins have to put web interface files in it. We have to also, for images and stuff. If I set the webroot to something else, I need the resource repository under it. A copy isn't quite right, and there isn't (yet) any way to specify a callback for a specific directory, only for a specific url. I looked at modifying the web server for that and didn't find the solution, but of course I've only just started looking at the web server code.<br />
<br />
So I created a callback for the /admin url. Smile So after you have it running you can visit http://YOURSERVERWITHPORT/admin?cmd=SOMECOMMAND&value=VALUE<br />
<br />
And that command will be executed. Smile I'm going to look next hopefully into putting some protection on that url so a user and pass will be required, hopefully configurable somewhere. Smile But I figured that would be a good start to see if I could do it, anyway.<br />
<br />
----<br />
<br />
I think we can have the master tell the server what it's external IP address is, and then it could assemble a URI from that. For the sake of having it Right, I'd be happy to have that, but it still has to work even if there's no master server to give up this information. Wink (Especially considering it needs to work in a default installation, and a default installation has talk_to_master 0 set) <br />
<br />
----<br />
<br />
Ok, I'm done for the night. Here's what else I added:<br />
<br />
www-root directory for web interface files. Probably I'll be adding an admin directory to it which will provide the admin functions I've been working towards, but it's not there yet.<br />
<br />
Stuff to tDirectories that's probably wrong. Sad I admit I was quite confused reading that file. I want a call to tDirectories to a method just like GetDirPath() for resources, but I want it to return the path for www-root.<br />
<br />
I also ran into a minor problem. Smile I'd like the build system to somehow copy the files under www-root to the build directory, wherever it's at. I'm at something of a loss for that, probably because I need to go to bed.<br />
<br />
Still need to add the config option that tells the client to get resources from the embedded webserver and then the code to the client that actually does it. Anything else in this area is dressing. But as it stands right now, the URI should be http://SERVER:PORT/resource/PATH/TO/RESOURCE as Luke-Jr requested. So the client needs to know what the PORT is as well. To add that the way I was wanting I need to transfer the webserver config items to nSettingItems as appropriate, others to other types of course, and then add a series of calls in uWebInterface::Initialize() to initialize the webserver with them, and remove the webserver's call to open its own config file, adding that instead to the dedicated server itself. Most of the options should just stay the same as in the webserver, but some need to be changed (PORT being one of them, it's taken, and too ambiguous anyway).<br />
<br />
Other than that, I'm not too far off from having a basic web-based admin GUI for the server and also having it serve up its own resources. Technically it can already do that if you put the right MAP_URI in your config file for it.<br />
<br />
ANd, in the process there's no telling what I broke. Hopefully not much, because tDirectories is the only file I've touched outside of uWebInterface and the shttpd files.</div>Lucifer