tool_formparse: accept digits in --form type= strings

Adjusted test 186 to verify.

Regression in 9664d5a547, shipped in 8.11.1

Reported-by: IcedCoffeee on github
Assisted-by: Jay Satiro
Fixes #15761
Closes #15762
This commit is contained in:
Daniel Stenberg 2024-12-17 07:52:06 +01:00
parent fd067bfb5b
commit f7e065f314
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 6 additions and 5 deletions

View File

@ -495,14 +495,15 @@ static int get_param_part(struct OperationConfig *config, char endchar,
;
if(!endct && checkprefix("type=", p)) {
size_t tlen;
for(p += 5; ISSPACE(*p); p++)
;
/* set type pointer */
type = p;
/* find end of content-type */
while(*p && (ISALPHA(*p) || (*p == '/') || (*p == '-')))
p++;
tlen = strcspn(p, "()<>@,;:\\\"[]?=\r\n ");
p += tlen;
endct = p;
sep = *p;
}

View File

@ -31,7 +31,7 @@ http
HTTP RFC1867-type formposting with types on text fields
</name>
<command>
http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -F "name=daniel;type=moo/foo" -F "html= <body>hello</body>;type=text/html;charset=verymoo"
http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -F "name=daniel;type=moo/foo-.4" -F "html= <body>hello</body>;type=text/html;charset=verymoo"
</command>
# We create this file before the command is invoked!
</client>
@ -46,12 +46,12 @@ POST /we/want/%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
Content-Length: 338
Content-Length: 341
Content-Type: multipart/form-data; boundary=----------------------------212d9006ceb5
------------------------------212d9006ceb5
Content-Disposition: form-data; name="name"
Content-Type: moo/foo
Content-Type: moo/foo-.4
daniel
------------------------------212d9006ceb5