inconshreveable/ngrok — pull request #34 by NickPresta (2013-09-26 06:07:56+00:00)
Title: Limiting the length of the request's path.

## My attempt

Attempting to solve issue https://github.com/inconshreveable/ngrok/issues/30

The solution was limiting the path to 25 characters total (24 + the beginning `/`)

The approach I took was:

1. Explode the path into 26 parts.
2. Join the first 25 parts to get the "truncated" path

This handles unicode very nicely as well, although https://github.com/nsf/termbox-go/pull/21 prevents this solution from working on non-ascii paths.

The alternative approach I also tried was: https://gist.github.com/NickPresta/6710165 which was essentially "inspired" by http://golang.org/src/pkg/strings/strings.go#L15 (splitting without appending the reminding string). I can use this instead if you prefer.

I'm not exactly sure what you had in mind to fix this issue. I left out any sort of `...`, which would show that the path has been truncated, because I figured those extra 3 characters could be useful data that I didn't want to waste.

Another alternative that I didn't look at exploring too much would be to increase the width of the bottom area so instead of having 70 columns, you have something like 120, but again, I don't know the goal of ngrok (should it work in 80 columns, etc?)

## Pictures
![screen shot 2013-09-26 at 1 28 24 am](https://f.cloud.github.com/assets/49090/1215620/89ed18de-266d-11e3-8499-ded9277127bc.png)

The unicode path problem I mentioned above looks like this:
![screen shot 2013-09-26 at 1 38 23 am](https://f.cloud.github.com/assets/49090/1215627/ea575842-266d-11e3-815d-f6d5b0492876.png)
(This happens in the current version, as well). Once https://github.com/nsf/termbox-go/pull/21 is fixed, this is an easy fix.