Commit Graph

55 Commits

Author SHA1 Message Date
Karl Seguin
6863f3227f Improve performance & compliance of MIME parsing
Common cases, text/html, text/xml and text/plain parse about 2x faster. Other
cases are about 30% faster.

Support quoted attributes, i.e. charset="utf-8" & valid escape sequences. This
potentially requires allocation, thus Mime.parse now takes an allocator.

Stricter validation around type/subtype based on RFC.

More tests.

Replace Mime.eql with isHTML(). Equality is complicated and was previously
incorrect (it was case sensitive, it should not be). Since we currently only
use isHTML-like behavior, built a (faster) method specifically for that.
2025-02-10 11:07:55 +08:00
Karl Seguin
fc0ec860b0 Tweak generate.Tuple and generate.Union
Leverage comptime fields to give generated Tuple a default value, allowing
TupleT and Tuple to be merged.

Only call generate.Tuple on the final output. This eliminates redundant
deduplication, and results in a simpler API (nested types just need to expose
a natural Zig tuple).

generate.Union leverages the new Tuple and removes unused features.
2025-02-01 14:53:00 +08:00
Pierre Tachoire
50e62d44ff xhr: fix invalid response with empty type 2024-11-28 16:29:09 +01:00
Francis Bouvier
5b5d28f7c1 Merge pull request #302 from lightpanda-io/zig-async-io
Use zig-async-io for xhr requests
2024-11-21 16:52:36 +01:00
Francis Bouvier
de286dd78e async: use zig-async-io
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
2024-11-21 16:42:48 +01:00
Pierre Tachoire
6809bb5393 async: adapt async cli 2024-11-18 17:39:37 +01:00
Pierre Tachoire
f6ad95c647 improve event's log result 2024-11-18 13:13:52 +01:00
Pierre Tachoire
17a86cc1a6 http: use 16KB for the client header buffer 2024-06-18 17:19:05 +02:00
Pierre Tachoire
9cdf1f5762 xhr: fix unit tests for 0.12.1 2024-06-18 16:13:34 +02:00
Pierre Tachoire
f2a406d224 move netsurf and mimalloc into modules 2024-06-18 16:13:27 +02:00
Pierre Tachoire
ef364f83c8 upgrade to zig 0.12.1 2024-06-18 16:13:27 +02:00
Pierre Tachoire
f5a2c8d303 upgrade to zig 0.12 2024-06-18 16:13:26 +02:00
Pierre Tachoire
00d75584db usrctx: use ctx http client with xhr 2024-05-22 14:58:48 +02:00
Pierre Tachoire
2a3a243d1c add AGPL license header in zig files 2024-05-13 20:51:36 +02:00
Pierre Tachoire
8b47d72079 event: set this arg on callback 2024-05-02 15:25:41 +02:00
Pierre Tachoire
08e2365d75 Merge pull request #181 from lightpanda-io/xhr-event-delay
xhr: respect 50ms min delay between two progress events
2024-02-27 17:54:50 +01:00
Pierre Tachoire
d4104883ef xhr: use std.json.Value to parse JSON response 2024-02-26 18:01:07 +01:00
Pierre Tachoire
5439a37d25 xhr: respect 50ms min delay between two progress events 2024-02-15 17:53:54 +01:00
Pierre Tachoire
2508dc7e9a xhr: add some logs 2024-02-15 16:43:04 +01:00
Pierre Tachoire
4c19dbc34f xhr: fix content-type header typo 2024-02-15 16:43:03 +01:00
Pierre Tachoire
d062d0f1b6 xhr: implement basic send data from string 2024-02-15 16:43:03 +01:00
Pierre Tachoire
d58fbe07e3 xhr: return DOM document instead of HTML document 2024-02-15 16:43:03 +01:00
Pierre Tachoire
54a807bb36 xhr: add abort func 2024-02-15 16:43:02 +01:00
Pierre Tachoire
ff754fc666 xhr: implement responseURL 2024-02-15 16:43:02 +01:00
Pierre Tachoire
34015b8f57 xhr: add reponseXML 2024-02-15 16:43:02 +01:00
Pierre Tachoire
d5e3762179 xhr: comment json and add a document test 2024-02-15 16:43:01 +01:00
Pierre Tachoire
704f12f039 xhr: fix json response 2024-02-15 16:43:01 +01:00
Pierre Tachoire
84a5233245 xhr: implement response 2024-02-15 16:43:01 +01:00
Pierre Tachoire
f22c927067 xhr: move XMLHttpEventTarget in its own file 2024-02-15 16:43:00 +01:00
Pierre Tachoire
1a448b0b32 xhr: response_type getter/setter 2024-02-15 16:43:00 +01:00
Pierre Tachoire
47520ae21d xhr: move progress event in its own file 2024-02-15 16:43:00 +01:00
Pierre Tachoire
6aa182c131 xhr: defer event destroy 2024-02-15 16:42:59 +01:00
Pierre Tachoire
e79933990d xhr: destroy allocated mem on error 2024-02-15 16:42:59 +01:00
Pierre Tachoire
76df0a1ff7 xhr: fix ProgressEvent implementation 2024-02-15 16:42:59 +01:00
Pierre Tachoire
d24df5725c xhr: use nested object for ProgressEventInit 2024-02-15 16:42:58 +01:00
Pierre Tachoire
7323f2268a xhr: add blocked comment 2024-02-15 16:42:58 +01:00
Pierre Tachoire
4b75fd1036 xhr: rename onerr into onErr 2024-02-15 16:42:57 +01:00
Pierre Tachoire
4a9a0e5e3c xhr: progressevent accept null progressevent init 2024-02-15 16:42:57 +01:00
Pierre Tachoire
0acdadfec0 xhr: fix listeners setters 2024-02-15 16:42:57 +01:00
Pierre Tachoire
86a69da773 xhr: add ProgressEvent type 2024-02-15 16:42:56 +01:00
Pierre Tachoire
554a05d8dd xhr: fix getter/setter for callbacks 2024-02-15 16:42:56 +01:00
Pierre Tachoire
f791891314 xhr: dispatch generic events 2024-02-15 16:42:56 +01:00
Pierre Tachoire
8a61f0f454 xhr: yield each fetch steps 2024-02-15 16:42:55 +01:00
Pierre Tachoire
cac1110993 xhr: add getResponseHeader 2024-02-15 16:42:55 +01:00
Pierre Tachoire
19b459b4db xhr: add status and statusText 2024-02-15 16:42:54 +01:00
Pierre Tachoire
5bd5905da7 xhr: implement responseText 2024-02-15 16:42:54 +01:00
Pierre Tachoire
3915c60913 xhr: handle response headers 2024-02-15 16:42:54 +01:00
Pierre Tachoire
6f46d76c93 xhr: implementation follow up 2024-02-15 16:42:53 +01:00
Pierre Tachoire
0693011ad3 async: remove context from loop impl init 2024-02-15 16:42:53 +01:00
Pierre Tachoire
89409a4847 xhr: add a setOnload due to a setter issue
see https://lightpanda.slack.com/archives/C05TRU6RBM1/p1706708213838989
2024-02-15 16:42:53 +01:00