History log of /haiku/src/tests/kits/net/netservices2/HttpProtocolTest.cpp
Revision Date Author Comments
# 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


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

NetServices: Disable BasicAuthTest for HTTPS

Change-Id: I0b61af00b96ebe7fbcd04da50e32cb9e9be7f890


# 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


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

NetServices: Implement a logger for requests.

This logger can print to console or log to file.

Change-Id: I7eef847d42b360af1cb7cec0c897131b975a1f2f


# 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


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

NetServices: add the HttpSerializer helper to help serialize requests

Change-Id: Ide1e2d387884ce4cf2d406057960cd0732d61f38


# 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


# 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


# b74e852f 19-Jul-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Remove Accept as standard and protected header.

In the old service kit, the Accept header was automatically set. However, it is
not a required header. This removes the default value and the protection against
setting it manually.

Required to make HaikuDepot work.

Change-Id: Ic589bfc5829db25915b67f2a13b6c2436c053e25


# 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


# f9d9d202 29-May-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Add support for Basic authentication

Change-Id: I304104f7096fd935212e1bfa3e988e7945cb5cec


# f7515342 15-May-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: add optional fields to BHttpRequest

Change-Id: I6228419a55c81203ce2c26827d17ff6a402d86c5


# cf54474e 06-May-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Implement BHttpTime, parse_http_time() and format_http_time().

These utilities convert timestamp strings that are formatted according to
the HTTP RFC into BDateTime objects, and vice versa.

Change-Id: Ia2498944fb63d09233839f19d08f15d82a0a9685


# 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


# 8ccf8fb4 10-Apr-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Rewrite BHttpFields to use raw strings as underlying data storage

This change also drops the principle that fields with the same keys would be
grouped together. This was initially inspired by Boost::Beast, but it means a
lot of extra copying of data when adding/organizing the list, as well as
inefficient querying on each add. Now that the design choice is to fully go
for the raw string as underlying data storage, that choice is not necessary.
In the future it may be able to emulate the grouping or retrieving of lists
of values in the API, rather than as a fundamental principle of the data
storage.

Change-Id: I2667cfa38eb3b7b75393ee71fb038231a40b4193


# 1d2070c7 04-Apr-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: add testserver.py and proxy.py test infrastructure

This adds the existing testing facilities to the netservices2kit.

Change-Id: Idd884a800abda967bc4b65a416a5f6d927f37450


# 02ea57d7 03-Apr-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Introduce BHttpRequestStream and abstract interface.

This supports asynchronous transfers of Http Requests to a network
interface.

Change-Id: I845fb2e08160d219f85b7a08d2d8872ac7359b47


# d9a4c607 30-Mar-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Serialize the header of a BHttpRequest to a string

Change-Id: Ib1e22536a0b39dc6e9461e7993ea6784f1ea0e2f


# 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


# 6ce6e964 25-Feb-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Introduce BHttpRequest class

Objects of this class describe a HTTP request. It contains several convenience
functions that will allow a user to describe the properties of the request.
More options to be added later.

Change-Id: If6a00d26808c5ed4b121cb36dc75a2a1cc449f95


# ec865cb8 20-Feb-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Add BHttpMethod that represents a HTTP method

This class provides defaults and performs basic validation for HTTP Methods as
defined by the standard. They will be used in conjunction with a future
BHttpRequest class.

Change-Id: If69a7ec186d9d1165e8efe5ab5df50d5a089208d


# a8003a70 08-Feb-2022 Niels Sascha Reedijk <niels.reedijk@gmail.com>

NetServices: Introduce BHttpFields to query and manipulate fields in HTTP messages

HTTP messages (requests and responses) have a header section that can contain
HTTP headers. These headers consist of name, value pairs. This class can be
used to query the headers on a response, and build a list of headers for a
request.

The internal implementation is designed around two different methods of storing
the underlying data. For HTTP requests, the name, value pairs are stored as
owned BString objects. For responses, the assumption is that there is a byte
buffer that contains the data and that has the same lifetime as the BHttpFields
object. The name, value pairs will then be stored as std::string_view to the
underlying buffer.

Still to do is:
- The method to convert a BHttpFields list into a string buffer to transmit.
- The method to parse a string buffer and turn it into a BHttpFields object.

Change-Id: I4819db100aa1671aa7403675216a4c85fd221da7


# 34522da9 15-Dec-2021 Niels Sascha Reedijk <niels.reedijk@gmail.com>

netservices: add BHttpHeader class and BHttpHeaderMap skeleton

Change-Id: I36a7c757a6909604d749355ecb1a9d42d05d7306