> Le 29 juil. 2018 à 12:26, Pascal <[email protected]> a écrit :
> 
>> Le 28 juil. 2018 à 22:18, Pascal <[email protected]> a écrit :
>> 
>> Hello David,
>> 
>> If you have some spare time, I have a mystery for you to solve with 
>> forms.adb in test folder.
>> 
>> The creation of Form2 includes a field of type file F_Input and a field of 
>> type hidden H_Input with value "test" and name "Some_Text":
>>        Form2.Create (Parent => App.Console,
>>                      Action => "/demo",
>>                      Method => Form.Post);
>>        Form2.Encoding (Form.Multi_Part);
>>        Form2.Put ("File to upload: ");
>>        F_Input.Create_Element (Form       => Form2,
>>                                Input_Type => "file",
>>                                Name       => "fspec");
>>        H_Input.Create (Form  => Form2,
>>                        Value => "test",
>>                        Name  => "Some_Text");
>> 
>>        S.Create (Form2, "Submit File");
>> 
>> When clicking on the button "Submit File" I got:
>> Some_Text => No value sent
>> File Name on Server => hello2.png
>> File Name => hello2.png.tmp
>> 
>> Why the hidden field "Some_Text" has not the value "test"?
>> 
>> Thanks, Pascal.
>> http://blady.pagesperso-orange.fr
> 
> Hello again David,
> 
> With the debugger I observed that Do_Body is called twice:
> 
> First time:
> 
> (gdb) p disposition
> #0  gnoga.server.connection.do_body (client=...) at 
> /Users/blady/Documents/Programmation/GNOGA/gnoga-code/src/gnoga-server-connection.adb:654
> $34 = "form-data; name=""fspec""; filename=""cli.png"""
> 
> Second time:
> 
> #0  gnoga.server.connection.do_body (client=...) at 
> /Users/blady/Documents/Programmation/GNOGA/gnoga-code/src/gnoga-server-connection.adb:654
> (gdb) p disposition
> $25 = "form-data; name=""Some_Text"""
> 
> On the second time how to retrieve the value?

Hello David,

I was able to figure out the above issue with the help of Dmitry.
I've added a string stream handler for the second call of do_body.
Now Some_Text is handled by On_Post callback.
These changes have been pushed in Gnoga branch 1.5-alpha.

One question though:
In order to store the incoming value of the form field, I've declared a static 
size for the string stream, see:
https://sourceforge.net/p/gnoga/code/ci/dev_1.5/tree/src/gnoga-server-connection.adb#l142

Is there a better manner to handle it? Dynamically?

Regards, Pascal.
http://blady.pagesperso-orange.fr




_______________________________________________
Gnoga-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gnoga-list

Reply via email to