Q: Did you leave your calculator at home before entering your Geminispace capsule? Perhaps not, but in case you did, there is now a Gemini arithmetic calculator to get you out of your pickle. This is another CGI test application - I wanted to test the process of getting input from the user. The calculator itself: => gemini://gemini.marmaladefoo.com/cgi-bin/calc.cgi?0 You should be able to throw any simple arithmetic calculation at it, including brackets, scientific notation etc. It will try to help you out if you feed it nonsense or invalid input. It doesn't have any inbuilt functions like sine, or mathematical constants like e, i, pi though. So it's kinda basic, but fun. There is also a short blog post walking through the high level logic => gemini://gemini.marmaladefoo.com/blog/6-Jun-2020_CGI_with_input.gmi Best Wishes - Luke
It was thus said that the Great Luke Emmet once stated: > > You should be able to throw any simple arithmetic calculation at it, > including brackets, scientific notation etc. It will try to help you out > if you feed it nonsense or invalid input. It doesn't have any inbuilt > functions like sine, or mathematical constants like e, i, pi though. So > it's kinda basic, but fun. So at first, I tried: 3*2+1 It failed, saying I needed to space the operands. Okay. I then tried: 3 * 2 + 1 And it still failed. I wonder if you aren't decoding the query properly. -spc
On 06-Jun-2020 22:56, Sean Conner wrote: > It was thus said that the Great Luke Emmet once stated: >> You should be able to throw any simple arithmetic calculation at it, >> including brackets, scientific notation etc. It will try to help you out >> if you feed it nonsense or invalid input. It doesn't have any inbuilt >> functions like sine, or mathematical constants like e, i, pi though. So >> it's kinda basic, but fun. > So at first, I tried: > > 3*2+1 > > It failed, saying I needed to space the operands. Okay. I then tried: > > 3 * 2 + 1 > > And it still failed. I wonder if you aren't decoding the query properly. That should work. It works for me: gemini://gemini.marmaladefoo.com/cgi-bin/calc.cgi?3%20*%202%20+%201 Is your client url escaping the request? There could be a mismatch between client and server (molly brown) regarding query params. Best wishes - Luke
It was thus said that the Great Luke Emmet once stated: > > On 06-Jun-2020 22:56, Sean Conner wrote: > >It was thus said that the Great Luke Emmet once stated: > >>You should be able to throw any simple arithmetic calculation at it, > >>including brackets, scientific notation etc. It will try to help you out > >>if you feed it nonsense or invalid input. It doesn't have any inbuilt > >>functions like sine, or mathematical constants like e, i, pi though. So > >>it's kinda basic, but fun. > > So at first, I tried: > > > > 3*2+1 > > > >It failed, saying I needed to space the operands. Okay. I then tried: > > > > 3 * 2 + 1 > > > >And it still failed. I wonder if you aren't decoding the query properly. > > That should work. It works for me: > > gemini://gemini.marmaladefoo.com/cgi-bin/calc.cgi?3%20*%202%20+%201 That did not work. What did work? "gemini://gemini.marmaladefoo.com/cgi-bin/calc.cgi?3 * 2 + 1" That is, when I *did not* encode the query [1], it worked. > Is your client url escaping the request? Define "url escaping the request". Because a query like "3 * 2 + 1" needs to be esscpaed to "3%20*%202%20+%201"---it can also be escaped as "%33%20%2A%20%32%20%2B%20%31". It's that escaped string that is sent to the server. -spc [1] I have a *very* basic Gemini client that sends verbatim what I tell it to send.
On 06-Jun-2020 23:16, Sean Conner wrote: > <snip> > That did not work. What did work? > > "gemini://gemini.marmaladefoo.com/cgi-bin/calc.cgi?3 * 2 + 1" > > That is, when I *did not* encode the query [1], it worked. >> Is your client url escaping the request? > Define "url escaping the request". Because a query like "3 * 2 + 1" needs > to be esscpaed to "3%20*%202%20+%201"---it can also be escaped as > "%33%20%2A%20%32%20%2B%20%31". It's that escaped string that is sent to the > server. > > -spc > > [1] I have a *very* basic Gemini client that sends verbatim what I tell > it to send. Thanks for the feedback. I'll investigate further and try to get to the bottom of this... - Luke
On 06-Jun-2020 23:28, Luke Emmet wrote: > On 06-Jun-2020 23:16, Sean Conner wrote: >> Define "url escaping the request". Because a query like "3 * 2 + >> 1" needs >> to be esscpaed to "3%20*%202%20+%201"---it can also be escaped as >> "%33%20%2A%20%32%20%2B%20%31". It's that escaped string that is sent >> to the >> server. >> >> -spc >> >> [1] I have a *very* basic Gemini client that sends verbatim what >> I tell >> it to send. I'm now decoding the query on the server side. Does it work for you now? This may have revealed a client bug I need to fix thanks - Luke
It was thus said that the Great Luke Emmet once stated: > On 06-Jun-2020 23:28, Luke Emmet wrote: > >On 06-Jun-2020 23:16, Sean Conner wrote: > >> Define "url escaping the request". Because a query like "3 * 2 + > >>1" needs > >>to be esscpaed to "3%20*%202%20+%201"---it can also be escaped as > >>"%33%20%2A%20%32%20%2B%20%31". It's that escaped string that is sent > >>to the > >>server. > >> > >> -spc > >> > >>[1] I have a *very* basic Gemini client that sends verbatim what > >>I tell > >> it to send. > > I'm now decoding the query on the server side. Does it work for you now? Yes it does. > > thanks You're welcome. -spc
On Sat Jun 6, 2020 at 7:37 PM EDT, Luke Emmet wrote: > I'm now decoding the query on the server side. Does it work for you now? > > This may have revealed a client bug I need to fix Just a heads up, bombadillo doesn't encode the query string. int 80h
On 07-Jun-2020 00:38, int 80h wrote: > On Sat Jun 6, 2020 at 7:37 PM EDT, Luke Emmet wrote: >> I'm now decoding the query on the server side. Does it work for you now? >> >> This may have revealed a client bug I need to fix > Just a heads up, bombadillo doesn't encode the query string. I noticed this when testing with bombadillo. I think it probably should, if I understand things correctly. It seems it isn't something that is consistently done by the various clients. Might be good to have a stress test page on this somewhere. - Luke
As far as I can tell, Bombadillo *is* encoding the query string. Make sure you're on the latest version. I think the problem is that Bombadillo is encoding spaces as %20 and pluses as just a +. This is correct, but I think the server interprets a plus and a %20 as a space, when it should only be doing the latter. makeworld ??????? Original Message ??????? On Saturday, June 6, 2020 7:38 PM, int 80h <int at 80h.dev> wrote: > On Sat Jun 6, 2020 at 7:37 PM EDT, Luke Emmet wrote: > > > I'm now decoding the query on the server side. Does it work for you now? > > This may have revealed a client bug I need to fix > > Just a heads up, bombadillo doesn't encode the query string. > > int 80h
---