Commit Graph

13 Commits

Author SHA1 Message Date
Niels Sascha Reedijk
71e29bbeea 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
2022-10-29 22:53:57 +01:00
Niels Sascha Reedijk
6d1bb0e7ad NetServices: Remove BHttpRequest::SerializeTo(BDataIO*)
The private version that serializes to a HttpBuffer is now used.

Change-Id: I034933a641e98b3a8f918470a024ba32ea7c8663
2022-08-07 07:17:38 +01:00
Niels Sascha Reedijk
c7f925c3ee NetServices: add the HttpSerializer helper to help serialize requests
Change-Id: Ide1e2d387884ce4cf2d406057960cd0732d61f38
2022-08-07 06:47:15 +01:00
Niels Sascha Reedijk
92357c131e NetServices: Add support for an input body in a request and handle this with redirects.
Change-Id: Id2399d49aa673469c8c04ebd13884cdbcb24112d
2022-06-23 21:13:35 +01:00
Niels Sascha Reedijk
2f3b9b18ac NetServices: Add/rework the MaxRedirections, Timeout and StopOnError options
Change-Id: I4e59b51c16c6777941dc92ce02505386257dad03
2022-06-03 09:40:42 +01:00
Niels Sascha Reedijk
f9d9d20245 NetServices: Add support for Basic authentication
Change-Id: I304104f7096fd935212e1bfa3e988e7945cb5cec
2022-05-29 15:13:54 +01:00
Niels Sascha Reedijk
f751534257 NetServices: add optional fields to BHttpRequest
Change-Id: I6228419a55c81203ce2c26827d17ff6a402d86c5
2022-05-15 16:43:07 +01:00
Niels Sascha Reedijk
13bfff7be3 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
2022-04-23 18:30:38 +01:00
Niels Sascha Reedijk
59c359e5a9 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
2022-04-18 14:34:46 +01:00
Niels Sascha Reedijk
d9a4c6070c NetServices: Serialize the header of a BHttpRequest to a string
Change-Id: Ib1e22536a0b39dc6e9461e7993ea6784f1ea0e2f
2022-03-30 07:38:57 +01:00
Niels Sascha Reedijk
3b172a3dc6 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
2022-03-24 06:13:38 +00:00
Niels Sascha Reedijk
6ce6e96470 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
2022-02-25 08:41:14 +00:00
Niels Sascha Reedijk
ec865cb87e 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
2022-02-20 15:34:55 +00:00