THE META-HTML LANGUAGE REFERENCE MANUAL

[TOC]

Section Intro: Network Appendix

Network Appendix

Synopsis:

    Meta-HTML contains several core functions for manipulating network streams, such as with-open-stream. These low level functions are exactly what is needed to allow the maximum functionality and expressiveness in the language -- one might write a complete Web based IMAP client using such primitives! However, as is often the case, it isn't always convenient to re-invent the wheel, and so we have provided several tags in Meta-HTML PRO which deliver common functionality in a general way.

Commands:

<e-mail::parse-message MSGVARSimple

    Given a complete RFC-822 E-mail message stored in MSGVAR, this function returns an alist describing the message in detail.

    The elements of the alist include the raw headers, and variables called HDR_TO, HDR_FROM, HDR_SUBJECT, HDR_CC, and HDR_DATE, in additions to the variable BODY.

<e-mail::sendmail FROM TO[] CC[] BCC[] HEADERS[] MESSAGESimple

    Send the mail message MESSAGE using a network stream from FROM to TO.

    The host used to connect to for SMTP defaults to the value of the variable E-MAIL::MAILHOST, or "localhost" if that variable is not defined.

    TO, CC, BCC and HEADERS are arrays containing elements of the indicated type.

     <e-mail::sendmail webmaster@mysite.com bfox@ua.com "" ""
        "Subject: Testing e-mail::sendmail
         Reply-to: nobody@nobody.com"
        "This is the body of the message.">
     

    If the variable E-MAIL::DEBUG-SENDMAIL-SESSION is non-empty, it says to populate the array e-mail::sendmail-session with the conversation that takes place between Meta-HTML and the SMTP server at E-MAIL::MAILHOST.

<http::get-document HOST PORT PATH &key [STRIP-HEADERS] [VAR] &rest headers[]>Simple

    Get an HTTP document specified by HOST, PORT and PATH.

    If a redirection is necessary in order to get the final document, the variable http::redirected-url is set to the fully qualified URI of the document.

    If the document could not be retrieved, the variable http::error-status contains the word "NO-DATA", and the variable http::explanation contains an human readable string explaining the problem.

    If STRIP-HEADERS is given, the HTTP protocol headers are stripped from the document before it is returned.

    If the keyword argument VAR is supplied, it is the name of variable that should receive the contents of the HTTP document verbatim -- by necessity, this variable is binary. You can use the CONTENT-LENGTH function to find out the length of the retrieved document.

    Finally, any extra headers that you would like to pass along may be written into the call, perhaps to set a cookie for example.

     <http::get-document www.metahtml.com 80 "/" "Cookie: SID=829389834">
     

<http::host-part URLSimple

    Return the hostname and port portion of the fully qualified URL.

     <http::host-part http://www.metahtml.com/page.mhtml>
     
    produces:
    www.metahtml.com
     

<http::include URL &key [VARNAME] &rest extra-headers[]>Simple

    Include the contents of the Web document referenced by URL in the page. If VARNAME is supplied, it is the name of a binary variable which will receive the page contents. Otherwise, the document is simply returned.

    EXTRA-HEADERS can be supplied, perhaps to pass a cookie to the server:

     <http::include http://www.foo.com/cgi-bin/foo.exe "Cookie: SID=10">
     

<http::path-part URLSimple

    Return the path portion of the fully qualified URL. This is the part of URL that is meaningful to the host.

     <http::path-part http://www.metahtml.com:8080/page.mhtml?foo=bar>
     
    produces:
    /page.mhtml?foo=bar
     

<http::port-part URLSimple

    Return the port portion of the fully qualified URL. If the URL doesn't have a port specifier, the value "80" is returned.

     <http::port-part http://www.metahtml.com:8080/page.mhtml>
     
    produces:
    8080
     

<http::post URL PACK &key [USER-AGENT] &rest http-headers>Simple

    POST the variables and values in PACK to the server and page specified by URL. If the keyword argument USER-AGENT is supplied, it overides the default value, which is either the value of ENV::HTTP_USER_AGENT, or the string Mozilla/4.04 [en] (X11; I; Linux 2.0.27 i686).

<http::query-part URLSimple

    Return the query portion of the fully qualified URL. If URL doesn't have a query string, the empty string is returned, otherwise, that portion of URL following the first question-mark (?) is returned.

     <http::query-part http://www.metahtml.com:8080/page.mhtml?foo=bar>
     
    produces:
    foo=bar
     

Edit Section
Function Index
Variable Index


The META-HTML Reference Manual V2.0 Copyright © 1995, 1998, Brian J. Fox
Found a bug? Send mail to bug-manual@metahtml.org