Created
          January 18, 2010 14:01 
        
      - 
      
 - 
        
Save hassox/280030 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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