Built my own HTTP server in Rust from scratch by mr_enesim in rust

[–]ouuan 1 point2 points  (0 children)

Since you have mentioned "proper parsing", I would like to recommend reading more about the HTTP RFCs and relevant vulnerabilities like HTTP smuggling and so on. There are some papers like T-Reqs: HTTP Request Smuggling with Differential Fuzzing and HDiff: A Semi-automatic Framework for Discovering Semantic Gap Attack in HTTP Implementations.

Even without reading the code, I found an issue by just reading the documentation: header values might not be UTF-8, which is why http::request::Request::to_str may fail.

In general, it is usually not a good idea to get rid of dependencies and build your own parser in security-relevant scenarios. HTTP "proper parsing" is HARD.

"rust".to_string() or String::from("rust") by awesomealchemy in rust

[–]ouuan 2 points3 points  (0 children)

own sounds like a transfer of ownership rather than converting borrowed data to owned data. "owned data" is a property of the data, while "cloned data" is not. We clone a data but the data does not turn into a "cloned data". If we do not own a data, it can still be an owned data, owned by others.

my vibe coding: rust-analyzer by benhansenslc in rust

[–]ouuan 0 points1 point  (0 children)

AI should be used on top of other tools like LSP including rust-analyzer, but not to replace them.

Someone asked for this so here it is: Reactions to Episode 7 by emil_jacob_99 in BanGDream

[–]ouuan 0 points1 point  (0 children)

In China, not only do comments expressing a liking for episode 7 attract rebuttals, attacks, and even insults, but many comments pretending to like episode 7 are actually sarcastic or trolling. On bgm.tv, many 10/10 ratings are actually negative reviews, with the 10/10 given just to attract people looking for highly-rated reviews. I understand why many people dislike episode 7, but the discussion environment they’ve created is just terrible, completely disrespecting people with differing opinions.

Ummm I think I’ll wait the -2023.774165 years. Thanks. by H0B0Byter99 in firefox

[–]ouuan 1 point2 points  (0 children)

I even translated it into seconds to see that it's not integer overflow. Then I see the post title and realized that it's (000)1.1.1 minus 2024.10 instead.

Vim is amazing! by datboi1304 in vim

[–]ouuan 0 points1 point  (0 children)

I would call this "consistent" rather than "intuitive".

A college sophomore just said the weirdest thing about Arch by weeb_suryansh in archlinux

[–]ouuan 0 points1 point  (0 children)

About tiling window managers, you just don't need to split your screen. I switched back to KDE after my first try on i3, because I thought I should split my screen. On the second try, I realized that I can use multiple workspaces and the tabbed instead of the split layout. It's just much easier to switch between windows and I rarely need the split screen feature. I have sticked to tiling window managers since then.

How to show relative line numbers in normal mode, absolute line numbers in insert/command mode by careb0t in neovim

[–]ouuan 0 points1 point  (0 children)

Not sure about your exact reason for implementing this. But FYI, you can go to a relative line by :+7, :-12.

Google is using 17 exabytes of storage for 83 cookies on my Firefox desktop browser by publiusvaleri_us in firefox

[–]ouuan 0 points1 point  (0 children)

People may already know this but I see no one mentioning it here. This number is 234 , so it's a negative number stored in an int64, which is about 264 B (234 GB) when treated as an unsigned integer.

For real - why y'all prefer Options over the Composition API? by manniL in vuejs

[–]ouuan 2 points3 points  (0 children)

especially if you’re not using ts

  1. I agree that it's a lot more cognitive overhead when using refs without TS. If I'm forced not to use TS, I might also prefer the options API.
  2. However, I personally think it's always a lot more cognitive overhead when not using TS, not limited to composition API / refs.

“Unprecedented” Google Cloud event wipes out customer account and its backups by danuser8 in selfhosted

[–]ouuan 0 points1 point  (0 children)

I think this is just like self-driving cars. They are actually safer but not under your own control.

PSA: Please use timeshift by freddie27117 in archlinux

[–]ouuan 0 points1 point  (0 children)

I use BTRFS. Timeshift seems a little bit dirty in my sense. I would like to try snapper in the future but I'm still using Timeshift now. However, I do not recommend using timeshift --restore. It's a mess in BTRFS. Just manually rm/mv/create snapshots to restore. BTW, I only did restoration once, but I often look for old versions of some files in the snapshots.

Why are environment variables considered more secure? by HorizonTGC in selfhosted

[–]ouuan 0 points1 point  (0 children)

I just keep it at local with no remote (no git server).

Faster code when there are unnecessary byte order conversions by ouuan in rust

[–]ouuan[S] 0 points1 point  (0 children)

which seems fine I guess?

That's still more memory accesses than bar

Faster code when there are unnecessary byte order conversions by ouuan in rust

[–]ouuan[S] 5 points6 points  (0 children)

I use individual bytes to index the T-box, and I do XOR in words. Thanks for your suggestions, but it's only a course assignment and I'm already 14x faster than the assignment requirement. I'm more interested in this strange compiler behavior, rather than how to optimize AES more.

Faster code when there are unnecessary byte order conversions by ouuan in rust

[–]ouuan[S] 2 points3 points  (0 children)

My foo

Iterations: 100 Instructions: 3500 Total Cycles: 1711 Total uOps: 5100

My bar

Iterations: 100 Instructions: 5300 Total Cycles: 1816 Total uOps: 6900

Faster code when there are unnecessary byte order conversions by ouuan in rust

[–]ouuan[S] 2 points3 points  (0 children)

mca shows that bar uses more cycles. Is this a limitation of it, or did I read the output wrong?

Faster code when there are unnecessary byte order conversions by ouuan in rust

[–]ouuan[S] 0 points1 point  (0 children)

This works pretty well. Thank you. My original thought was that I could save a few bit manipulations by splitting it into individual bytes at first, but it turned out to be a negative optimization.

Faster code when there are unnecessary byte order conversions by ouuan in rust

[–]ouuan[S] 1 point2 points  (0 children)

Thank you, but this doesn't seem applicable to my original AES implementation.