31 March 2000 The SREF_MULTI_SEND macrospace procedure of the SRE-http Web Server SREF_MULTI_SEND is used to create a multi-part document. It can also be used to "send pieces" of a document as it becomes available. * Multi-part documents are used for "server push" delivery of several files sequentially. The basic presumption of a multi-part document is that each part stand's on its own. Typically, a browser will replace an earlier part as soon as the next part becomes available. For example, server push can be used as a form of animation, with each part being a "frame" of a movie. Alternatively, server push can be used to send a "get ready" document, followed by a selected file, and lastly a thank you. For example, the GIF_TEXT addon uses multi-part document to build complicated images, with simpler images displayed first, which are then replaced by more elaborate versions. Multi-part documents require browsers that are able to maintain connections, and that understand the multipart/mixed-replace mimetype. Internet-ancient browsers, such as Web Explorer, can not do this. * Sending pieces is used to send earlier portions of a document as they become available. This gives the client something to read when long documents are being built on-the-fly. For example, the BBS addon uses "sending in pieces" to display long listings, that might "time out" the server (or the client's attention span) if nothing is sent before the entire listing is created. Send-in-pieces documents can be handled by all browsers. By using SREF_MULTI_SEND, it's easy to create "multi-part" or "send as pieces" documents. All you need to do is specify a list of files (or strings), and let SREF_MULTI_SEND take care of the grubby details. I. Using SREF_MULTI_SEND The basic syntax of SREF_MULTI_SEND is: rcode=sref_multi_send(message,mime_type,howsend,file_flag,verbose,audnam,resp_hdr,part_hdr) where: message: either contains the "message" to be sent (text or non-text); OR a fully qualified file name (whose contents will be read and sent) mime_type : A mime type; such as text/html or image/gif You can also use mime_type to send additional response headers (see the notes below). howsend : A flag that tells SRE-http "where in the multi-send process we are". There are basically four values (with possible modifiers): '1' == Single part document to "send in pieces" (requires a modifier) 'S' == Start the multipart send (i.e.; the first image) 'M' == A middle piece -- more will follow 'E' == End piece -- send this "message" and close the connection. In addition, you can "build" a long message, and display each portion as soon as they are added. To do this, use the following HowSend codes: '1S' and '1E' -- Start and end a "sent in pieces" single part document 'SS' and 'SE' -- Start and end the first "part" 'MS' and 'ME' -- Start and end the middle "part(s)" 'ES' and 'EE' -- Start and end the final "part" 'A' and '1A' -- Add stuff (between 1S-1E; SS-SE ; MS-ME; or ES-EE) fileflag: If equal to 1, then "message" is to be treated as a fully-qualified file name (Optional) verbose : If > 2, some status info will be displayed (optional) audnam : Name to use when writing to GoServe audit file (for future implementation) resp_hdr : Optional list of response headers-- to add before the first part. If more then one header, then each header should be seperated by a CRLF, but there should NOT be a CRLF at the end of this string. Note that as of 1.3h.0300.c, "part headers" are specified with the part_hdr argument. part_hdr : Optional list of part specific response headers See the technical notes below for details on resp_hdr and part_hdr. Notes: * The return code (rcode) is the RC from the 'SEND' command: you can check for negative values which indicate a broken connection. * MULTSEND.CMD demos the use of SREF_MULTI_SEND. * x and xS are the same (where x=1,S,M, or E. In particular: 1S=1, SS=S, MS=M, and ES=E. * audnam is ONLY used on "first calls". In particular, when howsend=1, 1S, S, or SS. * mime_type is only used on "first calls of a part". In particular, when howsend=1, 1S, S, SS, M, MS, E, or ES. * If howsend='A', the name and mime_type arguments are ignored. * If mime_type is not specified, text/html is assumed. * If howsend is not specified, A is assumed. * We no longer recommend using the mime_type argument to send additional "part specific" headers -- you should use the part_hdr argument instead (as explained below). Examples: A 3 picture animation: foo=sref_multi_send('d:\i1.gif','image/gif','S',1) foo=sref_multi_send('d:\i2.gif','image/gif','M',1) foo=sref_multi_send('d:\i3.gif','image/gif','E',1) A 3 screen status report, with the middle portion a "running tally" foo=sref_multi_send('Welcome','text/plain','S',,,, , 'HEADER ADD X-1: Welcome','X-part0: Yes ') foo=sref_multi_send('Part 1 is done','text/plain','MS',,,, , ,'X-part1: On ') foo=sref_multi_send('Part 2 is done',,'A') foo=sref_multi_send('Part 3 is done',,'ME') foo=sref_multi_send('good bye','text/plain','E') A 5 piece single part document: foo=sref_multi_send(' This is the first line,'text/plain','1S') foo=sref_multi_send(' This is line 2 ',,'1A') foo=sref_multi_send(' This is line 3 ',,'1A') foo=sref_multi_send(' This is line 4 ',,'1A') foo=sref_multi_send(' This is the last line ','text/plain','1E') Simple usage: foo=sref_multi_send('