Problem with FormPost (General questions)

by Paul Draper @, (7165 days ago)

Hi,

I am trying to construct the following GET request using the FormPost example in the help files.


get http://devserver/tmtrack/tmtrack.dll?StdPage&Template=sframe

Note that StdPage posted attribute does not have a value.

I use the following code C++ code:

// set up url
http->URL = http://devserver/tmtrack/tmtrack.dll ;

// define search query
http->Request->FormPost->Add( StdPage , );
http->Request->FormPost->Add( Template , sframe );

http->URL = http->URL + ? + http->Request->FormPost->ToString();

This gives the following incorrect URL:


http://devserver/tmtrack/tmtrack.dll?StdPage
[color=#red]
=
[/color]
&Template=sframe


There seems to be a bug when you add a formpost with a name, but no value. The subsequent ToString() call puts an equals sign in when it shouldn't.

I have a workaround, but it requires me to process each formpost attribute myself and construct the correct URL.

Is this a bug?

Regards Paul.

locked

Re: Problem with FormPost

by Jasmine, (7165 days ago) @ Paul Draper

Paul,

perhaps I didn't understand. What you say is incorrect looks ok to me. If <code>http://devserver/tmtrack/tmtrack.dll?StdPage=&Template=sframe</code> is invalid for StdPage = and Template = sframe , how do you think correct should look like?

BTW, what does FormPost has to do with changes in URL? FormPost posts data in the body, not in URL.

Kreso

locked

Re: Problem with FormPost

by Paul Draper @, (7165 days ago) @ Jasmine

Hi Kreso,

Componant generates:

<code>http://devserver/tmtrack/tmtrack.dll?StdPage=&Template=sframe</code>

The web page I'm going to expects the URL

<code>http://devserver/tmtrack/tmtrack.dll?StdPage&Template=sframe</code>

It's a very subtle difference, the unneccessary = in the =& causes the problem.

The receiving page thinks that the variable StdPage has the value &Template=sframe and thus goes wrong!

Regards
Paul.

locked

Re: Problem with FormPost

by Paul Draper @, (7165 days ago) @ Paul Draper

Hi Kreso,

In answer to your second question:


BTW, what does FormPost has to do with changes in URL? FormPost posts data in the body, not in URL.

I am making use of the trick described in the FormPost help page for adding FormPost variables from the body onto the URL when you are performing a GET.

I imagine the bug is in the way that

[code]wodHttp1.Request.FormPost.ToString()[/code]

is constructing the string of all the formpost variables.

regards
Paul.

locked

Re: Problem with FormPost

by Jasmine, (7165 days ago) @ Paul Draper

Paul,

actually, I think this is server-side issue. If I use Internet Explorer with code like this in local.htm file: [code]<html>
<form action= http://www.somepage.com method=GET>
<input name= StdName value= >
<input name= Template value= something >
<input type=Submit>
</form></html>[/code], open it, and click on 'submit' button, IE redirects me to this URL: [code]http://www.somepage.com/?StdName=&Template=something[/code]
As you can see - IE did add = just like wodHttpDLX. So, I don't think we have a bug.

locked

Re: Problem with FormPost

by Paul Draper @, (7164 days ago) @ Jasmine

Hi Kreso,

It appears that somepage.com is happy with either
[code]http://somepage.com/?StdName=&Template=something
or
http://somepage.com/?StdName&Template=something[/code]

unfortunatly the webserver I'm going to objects to the URL that has the =& in it.

seems that they are misusing the syntax.

Thanks for you help
Paul.

locked