Commit graph

68 commits

Author SHA1 Message Date
Olivia Lee
abb1b5681e
add partial_canonicalize helper function
This is useful for checking for potential overlap between paths that
have not been fully created yet.
2025-04-14 15:28:31 -07:00
Lambda
3247c64cd8 Add support for HAProxy proxy protocol for listeners 2024-10-25 20:48:38 +00:00
Lambda
6a44d0af2b Fix u8_slice_to_hex()
For bytes <0x10, this would omit the leading zero.
2024-10-20 18:50:05 +00:00
Charles Hall
5a490a4397
fix mod/use order
Yes, it does actually bother me, thanks for asking.
2024-10-03 15:28:24 -07:00
Benjamin Lee
9add9a1e96
fix room version comparisons
Fixes a set of bugs introduced by 00b77144c1,
where we replaced explicit `RoomVersionId` matches with `version < V11`
comparisons. The `Ord` impl on `RoomVersionId` does not work like that,
and is in fact a lexicographic string comparison[1]. The most visible
effect of these bugs is that incoming redaction events would sometimes
be ignored.

Instead of reverting to the explicit matches, which were quite verbose,
I implemented a `RoomVersion` struct that has flags for each property
that we care about. This is similar to the approach used by ruma[2] and
synapse[3].

[1]: 7cfa3be0c6/crates/ruma-common/src/identifiers/room_version_id.rs (L136)
[2]: 7cfa3be0c6/crates/ruma-state-res/src/room_version.rs
[3]: c856ae4724/synapse/api/room_versions.py
2024-09-26 13:01:25 -07:00
Charles Hall
cb3e0c620a
improve media key decoding logs
On my HS I observed 5 instances of keys with the following format:

* MXC bytes.
* A 0xFF byte.
* 4 bytes where the width and height are supposed to be, which are
  supposed to be 8 bytes in length.
* 3 consecutive 0xFF bytes. This means that the `content-type` and
  `content-disposition` sections both parse as the empty string, and
  there's an extra separator at the end too.
* Extra bytes, all of which were `image/png`.

The 4 bytes where the width and height are supposed to be were one of:

* 003ED000
* 003EE000
* 003EF001

Which seems to have some kind of pattern to it...

After much digging, we have absolutely no idea what could've caused
this. Cursed.
2024-09-19 15:23:20 -07:00
Lambda
5c4062742f
Log curl command line for all requests at trace 2024-09-08 09:10:40 -07:00
Lambda
f1642c92d1 Take iterator in calculate_hash()
Avoids unnecessary allocations.
2024-09-06 17:20:14 +00:00
Lambda
26322d5a95 Add PduId wrapper struct
Death to Vec<u8>
2024-09-06 17:20:14 +00:00
Lambda
94204415ee Add MxcData helper 2024-09-01 09:42:45 +00:00
Lambda
2c19abc535 Add OnDemandHashMap and TokenSet 2024-07-22 18:07:00 +00:00
Charles Hall
6aca128547
generalize documentation, make the name shorter
It's more useful than just *debug* logs, but yes, should not be relied
upon for logic reasons.
2024-06-24 12:38:34 -07:00
Charles Hall
22dd7f1a54
move FoundIn to observability.rs 2024-06-05 17:41:36 -07:00
Charles Hall
71f3d84115
rename password-related utils functions 2024-06-04 19:35:25 -07:00
Charles Hall
aa4cd8b1e1
switch to RustCrypto's argon2 crate 2024-06-04 19:35:21 -07:00
Charles Hall
793d809ac6
enable unused_qualifications lint 2024-05-26 19:47:00 -07:00
Lambda
67cb6f817d Instrument caches 2024-05-22 20:10:42 +00:00
Lambda
c0ce2ebbf8 Add utility function for truncating strings in logging 2024-05-20 16:49:45 +00:00
Lambda
9dbc7d92e2 utils: add helper for adding unbounded slices to tracing spans 2024-05-20 16:49:42 +00:00
Charles Hall
0afc1d2f50
change rustfmt configuration
This change is fully automated, except the `rustfmt.toml` changes and
a few clippy directives to allow specific functions with too many lines
because they are longer now.
2024-05-16 19:11:40 -07:00
Charles Hall
1911ad34d9
stop putting comments and code on the same line 2024-05-16 15:22:35 -07:00
Charles Hall
4e80dc028e
enable unnecessary_wraps lint 2024-05-14 20:01:25 -07:00
Charles Hall
96e1877639
enable redundant_closure_for_method_calls lint 2024-05-14 20:01:24 -07:00
Charles Hall
844b32f097
enable string_slice lint
Also swaps out vendored HTML-escaping code for a dependency that I
imagine has decent testing considering all of its reverse depedencies.
2024-05-12 19:08:12 -07:00
Charles Hall
2ded335adb
enable impl_trait_in_params lint
See also <https://github.com/rust-lang/rust-clippy/issues/12792>.
2024-05-12 18:51:26 -07:00
Charles Hall
71c48f66c4
enable as_conversions lint
There were some very, uh, creative (and inconsistent) ways to convert
between numeric types in here...
2024-05-12 18:51:26 -07:00
Charles Hall
5d5e28770b
enable single_use_lifetimes lint 2024-05-12 18:51:26 -07:00
Charles Hall
d748544f0e
enable unreachable_pub lint
This causes some other lints to start firing too (which is good), but
I'm going to fix them in follow-up commits to keep things organized.
2024-05-12 18:51:26 -07:00
Charles Hall
a626e7b0f0
enable mod_module_files lint 2024-05-12 18:51:26 -07:00
Timo Kösters
025b64befc
refactor: renames and split room.rs 2022-08-15 16:30:34 +02:00
Jonas Platte
d74074ad53
Remove tracing::instrument attribute from util functions
They don't ever log anything, so the extra context is never used.
2022-02-12 15:01:28 +01:00
Jonas Platte
1f7b3fa4ac
Port from Rocket to axum 2022-02-12 12:56:07 +01:00
Jonas Platte
abb4b4cf0b
Remove TryFrom, TryInto imports
They are no longer needed in the 2021 edition.
2022-02-03 13:24:04 +01:00
Jonas Platte
1c4d9af586
Enable more lints and apply their suggestions 2021-10-13 10:24:39 +02:00
Timo Kösters
df727688ef
remove rocksdb 2021-08-04 21:17:40 +02:00
Timo Kösters
5e924227b6
feat: add threadpool for iterator threads, bug fixes, tracing_flame support 2021-07-29 08:49:28 +02:00
Jonathan de Jong
e1b89c1248 apply lint suggestions and version bump 2021-07-14 12:31:38 +02:00
Aiden McClelland
b2d5516058 add support for arbitrary proxies 2021-07-01 12:41:12 -06:00
Jonas Platte
f3e630c064
Fix lots of clippy lints 2021-06-17 20:34:14 +02:00
Timo Kösters
cd4bc520d8
improvement: feature flags for sled, rocksdb 2021-06-12 15:13:04 +02:00
Timo Kösters
d0ee823254
feat: swappable database backend 2021-06-09 22:21:52 +02:00
Timo Kösters
c1953efa6b
chore: code cleanup 2021-04-14 10:43:31 +02:00
Timo Kösters
84f4ce73e5
fix: membership deserializing 2021-04-09 21:45:22 +02:00
Timo Kösters
105f893cf3
chore: bump other dependencies to make it work 2021-03-04 12:29:08 +01:00
Devin Ragotzy
b6d721374f
Have Media db return optional content_type, conversion fixes 2020-12-05 17:37:11 +01:00
Devin Ragotzy
acd144e934
Fix get_closest_parent and cleanup federation/send/:txn 2020-12-05 17:37:10 +01:00
Devin Ragotzy
0d69ebdc6c
Reformat imports and fix clippy warnings 2020-12-05 17:37:07 +01:00
Timo Kösters
dd749b8aee
fix: server keys and destination resolution when server name contains port 2020-09-16 11:01:04 +02:00
Timo
3c26166fb5 improvement: device list works better
The only situation that isn't working yet is sending `left` events for
users when the sender leaves the room
2020-08-23 16:43:48 -04:00
Devin Ragotzy
cb68bf9e0c Use ring crate to generate StatHashes when saving stateid/statehash 2020-08-23 16:43:21 -04:00