💾 Archived View for gemi.dev › gemini-mailing-list › 000698.gmi captured on 2024-08-31 at 18:05:51. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-12-28)

-=-=-=-=-=-=-

Trying to learn CGI, please help, total newbie lost

1. Miguel de Luis Espinosa (enteka (a) fastmail.com)

OK, so, I've never done this kind of thing before, just PHP'd websites or 
using sinatra (ruby) that would take care of the "small details" for you.

So I tried this on a space I have on the ctrl-c.club tilde

 ```
#!/usr/bin/ruby

p "20 SUCCESS\n\r" # also tried puts
puts "# Cgi is working"
puts "some text"
puts "=>gemini://enteka.xyz some link"
 ```

and it doesn't seem to work. Amphora, for one does not recognize it. I'm 
sure I'm doing thins wrong here

Could that work in principle? Could I have an issue with permissions?

Please help

Link to individual message.

2. Omar Polo (op (a) omarpolo.com)


Miguel de Luis Espinosa <enteka at fastmail.com> writes:

> OK, so, I've never done this kind of thing before, just PHP'd websites 
or using sinatra (ruby) that would take care of the "small details" for you.
>
> So I tried this on a space I have on the ctrl-c.club tilde
>
> ```
> #!/usr/bin/ruby
>
> p "20 SUCCESS\n\r" # also tried puts

I don't know how ctrl-c.club works, what server they use etc.  But this
(if it's not a copy-paste error) looks wrong.  Instead of "SUCCESS" you
should put a media type there, like text/gemini.  Also, the \n and \r
are in the wrong order, \r comes first.  (puts should add a \n by itself
at the end, so `puts "20 text/gemini\r"` should be enough).

Then make sure /usr/bin/ruby is the correct path for you ruby
interpreter (you can type `which ruby` to check, or use `/usr/bin/env
ruby` which is "portable enough" across various UNIXes).

In the end, make sure it has the executable bit set (i.e. `chmod +x
your-cgi-script`).  Different gemini servers MAY impose limits on where
you store your scripts (i.e. under /cgi-bin/ or similar).

If it's nothing in the above list, then it's something you should inform
ctrl-c.club about (maybe they don't allow scripts?)

HTH

> puts "# Cgi is working"
> puts "some text"
> puts "=>gemini://enteka.xyz some link"
> ```
>
> and it doesn't seem to work. Amphora, for one does not recognize it. I'm 
sure I'm doing thins wrong here
>
> Could that work in principle? Could I have an issue with permissions?
>
> Please help

Link to individual message.

3. b10m (menno+gemini.at.lists.orbitalfox.eu (a) b10m.net)

On Sat, Feb 13, 2021 at 02:21:19PM +0100, Omar Polo wrote:
> Miguel de Luis Espinosa <enteka at fastmail.com> writes:
> 
> > OK, so, I've never done this kind of thing before, just PHP'd
> > websites or using sinatra (ruby) that would take care of the
> > "small details" for you.
> >
> > So I tried this on a space I have on the ctrl-c.club tilde
> >
> > ``` #!/usr/bin/ruby
> >
> > p "20 SUCCESS\n\r" # also tried puts
> 
> I don't know how ctrl-c.club works, what server they use etc.  But
> this (if it's not a copy-paste error) looks wrong.  Instead of
> "SUCCESS" you should put a media type there, like text/gemini.
> Also, the \n and \r are in the wrong order, \r comes first.  (puts
> should add a \n by itself at the end, so `puts "20 text/gemini\r"`
> should be enough).

Also note that `p` is used for debugging (IIRC; I don't know ruby
often). You probably want `print` (or `puts`, to add a newline
automatically).

So either:

puts "20 text/gemini\r\n"

or:

print "20 text/gemini\r\n\n"

-- 
b10m

Link to individual message.

---

Previous Thread: Convert Gemini files to HTML

Next Thread: Source Code Control (git)