Commit Graph

63398 Commits

Author SHA1 Message Date
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
Niels Sascha Reedijk
cb67e34887 NetServices: move token validation to header for reuse elsewhere
Change-Id: I2dbed5cfbd387eaf6ed7cf38c73a7db865a87771
2022-02-20 13:10:20 +00:00
Niels Sascha Reedijk
a8003a7030 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
2022-02-20 13:10:19 +00:00
Niels Sascha Reedijk
268f99dd7d Merge branch 'master' into dev/netservices 2021-12-22 20:46:13 +00:00
Adrien Destugues
5fcc7f71b5 ethernet: do not log everytime there is a media change.
This code was written with wired ethernet in mind, where changes are
rare. However, on wifi the "media" changes all the time (switching
between different connection speeds). So, only log linkup and linkdown.
The other events are not that important.

Change-Id: Iaafb74ceb05a59dedf94184eee23a4e81fa5e983
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4827
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-12-21 18:51:25 +00:00
Adrien Destugues
a8b90daa8a Fix more problems with DHCP timers
- Number of retries could overflow. If we retry something more than 255
  times and it fails, just stop, instead of flooding the network with
  bogus requests
- The timeout could also overflow. It was stored in microseconds in a
  time_t, which allows a bit more than an hour. This is fine for the
  initial timeout (which starts at a few seconds and will go up to 64
  seconds), but after that we switch to a slower rate driven by the
  "state time". In particular, this can be the lease time, which DHCP
  servers may set to several days, or at least easily more than an hour.
- The computaiton of the timeout in the "slow lease" case attempted to
  do "not less than a minute", but missed a conversion from microseconds
  to seconds so it ended up doing "not less than 60 microseconds"

The combination of all these things means we can end up with a negative
timeout, and we will send a burst of requests without ever stopping,
flooding the network.

Change-Id: I0eb811c90f4a4dd8c9d92bff728bc2bbb52fbd56
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4826
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-12-21 18:51:25 +00:00
Jérôme Duval
50a4c18678 kernel/xsi_semaphore: set otime when semop() succeeds
used by PR_OpenSemaphore in NSPR to check the creator inited.

Change-Id: I626c6ab0d50896c94224718ca4fa0788f74ae27a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4824
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-12-18 21:14:39 +00:00
Alexander von Gluck IV
65ed50c713 graphics/edid: Add support for digital display info; solves #17462
* We pack the first 8 bits into a union for the raw
  edid since alignment matters.
* Handing the raw_edid is a bit ugly, so in the edid struct
  we drop the input_type from the union since packing doesn't
  matter as much.

Change-Id: I32dbfe9484f9eb83cf491a44d30a32ca36d65b7b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4775
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-12-18 15:21:30 +00:00
Lt-Henry
6a9aea9dfd input: implemented B_GET_DEVICE_NAME ioctl on both usb and i2c input devices
Change-Id: Ie1eb0a958b4d60e6fa673cf8fe72bdfe924baf51
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4798
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-18 14:51:19 +00:00
Alex Hitech
370623a923 Russian keymap: the Rouble currency sign was mistakenly on the Capslock key, and vice versa.
Change-Id: I3d907da00cfc0d5092ef04bfa50f413ba261e5e6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4822
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-12-18 09:39:47 +00:00
Augustin Cavalier
e0842c10af kernel/condition_variable: Pause between iterations.
Should hopefully resolve the remaining problem in #17455.

Change-Id: I6e00286508c069705e07c9a0b59af2cf5e15e427
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4819
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-12-18 07:52:47 +00:00
Jérôme Duval
101dc0ba83 strace: fix revents output for poll syscall
each poll_fd struct should be checked, valid when not -1 and revents not zero.

Change-Id: Ia624ad1369ad1a6066c9970a47cfac63fa773702
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4821
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-12-17 20:40:55 +00:00
Jérôme Duval
3285dcae22 tcp: reset receive.low_water_mark when nothing to read anymore
the socket interface module checks the receive.low_water_mark to automatically
notify a read event. available_data will be zero, thus enabling the notification.

fixes the test poll_nm in NSPR.

Change-Id: I5354faec439df96671506550cdb144a45f6082b1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4820
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-12-17 20:40:55 +00:00
Niels Sascha Reedijk
34522da9e3 netservices: add BHttpHeader class and BHttpHeaderMap skeleton
Change-Id: I36a7c757a6909604d749355ecb1a9d42d05d7306
2021-12-17 17:40:15 +00:00
Niels Sascha Reedijk
892cbe10b6 Tests: add skeleton for new services kits tests
Change-Id: I759c6b91d3bf856dbbe8b8b6112d53e601798abf
2021-12-17 17:40:15 +00:00
Niels Sascha Reedijk
3d2aee7545 CppUnit: use <sstream> instead of the deprecated <strstream>
<strstream> has been deprecated since C++98. Both GCC 2.95.3 and GCC 8.3 have
the successor <sstream> available, so use that one instead.

Change-Id: Ifefe686974864c2fd1d4a9d083294b1edb436fbd
2021-12-17 17:40:15 +00:00
Niels Sascha Reedijk
1715bb67ea netservices: Flesh out BHttpSession::Impl data and control structures
Change-Id: I4230570ea8339b12d855f7de7fa72e4664013e2d
2021-12-17 17:40:15 +00:00
Niels Sascha Reedijk
ec7d71e612 NetServices: Add skeleton BHttpSession class and its documentation
Change-Id: Ia8a35588422908f6fe9b839ce239fb478baf298b
2021-12-17 17:40:15 +00:00
Niels Sascha Reedijk
f54a5a68d7 HaikuBook: Prepare for newer Network Services Kit docs
Change-Id: Ib2cc458f9121cb78250a643affc0933512e65bc8
2021-12-17 16:25:44 +00:00
Niels Sascha Reedijk
bcd6a663c2 BString: make move constructor and assignment noexcept
Change-Id: I87f5ecad22f46b59386a091a1bb502536f460315
2021-12-17 16:25:44 +00:00
David Karoly
18e885db51 boot/efi: implement convert_kernel_args for 32-bit
Change-Id: I528d6f8ca576b38c50dc314972636e7156d24705
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4784
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-17 08:58:57 +00:00
David Karoly
af90bfd3bb boot/efi: introduce arch_convert_kernel_args
Change-Id: Iabb321564d6733c6cf481ec2548fa287e308ae89
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4796
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-17 08:58:57 +00:00
Augustin Cavalier
e94ea7bc22 UDP: Fix double-reference of DomainSupport.
PulkoMandy in cb3199681e changed
the _GetDomainSupport functions to always Ref() the the object.
However, that means in the case of the second _GetDomainSupport
function, which is implemented in terms of the first, we should
not call Ref() as this will create a double-reference.

Fixes a memory leak.

Change-Id: Ib82b2dadc0c8cc8d8f95efcffeb2430ac602a0a9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4791
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-16 08:55:55 +00:00
David Karoly
c1e0007eea virtio-mmio: add initialization for legacy mode (version 1)
Change-Id: I4dcfca8cfabafad592b638b28215225b1cca35d2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4657
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-12-15 15:55:50 +00:00
David Karoly
f0adfe2a54 boot/efi: fix dummy reloc for x86
Change-Id: Ia61d593c8d131bd6780688ea932b5b92bd629764
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4748
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-12-14 19:56:21 +00:00
David Karoly
1a7afaa45b boot/efi: fix for garbled first item returned by mmu_next_region()
Change-Id: Ic9d02800bccbb5508eeb0b2c1ee1ed1326d0829f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4783
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-12-14 19:48:38 +00:00
David Karoly
20efe26dfa boot/efi/arm: fix printout of kernel entry address on startup
Change-Id: If3d592983e1c22210c6b4d3a6ceaf2a7641e7e7a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4785
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-12-14 19:46:50 +00:00
David Karoly
1f6e2499db ldscripts/x86: add ldscript for EFI loader
Linker script is adapted from elf_ia32_efi.lds in GNU-EFI.
see:
https://sourceforge.net/p/gnu-efi/code/ci/master/tree/gnuefi/elf_ia32_efi.lds

The only significant change is the additions of ctors.

Change-Id: I1091f610129f806f124d714fd9a42cf932fa1c2d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4746
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-12-14 19:44:23 +00:00
David Karoly
d223f9d9c2 boot/efi/serial: fix legacy mode for x86
Change-Id: I44fd33289da94e9520c6c202ac96c4ca8e511638
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4754
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-12-14 13:19:14 +00:00
David Karoly
a857758352 boot/efi/x86: fix address for arch args
Change-Id: If9a3bb32cb8d290f97cee2e8e821dcbf8b8852a8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4789
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-12-14 11:15:37 +00:00
Jérôme Duval
d057f0aedd lgtm.yml: disable Wformat-diag when building gcc
LGTM seems to provide GCC 9.2, for which the flag -Wformat-diag is falsely
detected as supported.

Change-Id: I95a5946d9c6cd2af73e85070973f855fba3fcc39
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4786
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-12-14 06:06:41 +00:00
David Karoly
3896dbcb1d kernel/arch/arm: fix missing return statement in rtc
Change-Id: Ib5a2e06884b6973ed102b30b1339a7b800c95418
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4781
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-13 14:47:10 +00:00
Murai Takashi
771516d7f0 lgtm.yml: add g++ to prerequisite software
LGTM build failed since -Wformat-diag check is failed.
So we add g++ to check its version in LGTM.
May help to fix #17460.

Change-Id: I9400dbbab7800c522bf7ed797adae48299581a4e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4780
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-12-13 13:59:38 +00:00
Alexander von Gluck IV
000310809f debugger: fix warning format-overflow= '%s' directive arg is null
Change-Id: Iba00fbcc3f8fde088bed62b93c4e3acae4e0b902
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4777
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-12-13 10:23:24 +00:00
Alexander von Gluck IV
4c8e85b316 3rdparty/docker/bootstrap: Fix bootstrap container
* Update for newer git (init -b support)
* Fix configure args for new cross-tools-source

Change-Id: I757a1a48affb8cd98ddd8a0890393bdb6bc2a81f
2021-12-12 14:24:21 -06:00
X512
8ca0f03d0c riscv64/smp: Implement multi-processor support
* Working under qemu smp 1,2+
* Working on SiFive Unmatched
* x86_64 efi not broken by smp_boot_other_cpus change

Change-Id: I32ebc17913e46ed082be9ade8f56448bbf12f16e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4705
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-12-12 15:35:24 +00:00
Augustin Cavalier
0cdb323800 app_server & Application Kit: Fix bitmap cursor handling.
Using a memcpy here is supremely dangerous, because we are writing to
an app_server buffer that we chose the length for, but using a size
that came from the client. And, indeed, because the buffer can contain
padding if the BBitmap was allocated with a non-standard BytesPerRow,
we will overflow the buffer and corrupt memory, causing app_server to crash.

So, instead, reorganize parameters a bit, and pass BytesPerRow along
with the other data needed to instantiate the bitmap, and then use
ImportBits.

Fixes an app_server crash I triggered with the experimental libX11
compatibility layer.
2021-12-11 21:44:59 -05:00
Alexander von Gluck IV
662912945f radeon_hd/pll: Guard bpc on non-HDMI under table 1.5,1.6
* Cut extra calls to display_get_encoder_mode
* Correct incorrect ucMiscInfo on table 1.6 via atombios
  comments

Change-Id: Ib6d7938269b8421d3711c1344eab0b9842336932
2021-12-11 10:30:43 -06:00
Alexander von Gluck IV
3084929f81 radeon_hd/pll: Fix pll MiscInfo on table 1.5
* Looks like some error in atombios. AMD just
  reversed the values instead of fixing the atom.h
  defines in Linux.

Change-Id: I440682af5708ce0da1625e8f50e8cb77595c8397
2021-12-11 10:19:13 -06:00
X512
98296c4a29 haiku_loader.efi: fix build for riscv64
Change-Id: I83f4b45ea950e81fdd712644433266401c0747bd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4774
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-11 15:35:02 +00:00
Alexander von Gluck IV
e87cba3470 radeon_hd: Add handling of connector routing
* A first attempt at improving on #17377
* We haven't actually seen any cards using this
  routing stuff yet pre-navi.
* We don't use the router information yet... but this might
  improve things a bit on new cards.

Change-Id: I17962dfd8bb09e619a6084cd9571ccb9832fb19a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4697
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-11 14:19:00 +00:00
David Karoly
6e28efbb5f platform/efi/devices: fix build when TRACE is enabled
Change-Id: If9ea3212b7908aaa6c9c6774cb68a6dbf635a5ac
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4761
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-11 14:16:34 +00:00
David Karoly
1103466926 build ARM EFI bootloader with soft-float
Change-Id: If7feffafea4fc6d295d04f696127c8f0fbd8fb9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4704
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-12-11 14:07:06 +00:00
David Karoly
69f4a74149 link bootloader with libgcc-boot.a and libsupc++-boot.a on ARM
Change-Id: Ia7f41191136db3ea34ed6abee97ae627bb7b1727
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4703
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-11 14:07:06 +00:00
David Karoly
123aa1325c boot/efi/arm: enable FPU before jumping to kernel
Change-Id: I37bb2146102a207e97355e099f6b4160d644c326
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4701
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-11 14:07:06 +00:00
Jérôme Duval
17e8767959 intel_extreme: define bdb header values, check panel type.
Change-Id: I2e5b61da9aecc11be13178a0b48211d172454d94
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4773
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-12-11 13:30:20 +00:00
Rudolf Cornelissen
d2e4af7873 intel_extreme: expand bios scan for panel a bit, might help ticket #17451 2021-12-11 12:21:42 +00:00
Augustin Cavalier
84c9ff3ee5 net80211: Work around #17458.
Until the cause can be properly determined, anyway.
2021-12-10 21:48:27 -05:00
Augustin Cavalier
08236b3b59 libroot: Force __cxa_pure_virtual to be linked in libroot_debug too. 2021-12-10 21:34:44 -05:00