11#!/usr/bin/env node
22
3- var sys = require ( 'sys ' ) ,
3+ var util = require ( 'util ' ) ,
44 http = require ( 'http' ) ,
55 fs = require ( 'fs' ) ,
66 url = require ( 'url' ) ,
@@ -41,7 +41,7 @@ function HttpServer(handlers) {
4141HttpServer . prototype . start = function ( port ) {
4242 this . port = port ;
4343 this . server . listen ( port ) ;
44- sys . puts ( 'Http Server running at http://localhost:' + port + '/' ) ;
44+ util . puts ( 'Http Server running at http://localhost:' + port + '/' ) ;
4545} ;
4646
4747HttpServer . prototype . parseUrl_ = function ( urlString ) {
@@ -55,7 +55,7 @@ HttpServer.prototype.handleRequest_ = function(req, res) {
5555 if ( req . headers [ 'user-agent' ] ) {
5656 logEntry += ' ' + req . headers [ 'user-agent' ] ;
5757 }
58- sys . puts ( logEntry ) ;
58+ util . puts ( logEntry ) ;
5959 req . url = this . parseUrl_ ( req . url ) ;
6060 var handler = this . handlers [ req . method ] ;
6161 if ( ! handler ) {
@@ -108,9 +108,9 @@ StaticServlet.prototype.sendError_ = function(req, res, error) {
108108 res . write ( '<!doctype html>\n' ) ;
109109 res . write ( '<title>Internal Server Error</title>\n' ) ;
110110 res . write ( '<h1>Internal Server Error</h1>' ) ;
111- res . write ( '<pre>' + escapeHtml ( sys . inspect ( error ) ) + '</pre>' ) ;
112- sys . puts ( '500 Internal Server Error' ) ;
113- sys . puts ( sys . inspect ( error ) ) ;
111+ res . write ( '<pre>' + escapeHtml ( util . inspect ( error ) ) + '</pre>' ) ;
112+ util . puts ( '500 Internal Server Error' ) ;
113+ util . puts ( util . inspect ( error ) ) ;
114114} ;
115115
116116StaticServlet . prototype . sendMissing_ = function ( req , res , path ) {
@@ -127,7 +127,7 @@ StaticServlet.prototype.sendMissing_ = function(req, res, path) {
127127 ' was not found on this server.</p>'
128128 ) ;
129129 res . end ( ) ;
130- sys . puts ( '404 Not Found: ' + path ) ;
130+ util . puts ( '404 Not Found: ' + path ) ;
131131} ;
132132
133133StaticServlet . prototype . sendForbidden_ = function ( req , res , path ) {
@@ -143,7 +143,7 @@ StaticServlet.prototype.sendForbidden_ = function(req, res, path) {
143143 escapeHtml ( path ) + ' on this server.</p>'
144144 ) ;
145145 res . end ( ) ;
146- sys . puts ( '403 Forbidden: ' + path ) ;
146+ util . puts ( '403 Forbidden: ' + path ) ;
147147} ;
148148
149149StaticServlet . prototype . sendRedirect_ = function ( req , res , redirectUrl ) {
@@ -160,7 +160,7 @@ StaticServlet.prototype.sendRedirect_ = function(req, res, redirectUrl) {
160160 '">here</a>.</p>'
161161 ) ;
162162 res . end ( ) ;
163- sys . puts ( '301 Moved Permanently: ' + redirectUrl ) ;
163+ util . puts ( '301 Moved Permanently: ' + redirectUrl ) ;
164164} ;
165165
166166StaticServlet . prototype . sendFile_ = function ( req , res , path ) {
0 commit comments