Commit Graph

63879 Commits

Author SHA1 Message Date
Niels Sascha Reedijk
27196c4068 NetServices: use BBorrow<BDataIO> for custom body targets
Change-Id: Ib2d4b0ca3689338d906f943295278c086c6f2c83
2022-09-04 07:27:08 +01:00
Niels Sascha Reedijk
1e22817dfb NetServices: add the BExclusiveBorrow<T> smart pointer
This smart pointer is designed to help with putting some explicitness and
safety around the case where someone will use their own object that implements
the BDataIO interface to store the body of a network request. By default,
BDataIO objects do not require or enforce thread safety. Since accessing these
unsynchronized objects between two threads is undefined behavior, it should be
explicitly discouraged.

The BExclusiveBorrow/BBorrow smart pointer helper helps solve that by enforcing
the limitations on using an unsynchronized object in two threads. When used
correctly, there is a runtime check on incorrect use by the developer. This
should help write better code.

The design is based on shared_ptr, including having an admin block akin the
control block, that manages the internal object. This type-erased admin block
has the advantage that it allows the owner to have a different type than the
borrower. It also handles cases where the lifetime of the borrower is longer
than the owner: the borrower can continue to use the object until they want to
return it, after which it will be cleaned up. This will make it possible to do
some fire and forget pattern in the network services kit, where someone may
just wants to create a file and borrow it to the network request, and care
about further processing the file in the future.

Change-Id: Ie9b7e7472c868b60f663b4db4fa449d421e447eb
2022-09-04 06:54:37 +01:00
Niels Sascha Reedijk
6c4a9fd69b NetServices: add query part of the URL to the request
Change-Id: Ie169041925544f082a8be728d77cbc69edf2caa2
2022-08-15 22:08:03 +01:00
Niels Sascha Reedijk
8a16ecbce9 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
2022-08-14 14:53:48 +01:00
Niels Sascha Reedijk
aa8ca18a34 NetServices: Implement a logger for requests.
This logger can print to console or log to file.

Change-Id: I7eef847d42b360af1cb7cec0c897131b975a1f2f
2022-08-14 09:46:16 +01:00
Niels Sascha Reedijk
7b1d966cf2 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
2022-08-08 07:58:45 +01:00
Niels Sascha Reedijk
9cb56a4881 NetServices: Add custom error message to BNetworkRequestError
Change-Id: I03970762531a689e25cd78a1091aecf755ee87ce
2022-08-07 08:47:19 +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
e68284565a NetServices: move HttpBuffer and HttpParser into their own header/source
Change-Id: I5bc0d9df6f94c2cf1c39baa6206bf6f1db284705
2022-08-01 08:11:56 +01:00
Niels Sascha Reedijk
9b33a931f1 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
2022-07-27 09:02:09 +01:00
Niels Sascha Reedijk
251828d308 NetServices: Rewrite the control thread loop to prepare for filtering of requests to do
Change-Id: I72d5f1ddd499f8fb227af5ee78111a60eb50b1f5
2022-07-24 22:07:22 +01:00
Niels Sascha Reedijk
60355daec9 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
2022-07-24 08:56:02 +01:00
Niels Sascha Reedijk
b74e852fd9 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
2022-07-20 06:28:17 +01:00
Niels Sascha Reedijk
2b4cd81ff3 NetServices: add support for receiving incoming chunked messages
Change-Id: I1bfe22a7959c7a5fc7dc644e4e3941965edafb65
2022-07-19 06:29:36 +01:00
Niels Sascha Reedijk
826afd9616 NetServices: Refactor the parsing code into a HttpParser helper class
Change-Id: Ib03aacc36d46318c8870554f794ff66db4cce063
2022-07-17 15:54:54 +01:00
Niels Sascha Reedijk
a1e7583626 NetServices: add HttpBuffer to encapsulate buffered reading
Change-Id: I7ec3189c3cf459fccae4ffac44702fd6b8c12ac9
2022-07-03 12:17:10 +01:00
Niels Sascha Reedijk
6cf088266f NetServices: When the response Content-Length is 0, do not expect a body.
Change-Id: Ia715b44289dc3c64c2b834f954421413cbc3593c
2022-06-26 16:04:58 +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
6cbbd9bf4e NetServices: Implement BHttpSession::Cancel()
Change-Id: Iff0a7726e57f3e6bd4e9d0ebac08a370d25a62d7
2022-06-03 13:38:28 +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
46b7da1f4f Merge branch 'master' into dev/netservices
Change-Id: I1eb6c2ea2fd0d794ad6378eab8bbb80ce46dfbb8
2022-05-08 09:00:42 +01:00
Niels Sascha Reedijk
929355add7 libroot: return error on partial match in strptime()
The previously implemented behavior of strptime() allowed for partial matches
of strings. For example, if the format string was "%a, %d %b %Y %H:%M:%S", it
would successfully parse "Sun, 07 Dec 2003" as input. This is inconsistent with
the standardization in POSIX.1-2001 (and later).

This change makes strptime() return an error if there is no more data in the
buffer and not the entire format string is parsed.

Change-Id: If066c49fb7fc094f8ccd56703cd01903a0e40cb3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5298
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-08 07:58:05 +00:00
Niels Sascha Reedijk
cf54474e38 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
2022-05-08 06:59:51 +01:00
Jérôme Duval
7ff9722ae3 intel_extreme: reuse DpAux code for DisplayPort
the code is moved in the Port class.

Change-Id: I3beb337e29b26ee4732224723c5b76b5f415a248
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5291
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-05 16:26:03 +00:00
Jérôme Duval
1c23e6bcf1 intel_extreme: leverage VBT device type for internal panel
* also handle dp aux on PCH.
* tested on Gen7, should work from Gen6.

Change-Id: I8d99bcdc10c817e66441a6a644df490dd988a74d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5290
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-05 16:26:03 +00:00
Augustin Cavalier
d98fcb7db6 HID: Return ENODEV instead of B_ERROR if the device was removed.
This should help with diagnosing problems in some failure conditions.
2022-05-03 16:59:19 -04:00
milek7
42c53fc8b8 arm64: Fix ELF relocations.
Change-Id: Icc48649d6a3a8c6b5b5ab845e9025352c1e77dfb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5260
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-03 20:27:18 +00:00
milek7
8417420441 arm64: Do not misalign kernel stack.
AAPCS64 requires stack to be aligned to 16 bytes.
Additionally alignment might be enforced by hardware for every sp-relative
access depending on configuration in SCTLR.

Change-Id: Idd4756dd19386eb491d926b8a9862fa7fa48e506
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5259
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-03 20:27:18 +00:00
milek7
7c69ebda17 arm64: Add mapping of all memory in kernel virtual space at KERNEL_PMAP_BASE.
Change-Id: I828b1ba8c0add614e9df6bba1e14c5e514ec1bad
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5258
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-03 20:27:18 +00:00
Lt-Henry
2684c64083 usb_hid: Update HID Consumer usage page constants to 1.3 spec
Change-Id: I5ffbcda41547b1a31049b5d7ba73f7327bb8cf04
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5288
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-03 19:04:30 +00:00
Jérôme Duval
459f1bcd8d intel_extreme: irq hotplug support for IceLake and newer PCH.
we enable every port interrupt instead of relying on the ports found in the VBT.
ATM only log the plug state when it changes.

Change-Id: I5175fb137d11f0114beb2915a4f363341cfe8e36
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5287
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-03 18:15:48 +00:00
Jérôme Duval
46bbf334f6 intel_extreme: parse VBT device configs, use this to skip unused ports
* BDB version from 111
* for DDI from Gen9
* for HDMI and DisplayPort from Gen6
* use the first port to create the mode list
* also probe DDI Port A
* the aux channel helps to select the correct dp aux registers.

Change-Id: I80549a6ec0477bed768cc5f388959b606d50c1b7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5286
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-03 08:48:34 +00:00
Autocomitter
2aac05508f Update translations from Pootle 2022-04-30 08:15:54 +00:00
Jessica Hamilton
2798df0e80 HaikuDepot: fix build rules
* Fixes a couple issues with independent target warnings, causing
  parallel build problems.

Change-Id: Id968709094c9d5efa4cb443c62c41c83c9622355
2022-04-29 15:24:03 +00:00
David Karoly
83f755b5d8 kernel/arm: add memory barriers for page table ops
Introduce memory barriers according to ARMARM,
section G.5.3 TLB maintenance operations and barriers

Sequence for mapping memory in (both L1 and L2):
* DSB
* Invalidate i-cache (TODO)
* Insert new entry in page directory / page table
* DSB
* ISB

Sequence for mapping memory out:
* Remove page table entry
* DSB
* Invalidate TLB entry
* DSB
* ISB

Sequence for updating a page table entry:
* Update page table entry
* DSB
* Invalidate TLB entry
* Invalidate branch predictor (TODO)
* DSB
* ISB

Note: i-cache invalidation and branch predictor invalidation is
not implemented yet as this commit focuses on implementing memory
barriers.

Change-Id: I192fa80f6b43117236a4be6fa8c988afca90e015
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5241
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2022-04-28 19:57:49 +00:00
Jérôme Duval
cf5f513b3b file_systems: add entry_cache_(add/missing) in btrfs,ext2,exfat lookup methods.
Change-Id: I77857421a65f371bc885f1d4eb66ef2ab4376e56
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5252
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-04-28 19:16:48 +00:00
Mashijams
2cecdeed2e xfs : fix build with trace enabled, improve error checks
- Remove referencing an undeclared identifier

    - Instead of an assert, just log an error for XFS V5 filesystems
      and don't try to mount them

Change-Id: I67303aff89b81a28b7333569fea8113b6020dc54
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5204
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2022-04-28 19:16:12 +00:00
Jérôme Duval
1d2cf139a8 strace: trace fcntl and wait_for_child syscalls parameters
Change-Id: I774e8343139a2bdb3c2f60f37cab3a7207739c7c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5251
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-04-27 06:00:58 +00:00
Augustin Cavalier
68d1b97e4f Clean up mouse functions in InterfaceDefs.
* Fully remove unused and deprecated functions.
 * Comment as to which functions are deprecated.
 * Rename _by_name functions to be without the suffix, as this is C++
   and there's no reason not to use overloads here.

Change-Id: I4e2152f17806605eb965795417013cea800e661e
2022-04-26 19:59:01 -04:00
Augustin Cavalier
467ffecdbb HaikuDepot: Temporarily disable viewing usage statistics.
It causes crashes (see #17689) and I was unable to determine the cause;
and it causes very noticeable lag (see #16879.) It can be reinstated
once those problems are fixed.
2022-04-26 17:51:51 -04:00
Augustin Cavalier
7d7de13527 HaikuDepot: Fix leak of ProcessCoordinators.
This function is supposed to take ownership of the coordinator item,
but it didn't do that in all cases. Use a BReference(..., true)
to do that.
2022-04-26 17:50:53 -04:00
Augustin Cavalier
a173592b40 Tracker: Fix memory leak in IconCache::SetIcon.
How often this would have occurred before thumbnail support I'm not sure,
but at least now that we have thumbnails, the icons are changed out
with not insignificant frequency, especially on read-only filesystems.
2022-04-26 15:03:01 -04:00
Augustin Cavalier
a64cdd1dcc Tracker: Overhaul thumbnail generation logic.
* Use a JobQueue and BJobs to generate the thumbnails, instead of
   spawning a potentially unlimited number of threads (which can
   of course rapidly exhaust resources.) Use two threads: one for
   smaller files, and another for larger files.

 * Directly insert the new thumbnails into the icon cache once they
   have been generated, avoiding the port-search dance on filesystems
   that do not support writing attributes (or at least large ones.)

 * Skip calling mimeset, is it not needed after the previous commit.

 * Combine all the duplicated image-scaling logic into one function.

May help with or fix #17225, #17619, and other thumbnail-related matters
e.g. #17557. Also addresses comments from the mailing list last summer.
2022-04-26 14:55:12 -04:00
Augustin Cavalier
6750cef9ca Tracker: Thumbnail attribute changes should cause an icon refresh.
This way, a full mimeset need not be run to trigger an icon update,
and also other applications can write thumbnails and trigger updates.
2022-04-26 14:44:12 -04:00
Augustin Cavalier
5192c3bfff Tracker: Move thumbnail-manipulation code to its own file.
Preparatory work for refactoring thumbnail generation to not use
so many resources (threads, ports, etc.)
2022-04-25 23:10:03 -04:00
Augustin Cavalier
457d8a9282 Tracker: Remove unused rgb_color creation function.
Nothing seems to use it. make_color should be used instead.
2022-04-25 22:28:46 -04:00
Augustin Cavalier
c6b6adc407 Tracker: Replace custom LooperAutoLocker with AutoLocker<BLooper>. 2022-04-25 22:28:45 -04:00