Ensure that the pathname is not null

The pathname of the request URL can be parsed as `null`:
```javascript
var parse = require('url').parse
var url = 'ws://localhost:3000';
var pathname = parse(url).pathname  // pathname is null
```
When this happens the server crashes because we are trying to call `slice` on `null` `pathname`.

This patch ensures that there is a default value for `pathname` when it is parsed as `null`.