- Print double quotes properly when dumping config file (fixes #1806)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2725 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.27
Elan Ruusamäe 2010-05-28 15:16:39 +00:00
parent b3892c1410
commit 5518643d39
2 changed files with 19 additions and 1 deletions

1
NEWS
View File

@ -11,6 +11,7 @@ NEWS
* Fix detecting git repository (fixes #2173, thx ncopa)
* [mod_compress] Fix segfault when etags are disabled (fixes #2169)
* Reset uri.authority before TLS servername handling, reset all "keep-alive" data in connection_del (fixes #2125)
* Print double quotes properly when dumping config file (fixes #1806)
- 1.4.26 - 2010-02-07
* Fix request parser to handle packets with splitted \r\n\r\n (fixes #2105)

View File

@ -70,8 +70,25 @@ static int data_response_insert_dup(data_unset *dst, data_unset *src) {
static void data_string_print(const data_unset *d, int depth) {
data_string *ds = (data_string *)d;
UNUSED(depth);
unsigned int i = 0;
fprintf(stdout, "\"%s\"", ds->value->used ? ds->value->ptr : "");
// empty and uninitialized strings
if (ds->value->used < 1) {
fputs("\"\"", stdout);
return;
}
// print out the string as is, except prepend " with backslash
putc('"', stdout);
for (i = 0; i < ds->value->used - 1; i++) {
unsigned char c = ds->value->ptr[i];
if (c == '"') {
fputs("\\\"", stdout);
} else {
putc(c, stdout);
}
}
putc('"', stdout);
}