Hi, On Sun, Mar 02, 2008 at 01:25:28AM +0000, place wrote:
Jorge wrote:
On Fri, Feb 29, 2008 at 10:37:04PM +0000, place wrote:
Have you tried something like?:
</pseudocode>
Html_submit_form2() ... if (ENC_MULTIPART) { append every single "name" "value" pair into a Dstr do { make boundary } while (strstr(Dstr, boundary) || maxtries); } ... encode as usual.
</pseudocode>
I gave it a try and ended up with the attached compiles-but-hardly-tested code. I had somehow forgotten earlier that I was going to have to use Dlists of values due to SELECT elements.
This runs through the inputs once for boundary creation, and a second time for url->data creation.
I was tempted to try - go through once, making a Dlist of name/value pairs - if (MULTIPART) determine a boundary, strstr()ing names and values - give each pair in the Dlist to Html_append_input but that's no good because I wouldn't know whether I had data from a file input when making url->data (Content-Disposition is different).
Thoughts?
Yes. As form-submitting is not a frequent operartion, much less with multipart, there's no compelling need to optimize it further. This version of the patch is easier to read and understand. Please comment the Html_get_input_values() function. For:
+ // BUG: strstr stops at NULL. Cannot use for file inputs. + success = !strstr(DataStr->str, boundary->str);
please use memcmp(). Some basic testing would be welcomed, but the main probe will be done by usage when committed. -- Cheers Jorge.-