Metcast HTTP Server

This is a Web Application server serving Metcast requests, typically submitted by a Metcast client, retriever

;
;				Metcast Server
;
; This is a root module of the Metcast Application Server, a module that
; takes Metcast clients requests, tries to satisfy them, and formats the
; answer if any in a format the client prefers.
;
; This script is supposed to be called in response to a POST or GET action,
; normally initiated by a Metcast retriever, although any other user agent/
; browser is welcome. The client must specify a request, in a language
; that is described in great detail in JMV-TNG/Met-Cast-HTTP.html
; Here's a sample request, for easy reference
;	POST http://nites-2/cgi-bin/server HTTP/1.0
;	Accept: text/x-packed-dat; text/x-syn
;	Host: nites-2
;	Content-Length: 266
;	Content-Type: text/x-mbl
;	User-Agent: JMV/3.0
;	
;	(BIGAREA
;	(bounding-box 70.0N 25.00W -50 175)
;	(products
;	  (METAR)))
;
; Upon receiving this kind of request, an HHTP server parses it and calls
; the present script, passing request headers as env variables, and the
; post message as this script's standard input.
;
; The body of the request is made of a set of (possible nested) clauses
; that specify which products are being requested, an area of interest,
; bounding box, tau, etc. information. See JMV-TNG/Request-Lang.html
; for the details.
;
; Thus this script should receive the following environment 
;
;	PATH=/sbin:/usr/sbin:/usr/bin
;	REMOTE_HOST=192.16.167.45
;	CONTENT_TYPE=text/x-mbl
;	HTTP_HOST=152.80.34.202:80
;	GATEWAY_INTERFACE=CGI/1.1
;	SERVER_SOFTWARE=Netscape-Communications/1.12
;	SERVER_URL=http://nites-2
;	REQUEST_METHOD=POST
;	SERVER_NAME=nites-2
;	HTTP_USER_AGENT=JMV/3.0
;	CONTENT_LENGTH=266
;	HTTP_ACCEPT=text/x-packed-dat; text/x-syn
;	SCRIPT_NAME=/cgi-bin/server
;	SERVER_PORT=80
;	SERVER_PROTOCOL=HTTP/1.0
;	HTTP_IF_MODIFIED_SINCE=Mon, 31 Mar 1997 18:34:05 GMT
;	REMOTE_ADDR=192.16.167.45
;	TZ=GMT0
;
; Of interest (importance) to us are REQUEST_METHOD (which can be either
; POST, or GET), HTTP_ACCEPT, which tells us what kind of result the
; client wants. At present, only text/x-packed-dat, text/x-syn and image/tiff
; are expected. HTTP_USER_AGENT tells the name and the version of the agent,
; just for reference. The request itself is specified by an env variable
; QUERY_STRING (for the request method GET), or sent as the POST message,
; which is available to this script as its standard input. In the latter
; case, CONTENT_TYPE and CONTENT_LENGTH env variables _must_ be present,
; to tell the message size and data format. At present, the format is
; expected to be text/x-mbl, that is, the format described in
; JMV-TNG/Request-Lang.html, in plain text. HTTP_IF_MODIFIED_SINCE is present
; for a conditional request (entered with If-Modified-Since: request header).
; 
;
; If HTTP_IF_MODIFIED_SINCE is present, a "dynamic env#" variable
; 'modified-since' is set to the _epoch time_ for the conditional
; request, MINUS extra 15 seconds to cover possible network latencies.
; See my e-mail message "METAR observations fallen through the cracks"
; for more details.
;
; This script is supposed to generate the following reply
;	HTTP/1.0 200 OK
;	Server: Netscape-Communications/1.12
;	Date: Tuesday, 21-Jan-97 23:57:25 GMT
;	Last-modified: Tuesday, 21-Jan-97 23:17:59 GMT
;	Content-length: 1841
;	Content-type: text/x-packed-dat; area="BIGAREA"
;
;	PACKED.DAT 97012000
;	METXA01 00242000 9701
;	...etc...
;
; The first line, and 'Server:' and 'Date:' headers will be generated
; by the HTTP server itself. This script needs to write to the server
; (to the standard output)
;	Status: 200 OK
; followed by 'Last-modified:', 'Content-length:', 'Content-type:'
; headers as appropriate, followed by an empty line and the response
; data themselves (packed.dat in our case).
;
; This version of the server supports composite replies. That is, the request
; may ask for satellite products _and_ observations _and_ grids. Chances are
; there would be several products to send back to the client in reply. If this
; is the case, the server packs the products into a single composite
; (multipart) message. The reply from this script is then going to look
; like this:
;	HTTP/1.0 200 OK
;	Server: Netscape-Communications/1.12
;	Date: Tuesday, 21-Jan-97 23:57:25 GMT
;	Content-Type: multipart/mixed; boundary="boundary-JMVVMJ yradnuob"
;	
;	--boundary-JMVVMJ yradnuob
;	Content-type: text/x-syn; area="BIGAREA"
;	Content-length: 193
;
;	   DGAA   5.6   -0.2***************************************11
;	5 METAR 560 -16 871488000 871495200 654720 DGAA  ACCRA/KOTOKA INTL
;	METAR DGAA 131600Z 23008KT 9999 FEW018 BKN120 27/22 Q10//
;	--boundary-JMVVMJ yradnuob
;	Last-modified: Tuesday, 21-Jan-97 23:17:59 GMT
;	Content-type: image/x-portable-graymap; AREA="CONUS"; KIND="SVN";
;          Description="North Atlantic Satellite (VIS)"; TIMESTAMP=871056746
;
;	P5
;	800 800
;	255
;	JJ...sat-data...
;	--boundary-JMVVMJ yradnuob
;	Content-type: text/x-packed-dat; area="BIGAREA"
;	Last-modified: Tuesday, 21-Jan-97 23:17:59 GMT
;	Content-length: 1841
;
;	PACKED.DAT 97012000
;	METXA01 00242000 9701
;	...etc...
;
; Note that if a METAR reply is present, it is sent first. SAT products will
; follow (if requested and available). The grid product reply is sent the
; last (because it generally takes a while to get a reply from an ISIS
; db)
;
; If the request was invalid, the script should reply with the response code
; 400 (Bad request), 405 (method not allowed), 411 (length required),
; 408 (Request time-out), 413 (request entity too large),
; 415 (unsupported media type),
; 500 (internal error), 501 (not implemented), or 503 (service unavailable)
; as approriate.
;
; For logging purposes, this script dumps all the input parameters and other
; diagnostics to a special log file.
; As there may be several servers running running concurrently (serving
; different remote hosts), we try to keep the logs of these server separate
; (by including the remote host name or IP into the name of the log).
; If a particular log file name didn't exist, it is created; if it did
; exist, the new information is appended to it. That's why logs may
; grow very big and need periodical pruning/trimming (via a cron
; job or jmv-server-log CGI script). All log files are created with a
; prefix LOG:PREFIX, which may include a directory (path) prefix, as in
; "logs/jmvlog." This means that logs are contained in a local directory
; logs (which may be a symbolic link pointing elsewhere).
;
;
; After the server successfully received and verified the request, it parses
; it and loads is (corresponding "objects") into a "dynamic env#".
; It searches then the dynamic env# for product request descriptions, and
; executes them in order.
;
; $Id: Metcast-Server.html,v 2.1 1998/02/06 23:55:54 oleg Exp oleg $

History

$Id: Metcast-Server.html,v 2.1 1998/02/06 23:55:54 oleg Exp oleg $