You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module is a drop-in replacement for node's standard http module (server only). Code written for a http server should work without changes with FastCGI. It can be used to build FastCGI applications or to convert existing node applications to FastCGI.
13
9
14
10
The implementation is fully compliant with the [FastCGI 1.0 Specification](https://fast-cgi.github.io/spec).
The `createServer` function takes four **optional** parameters:
47
39
@@ -69,9 +61,7 @@ The `createServer` function takes four **optional** parameters:
69
61
70
62
`valueMap` maps FastCGI value names to keys in the `config` object. For more information read [the next section](#fastcgi-values)
71
63
72
-
73
-
FastCGI values
74
-
--------------
64
+
## FastCGI values
75
65
76
66
FastCGI clients can query configuration values from applications with FCGI_GET_VALUES records. Those records contain a sequence of key-value pairs with empty values; the application must fetch the corresponding values for each key and send the data back to the client.
**WARNING: This `valueMap` thing is complete nonsense and is definitely going to change in the next release.**
92
-
81
+
**WARNING: The `valueMap` API is a bad design choice and is going to change in the future.**
93
82
94
-
Listening for connections
95
-
-------------------------
83
+
## Listening for connections
96
84
97
85
When a FastCGI service is started, the stdin descriptor (fd 0) [is replaced by a bound socket](https://fast-cgi.github.io/spec#accepting-transport-connections). The service application can then start listening on that socket and accept connections.
98
86
@@ -110,9 +98,7 @@ if (fcgi.isService()) {
110
98
}
111
99
```
112
100
113
-
114
-
Request URL components
115
-
----------------------
101
+
## Request URL components
116
102
117
103
The `url` property of the request object is taken from the `REQUEST_URI` CGI variable, which is non-standard. If `REQUEST_URI` is missing, the url is built by joining three CGI variables:
118
104
@@ -124,9 +110,7 @@ For more information read [section 4.1](https://tools.ietf.org/html/rfc3875#sect
124
110
125
111
Raw CGI variables can be accessed through the `params` property of the socket object. More information [here](#the-socket-object).
126
112
127
-
128
-
Authorizer and filter requests
129
-
------------------------------
113
+
## Authorizer and filter requests
130
114
131
115
Authorizer requests may have no url. Response objects for the authorizer role come with the `Content-Type` header already set to `text/plain` and expose three additional methods:
132
116
@@ -136,9 +120,7 @@ Authorizer requests may have no url. Response objects for the authorizer role co
136
120
137
121
Filter requests have an additional data stream exposed by the `dataStream` property of [the socket object](#the-socket-object) (`req.socket.dataStream`).
138
122
139
-
140
-
The socket object
141
-
-----------------
123
+
## The socket object
142
124
143
125
The socket object exposed in requests and responses implements the `stream.Duplex` interface. It exposes the FastCGI stdin stream (request body)
144
126
and translates writes to stdout FastCGI records.
@@ -149,9 +131,7 @@ The socket object exposes three additional properties:
149
131
-`dataStream` implements `stream.Readable`, exposes the FastCGI data stream for the filter role.
150
132
-`errorStream` implements `stream.Writable`, translates writes to stderr FastCGI Records.
151
133
152
-
153
-
http module compatibility
154
-
-------------------------
134
+
## http module compatibility
155
135
156
136
The API is almost compatible with the http module from node v0.12 all the way to v6.x (the current series). Only the server API is implemented.
157
137
@@ -164,9 +144,7 @@ Differences:
164
144
-`req.trailers` will always be empty: CGI scripts never receive trailers
165
145
-`res.writeContinue()` works as expected but should not be used. See first item
0 commit comments