polserver/pol-core/support/scripts/http.em
Kevin Eady 3ccf701ce9
Format testsuite scripts, pol-core support modules (#713)
* Format escript testsuite

* Manual formatting for escript testsuite
- Add format-off to places where formatter does what it should, but we don't like the results
- Manually change places where formatter outputs weird things _without_ format-off, so next format-all would show changes if not fixed

* Update .err files; add update_err.py helper script

Use the format `:line:col: message` for all .err file checks. This
allows us to change the file names without needing to edit the .err
contents.

Note that `in/inc0{1,2}.err` need have error messages between POSIX and
Windows, so their messages are a bit more "generic" than the other errs.

* Format pol testsuite

* Manual formatting for pol testsuite

* Format pol-core modules

* Manual formatting for pol-core modules

* Additional format pol-core modules

Use FormatterLineWidth=10000 since module functions must be on one line
because of the parse_modules target

* Address Discord comments

- Support multi-line module function declarations in parse_modules

* Format on df07831
2024-10-04 10:29:55 +02:00

54 lines
1.6 KiB
Text

// WriteStatus( code, reason = "" )
//
// Writes the HTTP status code with optional reason. Can only be used before any
// WriteHeader(), WriteHtml(), and WriteHtmlRaw() functions. If data has already
// been sent via these calls, then WriteStatus() will return an
// error.
WriteStatus( code, reason := "" );
// WriteHeader( name, value )
//
// Writes a header to the "virtual webpage" that's to be sent
// to the connecting browser. Can only be used before any
// WriteHtml() or WriteHtmlRaw() commands and after optionally WriteStatus(). If data has already
// been sent via these calls, then WriteHeader() will return an
// error.
//
// This function can also be used to change the content type from
// the default "text/html" by writing a Content-Type header name.
WriteHeader( name, value );
// WriteHtml( html )
//
// Writes a line of HTML to the "virtual webpage" that's to be sent
// to the connecting browser and appends a new-line.
//
WriteHtml( html );
// WriteHtmlRaw( html )
//
// Writes a line of HTML to the "virtual webpage" that's to be sent
// to the connecting browser, but does NOT append a new-line.
//
WriteHtmlRaw( html ); // don't append a newline
// QueryParam( param )
//
// Query's the accessed URL for any embedded parameters.
// (see your favorite HTML docs for parameter embedding! :) )
//
// Example: http://pol.server.com:8080/querytest.ecl?par=wibble&name=
//
// QueryParam( "par" ) ---> "wibble"
// QueryParam( "name" ) --> ""
// QueryParam( "heat" ) --> 0 [integer]
//
QueryParam( param );
// QueryIP()
//
// returns the IP address of the connecting browser
//
// QueryIP() --> "192.168.0.5"
//
QueryIP();