Skip to content

Instantly share code, notes, and snippets.

@hassox
Created January 18, 2010 14:01
Show Gist options
  • Save hassox/280030 to your computer and use it in GitHub Desktop.
Save hassox/280030 to your computer and use it in GitHub Desktop.
var http = require('http');
var sys = require('sys');
var startsWithSlash = /^\//;
var oldIM = http.IncomingMessage;
http.IncomingMessage = function(){
this = Object.create(oldIM.prototype);
oldIM.apply(this, arguments)
var scriptName = "";
this.__defineSetter__("scriptName", function(val){
if(val.length > 0){
if(!val.match(startsWithSlash))
throw(new Error("Must start with \"/\""));
}
return scriptName = val;
})
this.__defineGetter__("scriptName", function(){
return scriptName;
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment