Fix unused and uninitialized variables

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
daemon: Fix possible leak and unclear/undefined free behavior

Some versions of gcc complain about this code, as it's using the
cleanup attribute in a loop. Make the code clearer and defined.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Return hard coded Content-Type based on extension

Looking up Content-Type via GFileInfo isn't working. In addition
if it was to work it would invoke a whole lot of machinery.

We only serve a limited set of files. Hard code content type based
on extension. This is efficient and predictable.

Fixes #225
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Make note of skipped tests due to missing system bus

This allows the TAP output to reflect the skipped test.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Return correct Content-Type from cockpitdyn.js handler

And check that this is the case

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
Web: More robust container detail pages.

Reviewed-by: Stef Walter <stefw@redhat.com>
Web: Also show container image entrypoint.

Reviewed-by: Stef Walter <stefw@redhat.com>
doc: Document the new rest-json1 payload
cockpit: Add cockpit_pipe_get_buffer() function

This allows us to access the input buffer of a pipe even when we're
not in the 'read' event. It can change during the main loop.
cockpit: Implement a generic cockpit_pipe_connect() constructor

We'll have multiple things connecting to pipes, so implement the
connection logic in CockpitPipe.

Also make it async and connect in the main loop where possible.
cockpit: Add a cockpit_pipe_skip() function

For skipping bytes in a data buffer without returning them or doing
anything with them. Useful for channels that operate directly on
the bytes in the buffer.
websocket: Expose the web_socket_util_parse_status_line() function

We'd like to use this to parse status lines in other Cockpit code
so expose this, document it and give it a non-private name.
cockpit: Add cockpit_json_get_string() and cockpit_json_get_int()

These functions are safe wrappers for getting strings and int fields
of JSON objects. Rather than repeating this code everywhere, consolidate
it into one place.

JSON GLib is a bit tricky here because we have to check the types, and
a bit of conversion is possible (such as double -> int).
cockpit: Add cockpit_json_int_hash() and cockpit_json_int_equal()

These are for putting the gint64 type that JSON GLib uses for integers
into GHashTable.

Note these are similar to g_int_hash() and g_int_equal() in that they
take a pointer to a gint64. They are not like g_direct_hash() and
g_direct_equal() which take a pointer (and possibly an int cast to
a pointer).
cockpit: Add cockpit_json_skip() function for splitting JSON

Some services like Docker return multiple JSON blocks in their
REST JSON output. We have to split these apart before passing them
to the JSON parser.

The cockpit_json_skip() function allows this, including finding
whitespace and so on.

It does not validate the JSON blocks. It assumes that the blocks
are valid and/or will be parsed to find errors.

This is part of: Fix #265
cockpit: Verify that JsonParser trims whitespace

Our REST JSON code depends on the fact that JsonParser trims
whitespace before and after parsing. Verify this in our tests so we can
catch it if it changes.
cockpit: Add cockpit_json_equal() which checks for equality

This function checks for logical equality between two JSON nodes.
If the nodes are of different types, then the equality fails, even
if they can be converted to the same type.

Part of fix #267
agent: Implement CockpitRestJson and the 'rest-json1' payload type

This is an implementation of the REST JSON payload type. It's fairly
complete, supporting streaming, monitoring, and other necessary
things.

Monitoring currently is only driven by an interval, where it could
also be driven off of output from another request.

Part of fix for #268, #267 and #265
web: Allow Channel.close() to accept a problem

Even though it's on the web side, we should allow Channel.close()
to accept a problem code which listeners can then react to. This allows
a consistent flow of problem codes no matter where they come from.
The problem code doesn't need to be sent to the web service or agent.
web: Use new rest-json1 protocol to implement web rest client