News for hackers. Stuff that matters.

htty, the HTTP TTY

http://blog.nilsjonsson.com/post/1076166313/introducing-htty-the-http-tty

I just published a first release of a new console app called htty. I like to think it’s something of a cross between curl and the Lynx browser.

Some bullet points:

* Intuitive commands and command aliases * Support for familiar HTTP methods GET, POST, PUT, and DELETE, as well as HEAD, OPTIONS and TRACE * Automatic URL-encoding of query-string parameters and URL fragments * Transcripts, both verbose and summary * Dead-simple cookie handling and redirect following * Built-in help

Why do this when the admirable Node.js-based http-console exists? To begin with, not everybody is into Node yet, and so installing http-console is not as simple as 'gem install htty'. Furthermore, http-console's spare UI is not as full-featured as it might be.

I have some killer features in mind for the near future. Fork and contribute!

( 29 comments | 128 points | on HN )
Re:htty, the HTTP TTY by njonsson on Monday September 06, 2010 @11:40PM (#1667957)
Why do this when the admirable Node.js-based http-console exists?

To begin with, not everybody is into Node yet, and so installing http-console is not as simple as 'gem install htty'.

Furthermore, http-console's spare UI is not as full-featured as it might be.

I have some killer features in mind for the near future.

Fork and contribute!

Re:htty, the HTTP TTY by pquerna on Tuesday September 07, 2010 @12:52AM (#1668084)
still worth a link to http-console though: http://github.com/cloudhead/http-console

(one of my favorite little tools of this year, need to spend some time to make it support oauth crap at some point)

Re:htty, the HTTP TTY by njonsson on Tuesday September 07, 2010 @10:52AM (#1669005)
Yes, http-console really rocks. It was the inspiration for htty, as I indicate in the readme.
Re:htty, the HTTP TTY by mhansen on Tuesday September 07, 2010 @02:43AM (#1668277)
Just a bit of (unrelated) feedback: It's difficult to see the tty examples in small scaled images.
Re:htty, the HTTP TTY by tengkahwee on Tuesday September 07, 2010 @02:54AM (#1668290)
Clicking on the images gives you the enlarged version.
Re:htty, the HTTP TTY by asjo on Tuesday September 07, 2010 @12:39PM (#1669311)
PNG-screenshots of a tty application - perfect.
Re:htty, the HTTP TTY by eddie_catflap on Tuesday September 07, 2010 @12:21AM (#1668024)
I really like this - can see some real troubleshooting benefits for it. Great work!
Re:htty, the HTTP TTY by wavesplash on Tuesday September 07, 2010 @03:04AM (#1668308)
Brilliant.

Any thoughts on Oauth2 and Facebook Graph support?

Re:htty, the HTTP TTY by pak on Tuesday September 07, 2010 @03:01AM (#1668301)
This looks like the perfect companion for playing around with a REST API.. very cool. Certainly more fun than composing monstrous curl invocations.
Re:htty, the HTTP TTY by steve19 on Tuesday September 07, 2010 @06:58AM (#1668555)
This app is crying out for readline support and command completion!
Re:htty, the HTTP TTY by kree10 on Tuesday September 07, 2010 @08:22AM (#1668683)
I'd take the next logical step: integrate it with a shell, much like zsh's zftp module does for FTP sessions.

I may have to write this now.

Re:htty, the HTTP TTY by tyweir on Tuesday September 07, 2010 @10:50AM (#1668999)
Please let HN know if you do in fact do this, as it would no doubt be beneficial to a good percentage.
Re:htty, the HTTP TTY by njonsson on Tuesday September 07, 2010 @02:48PM (#1669711)
I'm interested to see where you go with this. Thanks in advance for contributing.
Re:htty, the HTTP TTY by parenthesis on Tuesday September 07, 2010 @09:21AM (#1668789)
Re:htty, the HTTP TTY by telemachos on Tuesday September 07, 2010 @01:03PM (#1669392)
This is interesting, but I'm curious: what do people think are the advantages or disadvantages of using this instead of Ruby's own readline support?

(My first thought: rlwrap already exists. Add one point. A disadvantage is that rlwrap makes the readline support depend on an external, third-party program which would need to be installed separately. Subtract one?)

Re:htty, the HTTP TTY by njonsson on Tuesday September 07, 2010 @02:46PM (#1669707)
I agree. Minimizing external dependencies (with a particular focus on the OS X experience) was a guiding principle of the project.

I will probably use Ruby Readline (http://bogojoker.com/readline) to implement this. Another planned feature will likely require using Curses. It would be nice to reduce these two dependencies to one, but I'm not sure I'll start by reimplementing Ruby Readline in Curses.

Re:htty, the HTTP TTY by steve19 on Tuesday September 07, 2010 @03:41PM (#1669874)
rlwrap is useful, but it lacks command tab completion.

Typing

http://www.google.com>; co[tab]-a

is much easier than typing

http://www.google.com>; cookies-a

Re:htty, the HTTP TTY by parenthesis on Tuesday September 07, 2010 @04:41PM (#1670023)
rlwrap can do completion, given a little setting-up: http://utopia.knoware.nl/~hlub/rlwrap/rlwrap.html
Re:htty, the HTTP TTY by sz on Tuesday September 07, 2010 @03:52AM (#1668359)
This + REST = CLI for the Web
Re:htty, the HTTP TTY by james2vegas on Tuesday September 07, 2010 @05:18AM (#1668444)
So, basically http://search.cpan.org/dist/WWW-Mechanize-Shell then. Congratulations, your new wheel is round and shiny.
Re:htty, the HTTP TTY by boundlessdreamz on Tuesday September 07, 2010 @09:33AM (#1668821)
Some of us may not want to install perl or figure out how to use cpan. If this project is not useful to you, then don't comment. Please don't comment just for being sarcastic
Re:htty, the HTTP TTY by kragen on Thursday September 09, 2010 @09:47PM (#1677600)
This is the most useful comment of all, because it summarizes the software in eleven words (although it left out "for Ruby".)
Re:htty, the HTTP TTY by mhansen on Tuesday September 07, 2010 @09:18AM (#1668784)
Doesn't look like that supports other HTTP methods (a CTRL-F for 'delete' shows nothing).
Re:htty, the HTTP TTY by njonsson on Tuesday September 07, 2010 @10:55AM (#1669010)
Yes, all these HTTP methods are supported: GET, POST, PUT, DELETE, HEAD, OPTIONS, TRACE.

The command aliases are set up to reflect frequency of use. GET, POST, PUT, and DELETE can be invoked using those words as commands, but HEAD, OPTIONS, and TRACE must be specified as 'http-head', 'http-options', and 'http-trace', respectively.

Re:htty, the HTTP TTY by mansilla on Tuesday September 07, 2010 @05:27AM (#1668456)
+1 on the Perl love.
Re:htty, the HTTP TTY by cloudhead on Tuesday September 07, 2010 @03:21PM (#1669813)
Fantastic, I was hoping someone would implement the concept for all the ruby developers out there! I love the history feature too, I might have to steal it ;>
Re:htty, the HTTP TTY by njonsson on Tuesday September 07, 2010 @04:04PM (#1669935)
Absolutely — return the favor!
Re:htty, the HTTP TTY by datapimp on Tuesday September 07, 2010 @04:40AM (#1668409)
This is really good work. Any plans to support ncurse or something along those lines, so that I can arrow up through my command history?
Re:htty, the HTTP TTY by njonsson on Tuesday September 07, 2010 @02:50PM (#1669718)
See other remarks in this thread. Yes, this is a planned feature.