Simple SCGI client
Simple SCGI client.
scgi-stream lets you talk to scgi-speaking services without having to go through an intermediate HTTP server.
Available via npm:
$ npm install scgi-stream
Or via git:
$ git clone git://github.com/deoxxa/scgi-stream.git node_modules/scgi-stream
Makes an SCGI request. Returns an
SCGIRequest object. Also does some wiring
for you so that the request returned will emit a
response event when the
response begins to arrive. See the example section below for more information on
how this works.
var scgi = require"scgi-stream";scgirequestoptions;
streamis optionally a stream object. If
streamis not specified,
port, which are a string and a number respectively, will be used to construct a TCP socket.
methodare strings, and
headersis an object with a predictable structure.
Makes an SCGI request. Returns a duplex stream that combines both the request
and response parts of the operation. The stream returned will emit the
event like a regular
SCGIResponse object, but will not emit a
var scgi = require"scgi-stream";processstdinpipescgiduplexoptionspipeprocessstdout;
A duplex stream representing a request.
var req =path: "/"headers:"content-type": "text/plain";reqpipeprocessstdout;reqend"hi there";
A duplex stream that parses and represents a response. Emits a
when the headers for the stream have been parsed, then passes through all
var res = ;socketpiperespipeprocessstdout;reson"headers"console.logheaders;;
stream.Transformoptions such as
Also see example.js.
var scgi = require"scgi-stream";var req = scgirequesthost: "127.0.0.1"port: 17199path: "/";reqon"response"reson"headers"console.logheaders;;respipeprocessstdout;;reqend"<methodCall><methodName>download_list</methodName></methodCall>";
3-clause BSD. A copy is included with the source.