Native HTTP stack for Node.js on Windows

httpsys - native HTTP stack for node.js apps on Windows

The httpsys module is a native HTTP stack for node.js applications on Windows. It is based on HTTP.SYS. Compared to the built in HTTP stack in node.js it offers kernel mode output caching, port sharing, and kernel mode SSL configuration. Once WebSocket support is added, it will only work starting from Windows 8. Cluster is supported. The module aspires to provide high level of API and behavior compatibility with the built in HTTP stack in node.js.

This is a very early version of the module. Not much testing or performance optimization had been done. The module had been developed against node.js 0.8.7 (but should work against 0.8.x). Any and all feedback is welcome here.

More documentation will come; here is how to get started:

npm install httpsys

Then in your code:

var http = require('httpsys').http();
http.createServer(function (reqres) {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.end('Hello, world!');

To use port sharing, provide a full [URL prefix string]( in the call to Server.listen, e.g.:

var http = require('httpsys').http();
http.createServer(function (reqres) {
  // ... 

At the same time, you can start another process that listens on a different URL prefix on the same port, e.g. http://*:8080/bar/. Each of the processes will only receive requests matching the URL prefix they registered for.

To inspect or modify HTTP.SYS configuration underlying your server use the netsh http command in Windows. This allows you to set various timeout values as well as configure SSL certificates.

Any and all feedback is welcome here.