home *** CD-ROM | disk | FTP | other *** search
/ Dream 42 / Amiga_Dream_42.iso / RiscPC / Internet / Web / web10.spk / !Webster_Docs_Protocol < prev    next >
Encoding:
Text File  |  1995-03-24  |  28.4 KB  |  612 lines

  1. /*
  2.  * ArcWeb
  3.  *
  4.  * Copyright (C) Stewart Brodie, 1994, 1995
  5.  *
  6.  * This product is supplied under the terms laid down in the `Terms' file.
  7.  *
  8.  * This file: Protocol
  9.  *
  10.  *   For ArcWeb versions 0.20 and later (until superceded)
  11.  *
  12.  *   Changes from protocol in version 0.19
  13.  *      Comments about bit 27 handling (arcweb_FLAGS_url_changed) changed
  14.  *      Comments in several other sections changed
  15.  *      Whole document should be reread by those implementing any part of
  16.  *      any of the ArcWeb protocols
  17.  *
  18.  *   Changes from protocol in version 0.12
  19.  *      Extensions to the Message_ArcwebRenderDone buffer.  The image renderer
  20.  *      must insert the X and Y pixel size of a graphical image (to enable
  21.  *      ArcWeb to calculate URLs for imagemaps unless the information is not
  22.  *      available or not applicable (eg. for sound)
  23.  *
  24.  *
  25.  *   Changes from protocol in version 0.11
  26.  *      Extended URL protocol defined
  27.  *      - in *Request message blocks
  28.  *      - notes about ownership of file handles
  29.  *      - in comments about the Flags word
  30.  *      - comments about how to handle Location: header from HTTP servers
  31.  *      Message_ArcwebEMailRequest/Done added
  32.  *      Handling of bit 27 in non-extended URL messages
  33.  *      In Other Notes: comment about expiry dates updated
  34.  *      Warning about setting type bits in Done messages
  35.  *      Renderer protocol warnings added
  36.  *      Sender protocol renamed to Poster protocol
  37.  *      EMail protocol added (uses a new bit in flags)
  38.  *      Suggestion about intelligent HTTP fetchers prefetching images
  39.  *      Message_ArcwebAbortRequest added   + description
  40.  *      Message_ArcwebTransferStatus added + description
  41.  *
  42.  */
  43.  
  44. This file describes the protocols used by ArcWeb.  There are seven protocols
  45. planned, although only the first six are fully implemented so far.
  46.  
  47.  
  48.   * Fetcher Protocol
  49.   * Renderer Protocol
  50.   * Quit Protocol
  51.   * Extended URL Protocol
  52.   * Poster Protocol
  53.   * Email Protocol
  54.   * Expire Protocol
  55.  
  56.  
  57. Programmers supporting these protocols must be extremely careful with their
  58. memory, message and protocol management.  The protocols are allowed to be
  59. concurrent and nested.
  60.  
  61. The obvious example is that a renderer may find an inline image in a
  62. document, and will hence want to issue a request to fetch it.  A not so
  63. obvious example is an intelligent HTTP fetcher which tries to intelligently
  64. scan the returned document (if it was HTML) to pick out <img> tags and kick
  65. off requests for these in-lined images so that when ArcWeb comes to ask for
  66. them, a swifter reply can be made.  The impact of such a system would be
  67. more noticable, the more images there are inlined in a document.
  68.  
  69.  
  70. General
  71. =======
  72.  
  73.   Each protocol consists of 2 messages, a "Request" and a "Done". The
  74. Request is sent with event code 18 to force an acknowledgement.  The
  75. fetcher/renderer should acknowledge with the Done message to prevent the
  76. Wimp returning the message to the originator.  Should the fetcher/renderer
  77. wish to call Wimp_Poll before it is ready to send the Done reply, it MUST ack
  78. the message (ie. fill in the ref fields and reply with event type 19 to
  79. prevent the Wimp returning it to the originator), and then send the Done
  80. message when it is ready (having remembered to fill in the your_ref field
  81. from the my_ref of the original Request).
  82.  
  83.   Instead of sending a Wimp acknowledgement with event type 19 to prevent
  84. delivery failure, as mentioned above, it would be much better to actually
  85. reply with a Message_ArcwebTransferStatus, which doubles both as the ack and
  86. as a useful message.  Further Message_ArcwebTransferStatus messages can be
  87. sent periodically (use event type 17 and zero the ref field for these)
  88.  
  89.   C programmers will want to use requester.h to define the structures used. 
  90. The types have been divorced from any Wimp library, only char, void and int
  91. types have been used.
  92.  
  93. For an example of a Fetcher, see !ArcwebLcl application supplied.  For an
  94. example of a Renderer, see !ArcWebImg application supplied.  ArcWeb
  95. broadcasts a RenderRequest even for HTML and plain text files, as it listens
  96. for RenderRequest messages itself (and this allows it to be overridden).
  97.  
  98.  
  99. Messages
  100. ========
  101.  
  102. buf is the buffer returned from Wimp_Poll (&e->data in Risc_OSlib).  The
  103. obvious fields have been omitted (ie. buf+0 to buf+12).
  104. The 'Private ArcWeb handle' must always be preserved, as this is the only
  105. way ArcWeb can deliver replies to the request originator.
  106.  
  107. The types of each entry are given:  str0 = zero terminated string.  strN = 
  108. string whose length is defined elsewhere.  str0/N = string zero terminated
  109. unless it is maximum length (defined elsewhere) in which case the terminator
  110. is missing; date5 = 5 byte date string (in UTC) as returned by OS_Word 14,3
  111.  
  112. The buffers are all defined together and then explained below.  requester.h
  113. contains C structures for these messages.
  114.  
  115.  
  116.  
  117.  
  118. Message_ArcwebFetchRequest      (msg_Arcweb__base +  0)
  119.  
  120.         buf+16  int     Message_ArcwebFetchRequest      (0x4A240)
  121.         buf+20  void*   Private ArcWeb handle
  122.         buf+24  int     Flags
  123.         buf+28  int     RISC OS file handle (source)
  124.  
  125. EITHER  buf+32  str0    Uniform Resource Locator (fully qualified)
  126.  
  127.     OR  buf+32  int     RISC OS file handle (URL) (if flags bit 22 set)
  128.  
  129.  
  130. Message_ArcwebFetchDone         (msg_Arcweb__base +  1)
  131.  
  132.         buf+12  int     my_ref from Message_ArcwebFetchRequest
  133.         buf+16  int     Message_ArcwebFetchDone         (0x4A241)
  134.         buf+20  void*   Private ArcWeb handle
  135.         buf+24  int     Flags
  136.  
  137.  EITHER buf+28  str0    Error message
  138.  
  139.      OR buf+28  int     Zero=this item has an expiry date
  140.         buf+32  int     Non-zero=use default expiry delay
  141.         buf+36  date5   Expiry date in UTC (if buf+32 zero, and buf+28 zero)
  142.  
  143.  
  144. Message_ArcwebRenderRequest     (msg_Arcweb__base +  2)
  145.  
  146.         buf+16  int     Message_ArcwebRenderRequest     (0x4A242)
  147.         buf+20  void*   Private ArcWeb handle
  148.         buf+24  int     flags
  149.         buf+28  int     RISC OS file handle (source)
  150.         buf+32  int     RISC OS file handle (temporary)
  151.         buf+36  int     RISC OS file handle (diagram)
  152.         buf+40  int     RISC OS file handle (link)
  153.         buf+44  int     size of data following
  154.         buf+48  ---     (contents of buf+44) bytes of source file
  155.  
  156. Message_ArcwebRenderDone        (msg_Arcweb__base +  3)
  157.  
  158.         buf+16  int     Message_ArcwebRenderDone        (0x4A243)
  159.         buf+20  void*   Private ArcWeb handle
  160.         buf+24  int     flags
  161.  
  162. EITHER  buf+28  int     size of image in x pixels (0 if N/A)
  163.         buf+32  int     size of image in y pixesl (0 if N/A)
  164.  
  165. OR      buf+28  str0    error message
  166.  
  167.  
  168. Message_ArcwebPostRequest       (msg_Arcweb__base +  4)
  169.  
  170.         buf+16  int     Message_ArcwebPostRequest       (0x4A244)
  171.         buf+20  void*   Private ArcWeb handle
  172.         buf+24  int     flags
  173.         buf+28  int     RISC OS file handle (source)
  174.         buf+32  int     RISC OS file handle (form)
  175.  
  176. EITHER  buf+36  str0    Uniform Resource Locator (if flags bit 22 clear)
  177.  
  178.     OR  buf+36  int     RISC OS file handle (URL) (if flags bit 22 set)
  179.  
  180. Message_ArcwebPostDone          (msg_Arcweb__base +  5)
  181.  
  182.         buf+12  int     my_ref from Message_ArcwebPostRequest
  183.         buf+16  int     Message_ArcwebPostDone          (0x4A245)
  184.         buf+20  void*   Private ArcWeb handle
  185.         buf+24  int     flags
  186.  
  187.  EITHER buf+28  str0    Error message
  188.  
  189.      OR buf+28  int     Zero=this item has an expiry date
  190.         buf+32  int     Non-zero=use default expiry delay
  191.         buf+36  date5   Expiry date in UTC (if buf+32 zero, and buf+28 zero)
  192.  
  193. Message_ArcwebEMailRequest      (msg_Arcweb__base +  6)
  194.  
  195.         buf+16  int     Message_ArcwebEMailRequest      (0x4A246)
  196.         buf+20  void*   Private ArcWeb handle
  197.         buf+24  int     flags
  198.         buf+28  int     RISC OS file handle (form file containing e-mail)
  199.  
  200. Message_ArcwebEMailDone         (msg_Arcweb__base +  7)
  201.  
  202.         buf+12  int     my_ref from Message_ArcwebEMailRequest
  203.         buf+16  int     Message_ArcwebEMailDone         (0x4A247)
  204.         buf+20  void*   Private ArcWeb handle
  205.         buf+24  int     flags
  206.  
  207.  
  208. Message_ArcwebQuit              (msg_Arcweb__base + 32)
  209.  
  210.         buf+16  int     Message_ArcwebQuit              (0x4A260)
  211.  
  212.  
  213. Message_ArcwebExpire            (msg_Arcweb__base + 33)
  214.  
  215.         buf+16  int     Message_ArcwebExpire            (0x4A261)
  216.         buf+20  void*   Private ArcWeb handle
  217.         buf+24  int     flags
  218.         buf+28  int     RISC OS file handle (source)
  219.  
  220. Message_ArcwebAbortRequest      (msg_Arcweb__base + 34)
  221.  
  222.         buf+16  int     Message_ArcwebAbortRequest      (0x4A262)
  223.         buf+20  void*   Private ArcWeb handle
  224.         buf+24  int     reserved
  225.         buf+28  str0    reason for abort (could log this)
  226.  
  227. Message_ArcwebTransferStatus    (msg_Arcweb__base + 35)
  228.  
  229.         buf+16  int     Message_ArcwebTransferStatus    (0x4A263)
  230.         buf+20  void*   Private ArcWeb handle from ..Request
  231.         buf+24  int     reserved, must be zero
  232.         buf+28  int     status flags
  233.         buf+32  int     total size of data to be transmitted
  234.         buf+36  int     size of data transmitted so far
  235.         buf+40  int     total size of data to be received (if known)
  236.         buf+44  int     size of data received so far
  237.         buf+48  str0    current status of communication
  238.  
  239.  
  240. Ownership of File Handles
  241. =========================
  242.  
  243. Some people have expressed concern at the apparent capability to lose track
  244. of which task 'owns' the RISC OS file handles passed in the messages.  There
  245. is never any ambiguity, and this section will clarify this.
  246.  
  247. The task which sends the FetchRequest/RenderRequest/PostRequest message will
  248. have called OS_Find to open the file, and this task (normally ArcWeb itself)
  249. owns the returned file handle UNTIL it calls Wimp_Poll.  At this point, the
  250. Wimp will start delivering the Request message to each task in turn.  While
  251. the Wimp is doing this the file handle is in limbo (in effect, it is
  252. 'lost').
  253.  
  254. There are two possible continuations:
  255.  
  256. i) As soon as a task receives the Request message and decides that it wishes
  257. to reply to the Request message, it will either send the corresponding Done
  258. message, OR just ack it with the intention on replying properly later.  It
  259. is upon the sending of this Done message, or Ack, (the call to
  260. Wimp_SendMessage) that the task becomes the owner of the file handle, and
  261. hence responsible for closing the file handle when it is finished with.
  262.  
  263. ii) The other scenario is when *no* task wants to reply to the Request
  264. message. In this case, the Wimp will deliver an event code 19 copy of the
  265. message to the originator.  The originator now regains ownership of the file
  266. handle and is responsible for it (ArcWeb closes the file(s) and generates
  267. an error if this is sensible).
  268.  
  269. In general, for any task, if it receives a Request message, it is guaranteed
  270. to have exclusive use of the file handle until it next calls Wimp_Poll.
  271.  
  272. This system ensures that ownership of the file is guaranteed to be allocated
  273. to one particular task in the system at any time, and that a task has to
  274. 'claim' ownership explicitly, as shown in (i) above.
  275.  
  276.  
  277.  
  278. Flags
  279. =====
  280.  
  281. The Flags word contains several useful bits of information:
  282.  
  283.         bits 0-15       RISC OS file type/ArcWeb file type (see bits 16,30)
  284.         bit  16         If set, bits 0-15 are ArcWeb file type, else RISC OS
  285.         bits 17-19      Reserved (must preserve in replies)
  286.         bit  20         If set, the user has disabled image fetching
  287.         bit  21         If set, the email message is already complete
  288.         bit  22         If set, an extended URL is in use
  289.         bit  23         If set, ArcWeb will not display the results of the render
  290.         bit  24         If set (+bit 31 set), ArcWeb will not raise an error
  291.         bit  25         If clear, this is a 'page' fetch, else inline data
  292.         bit  26         If set, ArcWeb will close the window which issued request
  293.         bit  27         If set, extended URL has changed
  294.         bit  28         If set, symbolic link request/confirm
  295.         bit  29         If set, ArcWeb will not attempt to render the file
  296.         bit  30         If set, bits 0-16 are valid, else they are invalid
  297.         bit  31         If set, buffer contains an error message
  298.  
  299. The error bit (31) determines which of the options in two of the messages
  300. above, is in force.  If the error bit is set, ArcWeb will raise an error to
  301. the user UNLESS bit 24 is also set (indicating that the other application
  302. has already handled this - this is the preferred way of doing it).
  303.  
  304. When a request to fetch a new page is issued, ArcWeb remembers which window
  305. (if any) launched the request.  Once a successful RenderDone has been
  306. delivered to the window, it will self-destruct if bit 26 is set.  ArcWeb
  307. will set this bit itself according to the user's choice, and so this bit
  308. should always be preserved, unless you absolutely want to set it (see bit 23
  309. below).  That window is not allowed to launch further requests until the
  310. whole transaction is completed.  This blocked state is indicated to the user
  311. by the web animation in the information window for a busy page.
  312.  
  313. If you find that bit 22 is set upon receipt of a Request involving a URL,
  314. then the buffer will not contain a URL, but a file handle of a file that
  315. does.  The file will have been opened in R/W mode with OS_Find.  You should
  316. read the whole of the file to obtain the URL.  It may be terminated by a
  317. whitespace character, or by EOF.  The same rules about responsibility for
  318. closing the file apply as for the other handles in ..Request messages.
  319.  
  320. If, during a conversation with an HTTP server, you receive a Location:
  321. directive indicating a document relocation, then you should amend the
  322. contents of the extended URL file to represent the new target URL.  You must
  323. set flag bit 27 in the Done message (which you don't send immediately - you
  324. pretend as though you had received the new URL from the Request message). 
  325. The transparent obedience to Location: directives is not strictly required
  326. (and the change cannot be signalled to ArcWeb if the extended URL protocol
  327. is not being used), but is MOST HIGHLY ENCOURAGED.  At some point in the
  328. future, only extended URLs will be used at all.
  329.  
  330.  
  331. If bit 23 is set in RenderDone, ArcWeb will not display the results of the
  332. render.  This is to allow applications such as image renderers to open their
  333. own window to display the picture.  This must NOT be done if bit 25 is set
  334. (as someone else is trying to render an inline image).  If bit 25 is set,
  335. the application must convert the image into a sprite file and store it in
  336. the 'diagram' file.  If you set bit 23, it is a good idea to clear bit 26 in
  337. order not to confuse the user.  Make sure that you set the size of the image
  338. in pixels (if appropriate) in the RenderDone message, as this will enable
  339. image maps to work correctly.
  340.  
  341. Upon receipt of a FetchRequest message, the application should check bit 28. 
  342. If bit 28 is set, then the application may opt to retrieve the file to its
  343. own private directory and store the name of the file in the 'source' file. 
  344. If it declines to do this (or bit 28 is clear anyway), bit 28 should be
  345. cleared on the response and the fetched file placed in 'source'.  This
  346. facility is provided mainly for the benefit of ArcWebLcl to avoid copying
  347. files around the locally available filesystems.
  348.  
  349. If bit 21 is set on receipt of a EMailRequest message, then this indicates
  350. that the form file contains a complete e-mail message ready to be mailed
  351. off (excluding From: header).  If bit 21 is clear, then this indicates that
  352. the helper application needs to open some kind of editor to allow the user
  353. to complete the e-mail.  The editor should be initialised with the contents
  354. of the form file.  If it is going to do anything at all, then the helper
  355. application must reply with a EMailDone message.
  356.  
  357. Bit 20 is used by ArcWeb to indicate to fetchers that the user has
  358. specifically requested that images are not fetched and rendered.  This
  359. allows 'intelligent' HTTP fetchers mentioned at the start of this document,
  360. to parse the HTML responses to its fetches and immediately kick off the
  361. transfers for these images before the render of the document begins.  If bit
  362. 20 is set, then the fetcher should not do this.
  363.  
  364.  
  365.  
  366. Message_ArcwebAbortRequest
  367. ==========================
  368.  
  369. Upon receipt of this message, the fetcher application retrieving a URL under
  370. the given ArcWeb Private handle, should terminate the fetch with an error. 
  371. It should acknowledge this message with Message_ArcwebFetchDone, after
  372. setting the flags correctly indicating some kind of error.  All active
  373. fetches associated with the handle should be stopped.  This allows
  374. intelligent fetchers to stop any automatic fetches that they might have
  375. issued, to fetch inlined images.
  376.  
  377. At the choice of the FETCHER, it may decide to ignore the AbortRequest and
  378. continue fetching data.  The most obvious situation in which this is useful
  379. is if the fetch is large and nearly complete anyway - say less than 1 second
  380. estimated to completion.  You must acknowledge the AbortRequest with a
  381. FetchDone, in the usual manner (ie. you can acknowledge the message first,
  382. then send a reply later).  The amount of time may be configurable in the
  383. fetcher, but should not exceed a few seconds as this may confuse the user.
  384.  
  385.  
  386.  
  387. Message_ArcwebTransferStatus
  388. ============================
  389.  
  390. A fetcher which wishes to inform the user of the status of the communication
  391. between itself and the remote information server (FTP, HTTP, Gopher, etc..)
  392. may use this message to inform the browser of its progress.  The 4 size
  393. elements in the message may be used by the browser to create a graphical
  394. representation of the communication status.  Values of -1 should be known
  395. for unknown quantities (0 is reserved for indicating no bytes yet
  396. transferred or expected).  The browser may choose to ignore these values and
  397. rely on the description string, which should say something like:
  398.  
  399. 1000 bytes out of 2000 byte document read
  400. 0 bytes out of 16384 bytes of inlined image read
  401. Looking up louis.ecs.soton.ac.uk ...
  402.  
  403. or whatever it feels is appropriate.  Fetcher writers must recognise that
  404. the browser may attempt to display these messages in an icon, and will hence
  405. be issuing redraw requests (even if only via Wimp_SetIconState) for each
  406. message received.  The fetcher should provide a facility for disabling these
  407. messages, and not send them too frequently - two or three times per second
  408. is quite enough.
  409.  
  410.  
  411. If you are going to provide byte counts as in the examples above, I HIGHLY
  412. RECOMMEND using OS_Convert(Fixed)FileSize to give a useful display.  It
  413. isn't terribly useful to know that 65539 bytes out of 268435456 bytes have
  414. been received.  Far better, even if slightly inaccurate, to say '64K out of
  415. 256M' and maybe show the percentage that represents.
  416.  
  417. Returned messages should typically be less than about 64 characters long.
  418.  
  419. The browser may ignore these messages, and so the fetcher should not send
  420. them recorded delivery (Wimp event type 18).
  421.  
  422. The flags for Message_ArcwebTransferStatus:
  423.  
  424.         bit   0         If set, transmission is in progress
  425.         bit   1         If set, reception is in progress
  426.         bit   2         If set, transmission is complete
  427.         bit   3         If set, reception is complete
  428.         bit   4         If set, other comms. are in progress eg. DNS lookup
  429.         bits  5 - 31    Reserved
  430.  
  431.  
  432.  
  433. Other Notes
  434. ===========
  435.  
  436. You must preserve the ArcWeb Private Handle.  This is a private pointer to a
  437. part of ArcWeb's application memory used to distribute the replies which
  438. ArcWeb receives.
  439.  
  440. When specifying an expiry date in FetchDone messages, if you intend to
  441. specify a date rather than allow the default to be used, then you must
  442. specify this as an exact date.  ie. not relative to the current time, you
  443. must add it up yourself.  HTTP servers may supply expiry dates on documents
  444. which they return.  These should be honoured (see documentation of the
  445. Territory module's handling of Time & Date).
  446.  
  447. The 'source', 'temporary', 'diagram' and 'link' words in the FetchRequest
  448. and RenderRequest messages are RISC OS file handles to the appropriate files
  449. in ArcWeb's cache.  If you acknowledge either of the Request messages, YOU
  450. are responsible for closing the files (ie. passing the handle to OS_Find 0).
  451. You must close ALL the file handles in the message even if you don't use
  452. them all.  The reason for passing handles around is that filenames  won't
  453. necessarily fit in the message buffer (particularly when you want to pass 4
  454. of them).  If just having the handle is inconvenient, you should use OS_Args
  455. 7 to convert the handle into a filename (as !ArcWebLcl does), close the file
  456. and reopen it how you want to do it.  BUT BEWARE: only do this if you are
  457. going acknowledge the message (otherwise other recipients of the message
  458. will find that they have an illegal file handle in the message).  For
  459. FetchRequest, 'source' is opened as read/write (OS_Find 0x83 - [I always
  460. thought that was for output only, but my RO3 PRMs say otherwise]).  For
  461. RenderRequest, 'source' is opened read only (OS_Find 0x43), and the others
  462. are read/write (OS_Find 0x83).  For PostRequests, the source is as for
  463. FetchRequests, and the form file is read only.  For EMailRequests, the form
  464. file is read-only.
  465.  
  466. [An example of using OS_Args 7 in BASIC is in !ArcWebLcl which uses OS_CLI
  467. to issue a straight *COPY command when the symlink bit is clear]
  468.  
  469.  
  470. You do not need to fill in the file type bits (0-15,16 and 30) when sending
  471. the Fetch Done message, but it will assist the renderers in deciding what to
  472. do with the document if you do.  The most common types returned are plain
  473. text (&FFF), HTML (&FAF), GIF (&695), JPEG (&C85) and XBM (&10104).
  474.  
  475. WARNING: Most HTTP servers are configured with a default type to return in
  476. the case that it cannot work out the type of a file from its name or a
  477. specific directive telling it the file type.  This default type is usually
  478. text/plain.  This is a problem when you wish to store binary files (eg.
  479. arcweb.arc) on HTTP servers, as louis.ecs.soton.ac.uk's server will tell you
  480. that this is a text/plain file, when obviously it isn't.  ArcWeb 0.12 and
  481. later will examine the data in the RenderRequest message* to ensure that it
  482. does not contain non-printable characters before attempting to render it.
  483.  
  484. * see renderer protocol discussion below
  485.  
  486.  
  487. Renderer Protocol
  488. =================
  489.  
  490.   The Renderer Protocol is used to transform a file into something which can
  491. be viewed in the ArcWeb window.  ArcWeb generates a DrawFile (type &AFF)
  492. to represent the HTML document.  I have written my own parser to read the
  493. HTML file (conforms with the HTML 2.0 specification, 13 June 1994) and
  494. display it.  Renderers should convert images into sprites and store them in
  495. the 'diagram' file (but only if it is an inline data fetch - see discussion
  496. of bits 23 and 25 above).  ArcWeb will be expecting a sprite file to be
  497. there which it can then import.  It will take the first sprite out of the
  498. file.  ArcWeb will handle RISC OS sprite files (&FF9) itself (although it
  499. will broadcast the message with the expectation of receiving it back).  You
  500. should not acknowledge render requests for files of type &FF9
  501.  
  502.   Renderers should inspect the file type bits in the RenderRequest to see
  503. whether the file is of a type which they can handle.  If the type is not
  504. known* (bit 30 is clear), then the renderer may inspect the first few bytes
  505. of the file.  Before sending the RenderRequest message, ArcWeb will have
  506. loaded in as much of the file as possible to the message (to fill it up to
  507. 256 bytes).  The amount of data in the message is in buf+44, and the data
  508. starts at buf+48.  Thus up to 208 bytes of data will be present (currently
  509. it is 208 unless the file is not that long, in which case the whole file is
  510. there).  If 208 bytes is not enough, the renderer may use the file handle
  511. given in the message to read more of the file in.  The file pointer should
  512. be reset to zero if it decides that it can't handle it.  As a safeguard,
  513. Renderers MUST NOT assume that the file pointer will be zero, and should set
  514. it explicitly.
  515.  
  516. * The renderer may decide that it doesn't 'trust' the given file type.  If
  517. that is the case, then it is allowed to ignore bit 30 and attempt to
  518. recognise the file type from the data in the message buffer and act on that
  519. alone.
  520.  
  521.  
  522.  
  523. Quit Protocol
  524. =============
  525.  
  526.   Fetchers and Renderers should have a configurable option to allow them to
  527. quit when ArcWeb dies.  This provides a clean way of shutting ArcWeb and all
  528. its related programs down in one go.  Upon receipt of a Message_ArcwebQuit
  529. message, store the task handle (in buf+4) and wait for the Wimp task
  530. closedown message (Message_TaskCloseDown 0x400C3) to arrive with the given
  531. task handle.  [To prevent ArcWeb closing down, acknowledge the
  532. Message_ArcwebQuit message - not in version 0.08.  ArcWeb will exit anyway.]
  533.  
  534.   By using an extra message, this avoids the need for the auxiliary apps to
  535. lookup the task name from the handle to check whether it was ArcWeb or not,
  536. and this also guards against the task name changing.
  537.  
  538.   Do not acknowledge Message_ArcwebQuit unless you wish to prevent the
  539. shutdown (treat it like you would treat Message_PreQuit)
  540.  
  541.  
  542. Expire Protocol
  543. ===============
  544.  
  545.   If a fetcher has used a symbolic link when fetching a file then that file
  546. should be expired upon receipt of Message_ArcwebExpire.  ArcWeb will pass you
  547. a handle to the file in the cache.  If the symbolic link bit (bit 28) is set
  548. in the flags, then the file to be removed is really the file whose name is
  549. in the file whose handle you have been given.  !ArcwebLcl ignores this
  550. message completely (as it should).  This protocol is not fixed and should
  551. not yet be used (there is a particular problem with extended URLs), but
  552. fetcher authors should be aware of its future existence.  ArcWeb does not
  553. currently send Message_ArcwebExpire messages.
  554.  
  555.  
  556. Poster Protocol
  557. ===============
  558.  
  559. This protocol will be used when ArcWeb wants to send information to a URL
  560. rather than retrieve it, ie. when an HTML form with a method of POST has
  561. been completed and the SUBMIT button has been pressed.  If the form did not
  562. override the default (GET) or chooses the GET method, the the FetchRequest
  563. protocol is used, and the fetcher is not aware of the fact that the data
  564. transfer has happened (an extended URL will have been used).
  565.  
  566. PostRequest should be treated exactly like Message_ArcwebFetchRequest,
  567. except that the 'form' file handle is a RISC OS file handle pointing to a
  568. read-only file containing data to tag onto the end of the request. 
  569. Obviously, the fetcher should issue a POST command to the HTTP server
  570. instead of a GET.  The data in the form file will be suitable for tacking on
  571. IMMEDIATELY after the POST and other usual headers, as it will contain a
  572. Content-Length: header followed by a blank line, followed by the form data
  573. with all the appropriate escape characters already substituted in.  This
  574. data should be passed transparently to the HTTP server.  The fetcher should
  575. respond to ArcWeb with a Message_ArcwebPostDone in exactly the same format
  576. as a response to Message_ArcwebFetchRequest.  The buffer for PostDone is the
  577. same as the buffer for FetchDone.  This is because the target script on the
  578. server responds with a new virtual document, usually confirming that the
  579. data entry was successful/failed etc.
  580.  
  581. EMail Protocol
  582. ==============
  583.  
  584. This protocol will be used when ArcWeb wants to send some e-mail.  ArcWeb
  585. will send this message when the users attempts to follow a mailto: hypertext
  586. link, or when a form with a mailto: method is submitted.  In the former
  587. case, the message remains to be constructed, so the contents of the form
  588. file should be taken as the initial text to be placed in the editor.  ArcWeb
  589. guarantees to make the first line of the file the To: header.  Furthermore,
  590. bit 21 will be clear indicating that the message is not yet complete.  In
  591. the latter case (the invoked form), bit 21 will be set, indicating a
  592. complete message is in the buffer and ready for mailing.  ArcWeb will still
  593. guarantee that the first line in the form file is the To: header, but will
  594. also add an X-Mailer: header, a Date: header and any other headers as
  595. directed by MH tags in the form (eg. Subject: headers)
  596.  
  597. Upon receipt of the EMailRequest, the e-mail application should take over
  598. the process of sending e-mail and return an EMailDone, after taking a copy
  599. of the form file contents and closing the form file.  ArcWeb is not
  600. concerned with what happens to the e-mail next, as far as it is concerned,
  601. the email is sent.
  602.  
  603. There is no virtual document returned from an EMailRequest.  The e-mail
  604. application may flag an error in the usual way (and choose whether to report
  605. the error itself of not).  ArcWeb will open a dialogue box indicating the
  606. status of the e-mail, rather than generating a complete new page.
  607.  
  608. ArcWebTCP will provide the email facility only if it is configured to do so.
  609. To configure it, you must give it your email address and SMTP gateway name.
  610.  
  611. ==END==
  612.