<-- back to the mailing list

Trying to learn CGI, please help, total newbie lost

b10m menno+gemini.at.lists.orbitalfox.eu at b10m.net

Sat Feb 13 13:46:58 GMT 2021

- - - - - - - - - - - - - - - - - - - 

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 rubyoften). You probably want `print` (or `puts`, to add a newlineautomatically).

So either:

puts "20 text/gemini\r\n"

or:

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

-- b10m