rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Making a CGI request to a program (fossil-scm) from Rack (Sinatra)
@ 2012-02-20  1:37 Guillermo Estrada
  2012-02-20 13:18 ` Steve Klabnik
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Guillermo Estrada @ 2012-02-20  1:37 UTC (permalink / raw)
  To: Rack Development

Hi, I just hope this is the place where I'll find the answer.

Fossil-Scm is a Source Code Management System that has a built in web
server for tracking issues and a wiki and such. It supports CGI also
to avoid running long term processes while hosting multiple repos. The
documentation suggests creating a simple CGI script like this one for
each repo you would like to host:

#!/usr/bin/fossil
repository: /route/to/repo/name.fossil

And this is all fine and works wonders in my web hosting.

What I want to do is to create a Sinatra (Rack) app to manage those
repositories, user authentication, common operations, create, delete,
etc... But in order to do that, I want to be able to manipulate the
route and the output of those webpages called via CGI.

Is there a way to take a request from my Rack application, take some
parameters, send them to the program (fossil) as a CGI request (This I
don't know how) and then get the output html to analyze/modify/etc...
and then sending the response from my Rack app?

Any help would be GREATLY appreciated.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Making a CGI request to a program (fossil-scm) from Rack (Sinatra)
  2012-02-20  1:37 Making a CGI request to a program (fossil-scm) from Rack (Sinatra) Guillermo Estrada
@ 2012-02-20 13:18 ` Steve Klabnik
  2012-02-20 16:24 ` Joshua Ballanco
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Steve Klabnik @ 2012-02-20 13:18 UTC (permalink / raw)
  To: rack-devel

Is Faraday what you want?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Making a CGI request to a program (fossil-scm) from Rack (Sinatra)
  2012-02-20  1:37 Making a CGI request to a program (fossil-scm) from Rack (Sinatra) Guillermo Estrada
  2012-02-20 13:18 ` Steve Klabnik
@ 2012-02-20 16:24 ` Joshua Ballanco
  2012-02-20 19:29 ` Eric Wong
  2012-02-20 21:08 ` James Tucker
  3 siblings, 0 replies; 6+ messages in thread
From: Joshua Ballanco @ 2012-02-20 16:24 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 1616 bytes --]

You might start by reading the wiki page for CGI: http://en.wikipedia.org/wiki/Common_Gateway_Interface (and, if you're up to it, read RFC3875 after that). The moral of the story is that a CGI script is just a script that expects a variety of environment variables describing the request made, and the POST/PUT body on stdin. With a little bit of experimentation, I expect you should be able to simply shell-out to Fossil to do what you want.

On Sunday, February 19, 2012 at 8:37 PM, Guillermo Estrada wrote:

> Hi, I just hope this is the place where I'll find the answer.
> 
> Fossil-Scm is a Source Code Management System that has a built in web
> server for tracking issues and a wiki and such. It supports CGI also
> to avoid running long term processes while hosting multiple repos. The
> documentation suggests creating a simple CGI script like this one for
> each repo you would like to host:
> 
> #!/usr/bin/fossil
> repository: /route/to/repo/name.fossil
> 
> And this is all fine and works wonders in my web hosting.
> 
> What I want to do is to create a Sinatra (Rack) app to manage those
> repositories, user authentication, common operations, create, delete,
> etc... But in order to do that, I want to be able to manipulate the
> route and the output of those webpages called via CGI.
> 
> Is there a way to take a request from my Rack application, take some
> parameters, send them to the program (fossil) as a CGI request (This I
> don't know how) and then get the output html to analyze/modify/etc...
> and then sending the response from my Rack app?
> 
> Any help would be GREATLY appreciated. 


[-- Attachment #2: Type: text/html, Size: 2480 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Making a CGI request to a program (fossil-scm) from Rack (Sinatra)
  2012-02-20  1:37 Making a CGI request to a program (fossil-scm) from Rack (Sinatra) Guillermo Estrada
  2012-02-20 13:18 ` Steve Klabnik
  2012-02-20 16:24 ` Joshua Ballanco
@ 2012-02-20 19:29 ` Eric Wong
  2012-02-21  0:41   ` Guillermo Estrada
  2012-02-20 21:08 ` James Tucker
  3 siblings, 1 reply; 6+ messages in thread
From: Eric Wong @ 2012-02-20 19:29 UTC (permalink / raw)
  To: rack-devel

Guillermo Estrada <phrozen10@gmail.com> wrote:
> Is there a way to take a request from my Rack application, take some
> parameters, send them to the program (fossil) as a CGI request (This I
> don't know how) and then get the output html to analyze/modify/etc...
> and then sending the response from my Rack app?

There's rack-legacy: git://github.com/eric1234/rack-legacy

unicorn still has a Unicorn::App::ExecCGI module I wrote
before rack-legacy existed:
  http://bogomips.org/unicorn.git/tree/lib/unicorn/app/exec_cgi.rb
(The cgit instance on bogomips.org still runs off ExecCGI).

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Making a CGI request to a program (fossil-scm) from Rack (Sinatra)
  2012-02-20  1:37 Making a CGI request to a program (fossil-scm) from Rack (Sinatra) Guillermo Estrada
                   ` (2 preceding siblings ...)
  2012-02-20 19:29 ` Eric Wong
@ 2012-02-20 21:08 ` James Tucker
  3 siblings, 0 replies; 6+ messages in thread
From: James Tucker @ 2012-02-20 21:08 UTC (permalink / raw)
  To: rack-devel

rackup(1) that ships with rack can support cgi.


#!/usr/bin/env rackup
run Rack::Lobster

On Feb 19, 2012, at 5:37 PM, Guillermo Estrada wrote:

> Hi, I just hope this is the place where I'll find the answer.
> 
> Fossil-Scm is a Source Code Management System that has a built in web
> server for tracking issues and a wiki and such. It supports CGI also
> to avoid running long term processes while hosting multiple repos. The
> documentation suggests creating a simple CGI script like this one for
> each repo you would like to host:
> 
> #!/usr/bin/fossil
> repository: /route/to/repo/name.fossil
> 
> And this is all fine and works wonders in my web hosting.
> 
> What I want to do is to create a Sinatra (Rack) app to manage those
> repositories, user authentication, common operations, create, delete,
> etc... But in order to do that, I want to be able to manipulate the
> route and the output of those webpages called via CGI.
> 
> Is there a way to take a request from my Rack application, take some
> parameters, send them to the program (fossil) as a CGI request (This I
> don't know how) and then get the output html to analyze/modify/etc...
> and then sending the response from my Rack app?
> 
> Any help would be GREATLY appreciated.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Making a CGI request to a program (fossil-scm) from Rack (Sinatra)
  2012-02-20 19:29 ` Eric Wong
@ 2012-02-21  0:41   ` Guillermo Estrada
  0 siblings, 0 replies; 6+ messages in thread
From: Guillermo Estrada @ 2012-02-21  0:41 UTC (permalink / raw)
  To: Rack Development

Rack-Legacy might be just EXACTLY what I was looking for :D Thanks for
the link. I just need to learn it and check if it's usable.

On Feb 20, 1:29 pm, Eric Wong <normalper...@yhbt.net> wrote:
> Guillermo Estrada <phroze...@gmail.com> wrote:
> > Is there a way to take a request from my Rack application, take some
> > parameters, send them to the program (fossil) as a CGI request (This I
> > don't know how) and then get the output html to analyze/modify/etc...
> > and then sending the response from my Rack app?
>
> There's rack-legacy: git://github.com/eric1234/rack-legacy
>
> unicorn still has a Unicorn::App::ExecCGI module I wrote
> before rack-legacy existed:
>  http://bogomips.org/unicorn.git/tree/lib/unicorn/app/exec_cgi.rb
> (The cgit instance on bogomips.org still runs off ExecCGI).

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-21 20:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-20  1:37 Making a CGI request to a program (fossil-scm) from Rack (Sinatra) Guillermo Estrada
2012-02-20 13:18 ` Steve Klabnik
2012-02-20 16:24 ` Joshua Ballanco
2012-02-20 19:29 ` Eric Wong
2012-02-21  0:41   ` Guillermo Estrada
2012-02-20 21:08 ` James Tucker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).