History log of /haiku/src/kits/network/libnetservices2/HttpSession.cpp
Revision Date Author Comments
# b70a0efa 13-Dec-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Notify any async listeners when a request completes early.

The API allows a user to end parsing responses earlier if the response has a
client (4xx) or server (5xx) error code. The end user should still be notified
of this result, so that they can act.

Change-Id: I11f2ab296658f767b5b34e10badb54de27aab494
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5910
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 71e29bbe 29-Oct-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: format code using `haiku-format`

This commit formats all the netservices2 code with the `haiku-format` tool from
https://github.com/owenca/haiku-format (commit aa7408e), with the following
customizations:
* SpaceBeforeRangeBasedForLoopColon is set to false
* Braces before a catch block are not wrapped
* Most headers, except for ExclusiveBorrow.h, have been manually reformatted
to adhere to Haiku's header format (issue #19 in the repository)

Change-Id: I693c4515cf26402e48f35d1213ab6d5fcf14bd1e


# 3c9045fb 23-Oct-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Refactor to make HttpParser stateful

This change refactors various parts of the HTTP parsing. The HttpParser now
tracks what part of the message needs to be received next, and throws an error
if the object is used in the wrong way (when the caller requests to parse the
wrong part of he message).

The metadata about the transmission is now also saved in te parser. There is
partial work in there to start exposing the 'bytes written', which in
compressed streams is expected to differ from the bytes read. This is not
used yet.

This also simplifies the state tracking done by BHttpSession::Request.

Change-Id: I8532c6a5c8776456ea8bbccd6df7a44bac92b60d


# 27196c40 04-Sep-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: use BBorrow<BDataIO> for custom body targets

Change-Id: Ib2d4b0ca3689338d906f943295278c086c6f2c83


# 8a16ecbc 14-Aug-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Add debugging constants and messages

These allow for additional messages about the progress/status of the request.
For now, the messages are sent unconditionally, though it may be reasonable to
in the future switch to sending them only when enabled.

Change-Id: Ic45a0055037af02c689494fa5ce0acd03592ad7e


# 7b1d966c 08-Aug-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Rework parsing of content-length and move to HttpParser

This fixes a bug in the HttpAuthTest, and in general, moves responsibility of determining
the shape and size of the content to the right place.

Still to do is to fix the case where there really is a variable length content. This will
now probably error out as a connection closed error.

Change-Id: I13c20028e834cc9af8c7bc1d7d7613bf60838e64


# 9cb56a48 07-Aug-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Add custom error message to BNetworkRequestError

Change-Id: I03970762531a689e25cd78a1091aecf755ee87ce


# c7f925c3 06-Aug-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: add the HttpSerializer helper to help serialize requests

Change-Id: Ide1e2d387884ce4cf2d406057960cd0732d61f38


# e6828456 01-Aug-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: move HttpBuffer and HttpParser into their own header/source

Change-Id: I5bc0d9df6f94c2cf1c39baa6206bf6f1db284705


# 9b33a931 27-Jul-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Implement controls on the number of concurrent requests.

This change allows the user to control how many concurrent request can be done
per session. This is going to be helpful to running the tests as well; they were
all fired up in parallel, which sometimes leads to our test server refusing a
connection.

Change-Id: I4f1f40b28b8e0199ea5589b36cd8d00ecd849a63


# 251828d3 24-Jul-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Rewrite the control thread loop to prepare for filtering of requests to do

Change-Id: I72d5f1ddd499f8fb227af5ee78111a60eb50b1f5


# 60355dae 24-Jul-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Implement asynchronous status update messages.

The integration PostTest has a basic test that the expected messages are sent and
have the expected data fields. The gist is documented in book.dox.

To do are the messages around SSL. However, that functionality is also not
implemented yet, so there is nothing to send.

Change-Id: Ib8f36ed32f9854d643d8256338b71af7067059f0


# 826afd96 17-Jul-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Refactor the parsing code into a HttpParser helper class

Change-Id: Ib03aacc36d46318c8870554f794ff66db4cce063


# a1e75836 03-Jul-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: add HttpBuffer to encapsulate buffered reading

Change-Id: I7ec3189c3cf459fccae4ffac44702fd6b8c12ac9


# 6cf08826 26-Jun-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: When the response Content-Length is 0, do not expect a body.

Change-Id: Ia715b44289dc3c64c2b834f954421413cbc3593c


# 92357c13 23-Jun-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Add support for an input body in a request and handle this with redirects.

Change-Id: Id2399d49aa673469c8c04ebd13884cdbcb24112d


# 6cbbd9bf 03-Jun-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Implement BHttpSession::Cancel()

Change-Id: Iff0a7726e57f3e6bd4e9d0ebac08a370d25a62d7


# 2f3b9b18 03-Jun-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Add/rework the MaxRedirections, Timeout and StopOnError options

Change-Id: I4e59b51c16c6777941dc92ce02505386257dad03


# 13bfff7b 23-Apr-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Implement BHttpStatusCode, BHttpStatusClass and Redirects

The user of the API can set whether redirects should be followed, and if so,
how many. This is part of the BHttpRequest API. The BHttpSession then follows
those instructions, and executes the maximum number of redirects the user
would like to follow.

As part of this commit, the BHttpStatusClass and BHttpStatusCodes helper enums
have been added, to give a friendlier access to HTTP status codes and status
classes.

Change-Id: Ic8c9e3fda158e2cce549c8f1d360951f7ac83311


# 59c359e5 18-Apr-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: implement support for HEAD requests and 204 responses.

These particular responses will not have a body. This is now handled by the
BHttpSession object. There is also a minor fix in here that prevents a crash
when multiple requests are handled by the DataThread at the same time, and not
all of the requests have events.

Change-Id: I7f47d8b3cd8491c8193275be4b3fc1080780fa20


# d482381d 14-Apr-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: partial implementation of the receive function

This initial implementation contains a lot of extra debuggin output that will
be removed in future changes. It is now possible to run a simple GET request
to the test server with gzip encoding.

Change-Id: I2c402e5cf80b94b366563888222a891a1b094b7a


# 70837c18 05-Apr-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: implement writing in the data thread.

Change-Id: Ideb63f9f96bf62ea7d9ce63df22805473273855d


# 3b172a3d 07-Mar-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: implement hostname resolution and connection for BHttpRequest

BHttpSession::Execute() moves the request into the session, and returns a future BHttpResponse
object. Currently implemented are resolving the hostname, and opening the connection.

There is some scaffolding for the actual data transfer.

Change-Id: I5a8a7a7f8680036b91cdba4beee140bbed6bfd5a


# 1baacbfe 05-Mar-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Initial implementation of BHttpResult

Incomplete class, but will provide the basis to start working on the internals of the BHttpSession.

Change-Id: I3ca14b7bd823fc1b4a5a32f5784592d214c4e9a7


# 1715bb67 14-Sep-2021 Niels Sascha Reedijk <niels.reedijk@gmail.com>

netservices: Flesh out BHttpSession::Impl data and control structures

Change-Id: I4230570ea8339b12d855f7de7fa72e4664013e2d


# ec7d71e6 13-Sep-2021 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Add skeleton BHttpSession class and its documentation

Change-Id: Ia8a35588422908f6fe9b839ce239fb478baf298b