1PSGI::Extensions(3) User Contributed Perl Documentation PSGI::Extensions(3)
2
3
4
6 PSGI::Extensions - PSGI extensions
7
9 The PSGI environment MAY include the following additional extensions.
10 They are OPTIONAL and applications and middleware components SHOULD
11 check if they exist in the environment before using the functionality
12 provided.
13
14 · "psgix.io": The raw IO socket to access the client connection to do
15 low-level socket operations. This is only available in PSGI servers
16 that run as an HTTP server, and should be used when (and only when)
17 you want to jailbreak out of PSGI abstraction, to implement
18 protocols over HTTP such as BOSH or WebSocket.
19
20 · "psgix.input.buffered": A boolean which is true if the HTTP request
21 body (for POST or PUT requests) is buffered using a temporary
22 filehandle or PerlIO in "psgi.input". When this is set,
23 applications or middleware components can safely "read" from
24 "psgi.input" without worrying about non-blocking I/O and then can
25 call "seek" to rewind the input for the transparent access.
26
27 · "psgix.logger": A code reference to log messages. The code
28 reference is passed one argument as a hash reference that
29 represents a message to be logged. The hash reference MUST include
30 at least two keys: "level" and "message" where "level" MUST be one
31 of the following strings: "debug", "info", "warn", "error" and
32 "fatal". "message" SHOULD be a plain string or a scalar variable
33 that stringifies.
34
35 · "psgix.session": A hash reference for storing and retrieving
36 session data. Updates made on this hash reference SHOULD be
37 persisted by middleware components and SHOULD be restored in the
38 succeeding requests. How to persist and restore session data, as
39 well as how to identify the requesting clients are implementation
40 specific.
41
42 "psgix.session.options": A hash reference to tell Middleware
43 components how to manipulate session data after the request.
44 Acceptable keys and values are implementation specific.
45
46 · "psgix.harakiri": A boolean which is true if the PSGI server
47 supports harakiri mode, that kills a worker (typically a forked
48 child process) after the current request is complete.
49
50 "psgix.harakiri.commit": A boolean which is set to true by the PSGI
51 application or middleware when it wants the server to kill the
52 worker after the current request.
53
54 · "psgix.cleanup" - A boolean flag indicating whether a PSGI server
55 supports cleanup handlers. Absence of the key assumes false (i.e.
56 unsupported). Middleware and applications MUST check this key
57 before utilizing the cleanup handlers.
58
59 "psgix.cleanup.handlers" - Array reference to stack callback
60 handlers. This reference MUST be initialized as an empty array
61 reference by the servers. Applications can register the callbacks
62 by simply push()ing a code reference to this array reference.
63 Callbacks will be called once a request is complete, and will
64 receive $env as its first argument, and return value of the
65 callbacks will be simply ignored. An exception thrown inside
66 callbacks MAY also be ignored.
67
68 If the server also supports "psgix.harakiri", it SHOULD implement
69 in a way that cleanup handlers run before harakiri checker, so that
70 the cleanup handlers can commit the harakiri flag.
71
73 Copyright Tatsuhiko Miyagawa, 2009-2011.
74
75 This document is licensed under the Creative Commons license by-sa.
76
77
78
79perl v5.32.0 2020-07-28 PSGI::Extensions(3)