List Info

Thread: Bug: CGI, POST-data




Bug: CGI, POST-data
user name
2008-04-24 05:45:11
Hello,

I'm using Lynx version 2.8.6rel.4 on a GNU/Linux system and
an apache 1.3 
server.

Currently I'm writing a CGI program, which I tried to test
with Lynx.
Lynx showed a very surprising behaviour, which I think is a
bug.

My CGI program uses the POST method to transfer data. When
there is no 
data, ie. it is called from a normal link, the startpage
should appear.

This works as expected, when I use a link from outside of
the CGI 
program.

Then I wanted to put links to the startpage into the
generated pages, like 
this: printf ("<p><a
href='%s'>Start</a></p>", getenv
("SCRIPT_NAME"));

This works fine with other browsers, but not with Lynx.
The generated page was called with POST-data. The link was
supposed to 
be called with no data at all.
But Lynx sends the same POST-data again!?

Workaround: give it some GET-data:
printf ("<p><a
href='%s?a=start'>Start</a></p>", getenv
("SCRIPT_NAME"));


P.S.: I'm not subscribed to this list.

-- 
AKFoerster

_______________________________________________
Lynx-dev mailing list
Lynx-devnongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev

Re: Bug: CGI, POST-data
user name
2008-04-24 20:06:57
On Thu, Apr 24, 2008 at 12:45:11PM +0200, Andreas K.
Foerster wrote:
> Hello,
> 
> I'm using Lynx version 2.8.6rel.4 on a GNU/Linux system
and an apache 1.3 
> server.
> 
> Currently I'm writing a CGI program, which I tried to
test with Lynx.
> Lynx showed a very surprising behaviour, which I think
is a bug.

that could be - I didn't write that part, and it's been
untouched for a
long while.
 
> My CGI program uses the POST method to transfer data.
When there is no 
> data, ie. it is called from a normal link, the
startpage should appear.
> 
> This works as expected, when I use a link from outside
of the CGI 
> program.
> 
> Then I wanted to put links to the startpage into the
generated pages, like 
> this: printf ("<p><a
href='%s'>Start</a></p>", getenv
("SCRIPT_NAME"));
> 
> This works fine with other browsers, but not with
Lynx.

I'm puzzled at this point, not sure I've got the question
right.

As I read the printf, that's in your cgi script, sending
back
text to lynx.  But when I run a testcase for POST, I'm
seeing
the parameters in the content section rather than the url,
e.g.
(from a "lynx -trace"):

POST /cgi-bin/testcase HTTP/1.0r
Host: localhostr
Accept: text/html, text/plain, text/css, text/sgml,
*/*;q=0.01r
Accept-Encoding: gzip, deflate, compress, bzip2r
Accept-Language: enr
Pragma: no-cacher
Cache-Control: no-cacher
User-Agent: Lynx/2.8.7dev.4 libwww-FM/2.14 SSL-MM/1.4.1
OpenSSL/0.9.8cr
Content-type: application/x-www-form-urlencodedr
Content-length: 23r
r
First=firstp&Last=lastp
----------------------------------

Then, if I add a link in the generated page, activating that
link
uses a GET - for my testcase.  Perhaps your generated page
is a form
(also using POST).  If I can see what the whole picture
looks like,
then I can respond better.

thanks

> The generated page was called with POST-data. The link
was supposed to 
> be called with no data at all.
> But Lynx sends the same POST-data again!?
> 
> Workaround: give it some GET-data:
> printf ("<p><a
href='%s?a=start'>Start</a></p>", getenv
("SCRIPT_NAME"));
> 
> 
> P.S.: I'm not subscribed to this list.
> 
> -- 
> AKFoerster



> _______________________________________________
> Lynx-dev mailing list
> Lynx-devnongnu.org
> htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev


-- 
Thomas E. Dickey <dickeyinvisible-island.net>
http://invisible-island.n
et
ftp://invisible-island.net


_______________________________________________
Lynx-dev mailing list
Lynx-devnongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev

Re: Bug: CGI, POST-data
country flaguser name
United States
2008-04-25 06:09:50
On Fri, 25 Apr 2008, Andreas K. Foerster wrote:

> Am Thursday, dem 24. Apr 2008 schrieb Thomas Dickey:
>
>> Then, if I add a link in the generated page,
activating that link
>> uses a GET - for my testcase.  Perhaps your
generated page is a form
>> (also using POST).  If I can see what the whole
picture looks like,
>> then I can respond better.
>
> I send you a test-script with this mail.

thanks (will investigate this evening)

> The link named "New" is a normal link should
use GET, and it does that
> in other browsers, but not in my lynx.
>
> Note: in this test the problem is just that the link
seems to do
> nothing. But with my real program I get lots of
doublettes in my
> database
>
> -- 
> AKFoerster
>

-- 
Thomas E. Dickey
http://invisible-island.n
et
ftp://invisible-island.net


_______________________________________________
Lynx-dev mailing list
Lynx-devnongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev

Re: Bug: CGI, POST-data
user name
2008-04-25 06:05:02
Am Thursday, dem 24. Apr 2008 schrieb Thomas Dickey:

> Then, if I add a link in the generated page, activating
that link
> uses a GET - for my testcase.  Perhaps your generated
page is a form
> (also using POST).  If I can see what the whole picture
looks like,
> then I can respond better.

I send you a test-script with this mail.
The link named "New" is a normal link should use
GET, and it does that 
in other browsers, but not in my lynx.

Note: in this test the problem is just that the link seems
to do 
nothing. But with my real program I get lots of doublettes
in my 
database

-- 
AKFoerster

_______________________________________________
Lynx-dev mailing list
Lynx-devnongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev

  
Re: Bug: CGI, POST-data
user name
2008-04-25 19:07:15
On Fri, Apr 25, 2008 at 01:05:02PM +0200, Andreas K.
Foerster wrote:
> Am Thursday, dem 24. Apr 2008 schrieb Thomas Dickey:
> 
> > Then, if I add a link in the generated page,
activating that link
> > uses a GET - for my testcase.  Perhaps your
generated page is a form
> > (also using POST).  If I can see what the whole
picture looks like,
> > then I can respond better.
> 
> I send you a test-script with this mail.
> The link named "New" is a normal link should
use GET, and it does that 
> in other browsers, but not in my lynx.

I can reproduce it.  Lynx's trace shows that it looks for
the URL in
its memory, finds it (the right one), then goes to load it. 
As I
read the code, it seems that the reason it then POSTs again
is that
it still has the post-data at hand for the URL, and just
uses its
existence to decide that it's ready to POST in the process
of loading.

The simplest solution (which might be correct - will have to
check)
would be to discard that data immediately after it is used
to POST the form.

-- 
Thomas E. Dickey <dickeyinvisible-island.net>
http://invisible-island.n
et
ftp://invisible-island.net


_______________________________________________
Lynx-dev mailing list
Lynx-devnongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev

Re: Bug: CGI, POST-data
user name
2008-04-25 19:48:11
THOMAS DICKEY DIXIT:

>THE SIMPLEST SOLUTION (WHICH MIGHT BE CORRECT - WILL
HAVE TO CHECK)
>WOULD BE TO DISCARD THAT DATA IMMEDIATELY AFTER IT IS
USED TO POST THE FORM.

I _MIGHT_ HAVE AN APPLICATION CASE FOR WHEN THAT IS NOT
GOOD:
THINK OF PHPBB WEB FORA, WHERE YOU CAN SUBMIT SOME CONTENT,
AND THEN
GET A MESSAGE THAT YOU MUST WAIT X SECONDS BEFORE SUBMITTING
AGAIN
(AS A RATE LIMITER), WHERE YOU CAN JUST PRESS ^R TO DO
THAT.

HOW ABOUT LOOKING AT THE ORIGIN OF THE LINK? IF IT€™S FROM
AN <A> TAG,
USE GET UNCONDITIONALLY. THAT SEEMS TO BE THE MOST NATURAL
SOLUTION
TO ME. IF THAT€™S POSSIBLE FROM THE CODE, THAT IS.

BYE,
//MIRABILOS
-- 
I BELIEVE NO ONE CAN INVENT AN ALGORITHM. ONE JUST HAPPENS
TO HIT UPON IT
WHEN GOD ENLIGHTENS HIM. OR ONLY GOD INVENTS ALGORITHMS, WE
MERELY COPY THEM.
IF YOU DON'T BELIEVE IN GOD, JUST CONSIDER GOD AS NATURE IF
YOU WON'T DENY
EXISTENCE.		-- COYWOLF QI HUNT


_______________________________________________
LYNX-DEV MAILING LIST
LYNX-DEVNONGNU.ORG
HTTP://LISTS.NONGNU.ORG/MAILMAN/LISTINFO/LYNX-DEV

Re: Bug: CGI, POST-data
user name
2008-04-26 04:33:35
Am Friday, dem 25. Apr 2008 schrieb Thomas Dickey:

> On Fri, Apr 25, 2008 at 01:05:02PM +0200, Andreas K.
Foerster wrote:
> > Am Thursday, dem 24. Apr 2008 schrieb Thomas
Dickey:
> > 
> > > Then, if I add a link in the generated page,
activating that link
> > > uses a GET - for my testcase.  Perhaps your
generated page is a form
> > > (also using POST).  If I can see what the
whole picture looks like,
> > > then I can respond better.
> > 
> > I send you a test-script with this mail.
> > The link named "New" is a normal link
should use GET, and it does that 
> > in other browsers, but not in my lynx.
> 
> I can reproduce it.  Lynx's trace shows that it looks
for the URL in
> its memory, finds it (the right one), then goes to load
it.  As I
> read the code, it seems that the reason it then POSTs
again is that
> it still has the post-data at hand for the URL, and
just uses its
> existence to decide that it's ready to POST in the
process of loading.
> 
> The simplest solution (which might be correct - will
have to check)
> would be to discard that data immediately after it is
used to POST the form.

No, the POST data should be sent again, when someone uses
the rleload 
function. But it should be GET for normal links.

-- 
AKFoerster


_______________________________________________
Lynx-dev mailing list
Lynx-devnongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev

Re: Bug: CGI, POST-data
country flaguser name
United States
2008-04-26 07:56:33
On Sat, 26 Apr 2008, Andreas K. Foerster wrote:

> Am Friday, dem 25. Apr 2008 schrieb Thomas Dickey:
>
>> On Fri, Apr 25, 2008 at 01:05:02PM +0200, Andreas
K. Foerster wrote:
>>> Am Thursday, dem 24. Apr 2008 schrieb Thomas
Dickey:
>>>
>>>> Then, if I add a link in the generated
page, activating that link
>>>> uses a GET - for my testcase.  Perhaps your
generated page is a form
>>>> (also using POST).  If I can see what the
whole picture looks like,
>>>> then I can respond better.
>>>
>>> I send you a test-script with this mail.
>>> The link named "New" is a normal link
should use GET, and it does that
>>> in other browsers, but not in my lynx.
>>
>> I can reproduce it.  Lynx's trace shows that it
looks for the URL in
>> its memory, finds it (the right one), then goes to
load it.  As I
>> read the code, it seems that the reason it then
POSTs again is that
>> it still has the post-data at hand for the URL, and
just uses its
>> existence to decide that it's ready to POST in the
process of loading.
>>
>> The simplest solution (which might be correct -
will have to check)
>> would be to discard that data immediately after it
is used to POST the form.
>
> No, the POST data should be sent again, when someone
uses the rleload
> function. But it should be GET for normal links.

agree (it has to keep the data for reload and activate, but
has to ignore
the data for a link on the page generated by the cgi-bin
script).

-- 
Thomas E. Dickey
http://invisible-island.n
et
ftp://invisible-island.net


_______________________________________________
Lynx-dev mailing list
Lynx-devnongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev

[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )