agent: Don't reset environment when not starting a session.

This makes debugging easier since otherwise cockpit-agent would always
start a new session bus.

Closes #682

Signed-off-by: Stef Walter <stefw@redhat.com>
 - Removed unnecessary static initialization
ws: Add precondition to cockpit_web_service_get_creds()

Fixes #669
Closes #688

Reviewed-by: Stef Walter <stefw@redhat.com>
ws: Removed unused object variable and code related to it

Fixes #670
Closes #690

Reviewed-by: Stef Walter <stefw@redhat.com>
web: Close other dialogs before opening "Disconnected".

We can't have two dialogs open at the same time, and "Disconnected" is
opened asynchronously.

For convenience and robustness, we also close other dialogs before
opening the #error-popup although the code is usually careful to close
any open dialog before showing errors.

Closes #684
Fixes #667

Reviewed-by: Stef Walter <stefw@redhat.com>
daemon: Use G_SPAWN_STDOUT_TO_DEV_NULL as required.

The g_spawn_sync documentation says:

    Note that you must set the G_SPAWN_STDOUT_TO_DEV_NULL and
    G_SPAWN_STDERR_TO_DEV_NULL flags when passing NULL for
    standard_output and standard_error.

And indeed, without this, "shutdown" gets a EPIPE when writing to
stdout, which is a harmless but distracting error.

Closes #683

Reviewed-by: Stef Walter <stefw@redhat.com>
doc: Fix typo in embedding documetnation

Closes #679

Reviewed-by: Stef Walter <stefw@redhat.com>
Have git ignore some SELinux built files
ws: Better debug logging when removing a channel from session
agent: Split out MockTransport into its own file

And move some tests to start using it.
common: Add cockpit_assert_bytes_eq() and cockpit_assert_data_eq()

These functions are used in tests to check if memory matches expected
and gives informative output if it doesn't match. This output could
be further enhanced to show a diff or some such, but for now it's just
a simple escaped listing.
agent: Add cockpit_channel_close_obj_option() function

This allows adding full JSON objects to channel close messages.
agent: Implement agent support for modules and resource1 payload

This adds support to cockpit-agent for listing and loading module
resources.

See doc/modules.md for information about how modules are laid
out on the system.

doc/protocol.md contains information about the resource1 payload
ws: Add cockpit_web_response_abort() to stop streaming response

When we are streaming a web response, and half-way an error occurs
and we cannot get the remaining data to stream, we need to terminate
the web response.

cockpit_web_response_abort() does this by just disconnecting the
web response. The caller should be able to tell whether the data
is incomplete based on length header or chunking.
ws: cockpit_web_response_get_state() and expose web response state

Allow others to see what state a web response is currently in.
This helps prevent callers from having to carry around the identical
state.
ws: Strip query string when handing HTTP requests

We never use a query string, and some callers like jQuery add one
automatically in certain cases.
ws: Change how CockpitWebServer handle-resource signal detail works

To match subtrees, connect using detail handle-resource::/component/, to
match actual to level paths use detail handle-resource::/component
ws: Expose resources from remote hosts via HTTP

The resources are under the /cache and /res paths. See doc/urls.md
for more information.

We stream these from cockpit-agent using channels with payload
type resource1.

We also track when the web service requests checksum and module
listing information, and keep track of which host has which checksums
so we can send requests appropriately later.