Skip to content

Commit 97ccc44

Browse files
committed
tool_parsecfg: make warning output propose double-quoting
When the config file parser detects a word that *probably* should be quoted, mention double-quotes as a possible remedy. Test 459 verifies. Proposed-by: Jiehong on github Fixes #12409 Closes #12412
1 parent 1b04dfa commit 97ccc44

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

src/tool_parsecfg.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
210210
break;
211211
default:
212212
warnf(operation->global, "%s:%d: warning: '%s' uses unquoted "
213-
"whitespace in the line that may cause side-effects",
213+
"whitespace that may cause side-effects. Consider quoting "
214+
"the value with double quotes?",
214215
filename, lineno, option);
215216
}
216217
}

tests/data/Makefile.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ test417 test418 test419 test420 test421 test422 test423 test424 test425 \
7272
test426 test427 test428 test429 test430 test431 test432 test433 test434 \
7373
test435 test436 test437 test438 test439 test440 test441 test442 test443 \
7474
test444 test445 test446 test447 test448 test449 test450 test451 test452 \
75-
test453 test454 test455 test456 test457 test458 \
75+
test453 test454 test455 test456 test457 test458 test459 \
7676
\
7777
test490 test491 test492 test493 test494 test495 test496 test497 test498 \
7878
\

tests/data/test459

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<testcase>
2+
<info>
3+
<keywords>
4+
HTTP
5+
--config
6+
</keywords>
7+
</info>
8+
9+
#
10+
# Server-side
11+
<reply>
12+
<data crlf="yes">
13+
HTTP/1.1 200 OK
14+
Date: Tue, 09 Nov 2010 14:49:00 GMT
15+
Server: test-server/fake
16+
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
17+
ETag: "21025-dc7-39462498"
18+
Accept-Ranges: bytes
19+
Content-Length: 6
20+
Connection: close
21+
Content-Type: text/html
22+
Funny-head: yesyes
23+
24+
-foo-
25+
</data>
26+
</reply>
27+
28+
#
29+
# Client-side
30+
<client>
31+
<server>
32+
http
33+
</server>
34+
<name>
35+
config file with argument using whitespace missing quotes
36+
</name>
37+
<file name="%LOGDIR/config">
38+
data = arg with space
39+
</file>
40+
<command>
41+
http://%HOSTIP:%HTTPPORT/%TESTNUMBER --config %LOGDIR/config --silent
42+
</command>
43+
</client>
44+
45+
#
46+
# Verify data after the test has been "shot"
47+
<verify>
48+
<protocol crlf="yes" nonewline="yes">
49+
POST /%TESTNUMBER HTTP/1.1
50+
Host: %HOSTIP:%HTTPPORT
51+
User-Agent: curl/%VERSION
52+
Accept: */*
53+
Content-Length: 3
54+
Content-Type: application/x-www-form-urlencoded
55+
56+
arg
57+
</protocol>
58+
<stderr mode="text">
59+
Warning: log/config:1: warning: 'data' uses unquoted whitespace that may cause
60+
Warning: side-effects. Consider quoting the value with double quotes?
61+
</stderr>
62+
</verify>
63+
</testcase>

0 commit comments

Comments
 (0)