Proposed fix for #1280

This PR proposes a fix for #1280, and #1676.

It is not ready to be merged, as I need a few more tests. 

Input for tests are very welcome.
This is a bit glitchy. It will result (only tried it with the ASP.NET host so far) in the path containing two leading forward slashed

![image](https://cloud.githubusercontent.com/assets/50543/5239624/bac21e5e-78e8-11e4-8572-0d691ca31896.png)

This is because the segments starts with a leading slash, so the code concatenates with a second one