external next up previous contents
Next: 10.2 Summary of important Up: 10.1 The Low Level Previous: $web:get_htext

$web:do_url

$web:do_url returns the actual htext that will be displayed by $web:hdisplay. It expects the following arguments:

 arg1 (url)      = URL, e.g. something like

       {"/1324"}     or
       {"/1324:page_web", "/hello young man"}

 arg2 (valid_key) = a flag if key is valid, e.g. 1


 arg3 (extra)     = referer/client information (see above), e.g.
       {"Referer: http://tecfamoo.unige.ch:7777.....  }

 arg4 (fetch)     = defining whether the actual htext of only the header
                    is to be retrieved.

Let's examine headers only vs. actual htext first: The fetch tag specifies whether the actual htext of the document needs to be retrieved, or only the headers. This is important because we use $web:do_url to route requests both for the server header information and for the html of the document.

See the lines in $login:get (MOOtiny's version of Sept 25 95)

  38:  fork (0)
  39:    $web:headdisplay($web:get_htext(req, rc, player, 0));
  40:  endfork
  41:  suspend(3);
  42:  keep web:hdisplay($web:get_htext(req, rc, player, 1));

$web:headdisplay is the verb that displays the server headers wheras $web:hdisplay displays the htext to the user. We want the headers to be displayed before anything else, so we fork that off and get it calling :do_url and so on before anything else. We have a suspend(3); to make sure that the headers get there before the html, even if the html takes a very short time to be constructed.
Notice that the only difference between the arguments is the 4th argument, which is the one that gets passed as 'fetch' to $web:do_url. In the first case, we don't want to bother with fetching the html, in the second case, we do.

$web:do_url first builds a html server header information that tells the client what server we are and what kind of document is retrieved, i.e. something like this:

{"HTTP/1.0 200 Document follows", "MIME-Version: 1.0", "Server: WOOM/1.0",
"Date: Thursday, 21-Sep-95 20:23:00 1995", "Content-type: text/html", ""}

One important thing is the Date: because clients use this to tell whether they can just reload something they have in their cache, or have to go and grab it all again.

Then, it generates the html (head of the page, htext ....).

:do_url can parse three types of url.

  1. It looks to see if there isn't a url at all, in which case it returns the home page.
  2. It looks to see if the first argument in the URL is specifying a property (it probably has a ``.'' in it, and the thing before the ``.'' is specifying an object somehow).
  3. If these aren't the cases, it looks for:
    1. if the first thing is a number which can be translated as a valid object number (e.g. http://.../123).
    2. if it looks like a verb reference (has a : in it). Since these are common types of urls (all _web verbs and header verbs (those in the menu on the top left) use it), these are checked quite carefully to make sure none are missed.
    3. if it is the name of a verb used in the header verbs, $web_root the $web_root:verb is used.
    4. if the reference looks like anything else, even just the name of an object the player is holding.

Using this information, it gets headers and htext and parses them to return a list of htext, headers, keep, where keep specifies whether the connection will be kept open for the sakes of server push.


next up previous contents external
Next: 10.2 Summary of important Up: 10.1 The Low Level Previous: $web:get_htext

Daniel K. Schneider
Wed Oct 23 21:55:28 MET DST 1996