You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@whimsical.apache.org by Craig Russell <ap...@gmail.com> on 2020/06/27 23:31:39 UTC

Problems after POST

After sending the POST message, coi.cgi still thinks that reloading the page should re-send the POST and displays the message "Are you sure you want to send a form again?" How do we reset this so that reloading the page is a GET?

There is a similar problem with the POST from the Member Status change. Once the POST has been accepted, the memstat menu disappears but the cursor still shows a STOP (/) symbol. If the cursor is moved the symbol disappears but I'd like the code to remove the symbol. Probably something in memstat.json.rb but I modeled a similar bit of code in other ...json.rb files.

Any ideas?

Thanks,
Craig

Craig L Russell
clr@apache.org


Re: Problems after POST

Posted by Craig Russell <ap...@gmail.com>.
Thanks for the links. They explain a lot about how to deal with inadvertently sending a new POST. So I experimented with other .json.rb implementations. I updated my alt-email address via https://whimsy.apache.org/roster/committer/clr and have a few observations.

1. Like the memstat update POST, the cursor changed immediately to the STOP icon (/) and stayed that way until a keyboard key or mouse action. Is there some way to update the cursor when the reply is sent back?

2. Unlike the memstat update POST, reload of the page resulted in a normal GET to refresh the page. I looked at the email_alt.json.rb and saw that the last line of the rb file is identical to memstat:

# return updated committer info
_committer Committer.serialize(@userid, env)

I did not find anything about a redirect. Yet the behavior was different.

3. The memstat POST html that is returned includes the session transcript which we do want to present to the user. According to the links, we should somehow prepare a new page that we redirect the user to. How in the whimsy tools do we construct the session transcript and also redirect to another page?

Any more ideas how to make the behavior what we want?

Craig

> On Jun 27, 2020, at 7:48 PM, Sam Ruby <ru...@intertwingly.net> wrote:
> 
> On Sat, Jun 27, 2020 at 7:31 PM Craig Russell <apache.clr@gmail.com <ma...@gmail.com>> wrote:
>> 
>> After sending the POST message, coi.cgi still thinks that reloading the page should re-send the POST and displays the message "Are you sure you want to send a form again?" How do we reset this so that reloading the page is a GET?
> 
> First some links:
> 
> https://en.wikipedia.org/wiki/Post/Redirect/Get <https://en.wikipedia.org/wiki/Post/Redirect/Get>
> https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303 <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303>
> https://github.com/apache/whimsy/blob/18f24fb1b5dacf2b523f5ba233fdb5a847a35a0e/www/members/security-subs.cgi#L24 <https://github.com/apache/whimsy/blob/18f24fb1b5dacf2b523f5ba233fdb5a847a35a0e/www/members/security-subs.cgi#L24>
> 
> What's happening now is that
> 
> 1) Somebody clicks on a link or pastes a URL into the browser window.
> 2) Your CGI script is run, and produces some HTML
> 3) The browser renders the HTML
> 4) The pushes a button and a POST request is sent to the server
> 5) Your CGI script is run again, does some stuff, and produces some HTML
> 6) The browser renders the HTML
> 
> If, at this point, the user presses refresh, it will resubmit the post.
> 
> To correct this, we need to replace step 5 with:
> 
> 5a) The CGI script is run again, does some stuff, and sends a HTTP 303
> "See Other" response along with a location
> 5b) The browser issues a HTTP GET
> 5c) Your CGI script is run again, and produces some HTML
> 
> If, at this point, the user presses refresh, it will resubmit the get.
> 
> An example of sending a status back can be found in the 3rd link above.
> 
>> There is a similar problem with the POST from the Member Status change. Once the POST has been accepted, the memstat menu disappears but the cursor still shows a STOP (/) symbol. If the cursor is moved the symbol disappears but I'd like the code to remove the symbol. Probably something in memstat.json.rb but I modeled a similar bit of code in other ...json.rb files.
>> 
>> Any ideas?
>> 
>> Thanks,
>> Craig
>> 
>> Craig L Russell
>> clr@apache.org
> 
> - Sam Ruby

Craig L Russell
clr@apache.org


Re: Problems after POST

Posted by Sam Ruby <ru...@intertwingly.net>.
On Sat, Jun 27, 2020 at 7:31 PM Craig Russell <ap...@gmail.com> wrote:
>
> After sending the POST message, coi.cgi still thinks that reloading the page should re-send the POST and displays the message "Are you sure you want to send a form again?" How do we reset this so that reloading the page is a GET?

First some links:

https://en.wikipedia.org/wiki/Post/Redirect/Get
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303
https://github.com/apache/whimsy/blob/18f24fb1b5dacf2b523f5ba233fdb5a847a35a0e/www/members/security-subs.cgi#L24

What's happening now is that

1) Somebody clicks on a link or pastes a URL into the browser window.
2) Your CGI script is run, and produces some HTML
3) The browser renders the HTML
4) The pushes a button and a POST request is sent to the server
5) Your CGI script is run again, does some stuff, and produces some HTML
6) The browser renders the HTML

If, at this point, the user presses refresh, it will resubmit the post.

To correct this, we need to replace step 5 with:

5a) The CGI script is run again, does some stuff, and sends a HTTP 303
"See Other" response along with a location
5b) The browser issues a HTTP GET
5c) Your CGI script is run again, and produces some HTML

If, at this point, the user presses refresh, it will resubmit the get.

An example of sending a status back can be found in the 3rd link above.

> There is a similar problem with the POST from the Member Status change. Once the POST has been accepted, the memstat menu disappears but the cursor still shows a STOP (/) symbol. If the cursor is moved the symbol disappears but I'd like the code to remove the symbol. Probably something in memstat.json.rb but I modeled a similar bit of code in other ...json.rb files.
>
> Any ideas?
>
> Thanks,
> Craig
>
> Craig L Russell
> clr@apache.org

- Sam Ruby