Nancy: Route issue

Created on 30 Sep 2016  路  11Comments  路  Source: NancyFx/Nancy

I have route
Get["/{url}/{printer}"]

If i send this url to Chrome all work fine
localhost:8888/yandex.ru/HP Universal Printing PCL 6

Then i try send this url, but route not work.
localhost:8888/http://www.yandex.ru/HP Universal Printing PCL 6

I also try HttpUtility.UrlEncode("http://www.yandex.ru"); but it not work too.
localhost:8888/http%3a%2f%2fwww.yandex.ru/HP Universal Printing PCL 6

404 - NotFound
The resource you have requested cannot be found.

We're sorry :-(

Most helpful comment

So double encoding did not work for you @Radzhab? Hmmm it should because we only decode the route once. That's strange.

I have some free time tonight so I'll try reproduce this and see if there's a quick work around to unblock you.

All 11 comments

The issue template is there for a reason. It's asking you to fill out the details, like which versions you're using, which host your running etc., so we don't have to.

But here we are... asking; what host and what versions are you using? :stuck_out_tongue_closed_eyes:

There's also a duplicate Stack Overflow question for this by @Radzhab http://stackoverflow.com/questions/39785864/how-pass-url-params-to-route

This looks like the old "twice decoding" thing?

Double encoding would resolve the issue:

localhost:8888/http://www.yandex.ru/HP Universal Printing PCL 6

When this is either not encoded, or is encoded (once), the URL is decoded and end's up being split on the //.

I use 1.4.1.0 version

And the host?

https://gist.github.com/Radzhab/46abc95cdfe4b018ad3c9a8dae7003ca
Nancy.dll 1.4.1
Nancy.Hosting.Self.dll 1.4.1
Mono.Posix.dll 4.0.0

Yeah, that's probably the double-decoding issue that affected self-hosting. This was fixed in https://github.com/NancyFx/Nancy/pull/2462

You either have to update to one of the 2.0 pre-release versions or double encode the value you're passing in :cry:

I intall pre-release but it all the same - not work.. I try this url
localhost:8888/https%3A%2F%2Fwww.google.com%2F2
and localhost:8888/https%3A%2F%2Fwww.google.com/F2

So double encoding did not work for you @Radzhab? Hmmm it should because we only decode the route once. That's strange.

I have some free time tonight so I'll try reproduce this and see if there's a quick work around to unblock you.

update.......

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phillip-haydon picture phillip-haydon  路  3Comments

jgillich picture jgillich  路  7Comments

lgabryel picture lgabryel  路  7Comments

juniormayhe picture juniormayhe  路  4Comments

cody82 picture cody82  路  9Comments