ws: Hang onto query string in CockpitWebResponse

So that we can use it in various handlers

Closes #1539
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Fix use of Uint8Array with out the new operator

Get this error message:

  Uncaught TypeError: Constructor Uint8Array requires 'new'

Closes #1542
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
shell: Fix layout of container images sidebar in lower resoultions

Reviewed-by: Stef Walter <stefw@redhat.com>
shell: Fix layout of container images panel in lower resolutions

Reviewed-by: Stef Walter <stefw@redhat.com>
shell: Leave some space for the cpu column

Reviewed-by: Stef Walter <stefw@redhat.com>
shell: Avoid clipping the container cell buttons

Closes #1537
Fixes #1525
Reviewed-by: Stef Walter <stefw@redhat.com>
base: Channel objects have a .binary field

This is a boolean, and allows callers to easily see what format the
messages are expected to be in.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Cleanup streaming functionality

This affects stuff like the cockpit.spawn() process promises, and also
things like the upcoming http-stream1 code.

Make proc.input(data, stream) more explicit, where you have to pass
true for the stream argument so that the input remains open.

Allow only one proc.stream(callback) handler, if another one is
registered it replaces the first.

The stream handlers can now return a number, which indicates how
many bytes or characters were consumed from the data.

Update documentation.

Closes #1545
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: When buffering keep entire block if not consumed

We already went through the work of combining the message when
doing a buffer callback. So keep the result around if the callback
didn't consume anything.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
docker: Use streaming functionality in docker console

This makes things more efficient although it doesn't completely cleanup
the ugliness in this code. The reality is that the Docker attach
stream is pretty nasty, and that's reflected here.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
common: Allow skipping bytes after in cockpit_pipe_consume()

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
bridge: Consistent parsing of address channel options

So we have consistent handling for both stream and the upcoming
http-stream1 channels.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
bridge: Allow connecting back to the test-server port in tests

This does implement a general mechanism for addressing internal
things that the bridge knows about, that don't have a stable
port or unix path address. Would like to make more use of this
in the future, but for now just implement the test-server port
as an internal address.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Remove incorrect comment about chunked encoding

We don't need to support receiving chunked encoding in
CockpitWebServer because we never receive any HTTP body here,
no POST requests etc...

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base, bridge: Implement new http-stream1 channel payload

Implement a new payload called 'http-stream1' which makes an
HTTP request. The channel encapsulates one HTTP request.
Various options accompany the "open" control message. The
first payload message is the response headers.

Add a new cockpit.http() API as well

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
docker: Add docker.json_skip() function

This lets us separate a JSON stream into blocks using javascript
similar to what the cockpit_json_skip() C function does.

This is currently Docker specific, since I don't know of any other
code that does silly things like sending invalid JSON data but
still treating it as application/json.

But that may change in the future, silly things abound. So then we
might move this code into cockpit.js.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
shell: Port the docker code to use cockpit.http()

And stop using rest-json1 payload.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
bridge, shell: Remove the old rest-json1 code

Closes #1519
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
docker: Batch updates to the docker console logs

This is necessary when transferring large amounts of log data

Closes #1550
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Don't kill stream buffer callback when nothing has been consumed

Reviewed-by: Stef Walter <stefw@redhat.com>