Made sure that HTML form values get initialized properly.
This commit is contained in:
parent
d5d646528e
commit
d71ce70c54
1 changed files with 15 additions and 2 deletions
|
@ -241,12 +241,25 @@ iswhitespace(char c)
|
||||||
c == ISO_ht);
|
c == ISO_ht);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
#if WWW_CONF_FORMS
|
||||||
|
static void
|
||||||
|
init_input(void)
|
||||||
|
{
|
||||||
|
s.inputtype = HTMLPARSER_INPUTTYPE_NONE;
|
||||||
|
s.inputname[0] = s.inputvalue[0] = 0;
|
||||||
|
s.inputvaluesize = 20; /* De facto default size */
|
||||||
|
}
|
||||||
|
#endif /* WWW_CONF_FORMS */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
htmlparser_init(void)
|
htmlparser_init(void)
|
||||||
{
|
{
|
||||||
s.majorstate = s.lastmajorstate = MAJORSTATE_DISCARD;
|
s.majorstate = s.lastmajorstate = MAJORSTATE_DISCARD;
|
||||||
s.minorstate = MINORSTATE_TEXT;
|
s.minorstate = MINORSTATE_TEXT;
|
||||||
s.lastchar = 0;
|
s.lastchar = 0;
|
||||||
|
#if WWW_CONF_FORMS
|
||||||
|
s.formaction[0] = s.formname[0] = 0;
|
||||||
|
#endif /* WWW_CONF_FORMS */
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
static char CC_FASTCALL
|
static char CC_FASTCALL
|
||||||
|
@ -460,7 +473,7 @@ parse_tag(void)
|
||||||
PRINTF(("Form name '%s'\n", s.tagattrparam));
|
PRINTF(("Form name '%s'\n", s.tagattrparam));
|
||||||
strncpy(s.formname, s.tagattrparam, WWW_CONF_MAX_FORMNAMELEN - 1);
|
strncpy(s.formname, s.tagattrparam, WWW_CONF_MAX_FORMNAMELEN - 1);
|
||||||
}
|
}
|
||||||
s.inputname[0] = s.inputvalue[0] = 0;
|
init_input();
|
||||||
break;
|
break;
|
||||||
case TAG_SLASHFORM:
|
case TAG_SLASHFORM:
|
||||||
switch_majorstate(MAJORSTATE_BODY);
|
switch_majorstate(MAJORSTATE_BODY);
|
||||||
|
@ -486,7 +499,7 @@ parse_tag(void)
|
||||||
s.formname, s.formaction);
|
s.formname, s.formaction);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s.inputtype = HTMLPARSER_INPUTTYPE_NONE;
|
init_input();
|
||||||
} else {
|
} else {
|
||||||
PRINTF(("Input '%s' '%s'\n", s.tagattr, s.tagattrparam));
|
PRINTF(("Input '%s' '%s'\n", s.tagattr, s.tagattrparam));
|
||||||
if(strncmp(s.tagattr, html_type, sizeof(html_type)) == 0) {
|
if(strncmp(s.tagattr, html_type, sizeof(html_type)) == 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue