mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-30 08:03:49 +00:00
Fix malformed HTTP output of JSON fields
This commit is contained in:
parent
714ea63190
commit
0e783c6b73
@ -1960,16 +1960,17 @@ static strbuf strbuf_status_body(strbuf sb, struct http_response *hr, const char
|
||||
else {
|
||||
hr->header.content_type = CONTENT_TYPE_HTML;
|
||||
strbuf_sprintf(sb, "<html>\n<h1>%03u %s</h1>", hr->result_code, message);
|
||||
strbuf_puts(sb, "\n<dl>");
|
||||
unsigned i;
|
||||
for (i = 0; i < NELS(hr->result_extra); ++i)
|
||||
if (hr->result_extra[i].label) {
|
||||
strbuf_puts(sb, "\n<dl><dt>");
|
||||
strbuf_puts(sb, "\n<dt>");
|
||||
strbuf_html_escape(sb, hr->result_extra[i].label, strlen(hr->result_extra[i].label));
|
||||
strbuf_puts(sb, "</dt><dd>");
|
||||
strbuf_json_atom_as_html(sb, &hr->result_extra[i].value);
|
||||
strbuf_puts(sb, "</dd></dl>");
|
||||
strbuf_puts(sb, "</dd>");
|
||||
}
|
||||
strbuf_puts(sb, "\n</html>");
|
||||
strbuf_puts(sb, "\n</dl>\n</html>");
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user