A Company Forced Me to Code my Own HTTP Server in C
Vložit
- čas přidán 31. 05. 2024
- Programming in C might be very daunting, but it's also pretty fun :)
Check out CodeCrafters at app.codecrafters.io/join?via=...
The code I used for this video: github.com/IonelPopJara/http-...
Check out my socials:
/ ionelalexandr12
Music used in this video:
- TMNT 4 (SNES) Music: Big Apple, 3 A.M: • TMNT 4 (SNES) Music: B...
- Daisy Circuit // Naz3nt Future Funk Remix: • Daisy Circuit // Naz3n...
- Let The Stars Fall Down-Live Arrange Version: • Let The Stars Fall Dow...
- The Cyber Sleuth: Digimon Story Cyber Sleuth • The Cyber Sleuth - Dig...
- Dark Souls III Soundtrack OST Vordt of the Boreal Valley: • Video
- Kizumonogatari II ost Bad Bully: • Kizumonogatari II ost ...
- Detective Conan Main Theme: • Detective Conan Main T...
- TMNT 4 (SNES) Music: Going Up: • TMNT 4 (SNES) Music: G...
- Ending Theme - Super Mario: World: • Ending Theme - Super M...
- Listen!!: • Listen!!
- Mega Man X OST - T02: Title: • Mega Man X OST - T02: ...
- TMNT 4 (SNES) Music: Alleycat Blues: • TMNT 4 (SNES) Music: A...
- Megaman X - Flame Mammoth Stage: • Megaman X - Flame Mamm...
- Babylonia: • Babylonia
- TMNT 4 (SNES) Music: Sewer Surfin': • TMNT 4 (SNES) Music: S...
- Still, Move Forward! - Super Smash Bros. Ultimate: • Still, Move Forward! -...
- ミカヅキBIGWAVE - Emotional Prism 感情的なプリズム: • ミカヅキBIGWAVE - Emotiona... - Zábava
Ah yes, CRLF. Because we still need backwards compatibility with typewriters.
underrated comment
So true
You make my day
If by typewriter, you mean Windows, then yes.
On a serious note, the specification does allow implementations to just parse LF and ignore the leading CR
@@chigozie123windows is not that far off from being a typewriter wdym
so what?? am i supposed to act like i know whats going on??
Don't feel bad. He skipped over basically everything.
me too
In my cs class we had to (amongst other things) program a http server in plain c with nothing but some library functions for html boilerplate. This included multithreading, handling signals, executing programs by the server and listing directories (also displaying files ofc). Everything had to be error handled according to the exact man-page specs, and code had to be clean and readable. Was kinda fun though lol. (we also programmed a smtp client, a linux find kind of program and some other stuff)
Did u use fork for multithreading?
@@vatanak8146 We also did a webserver with fork, although that would be called multiprocessing :)
@@vatanak8146fork creates a new process, not a thread
@@vatanak8146 ok I'm like 99% sure I already responded to this, but I don't my message anymore?? Yes I used both fork and threads (pthread) for multithreading (although using fork would be called multiprocessing (afaik) bc we use multiple processes not threads). We had to implement different versions and some used fork and some used threads (pthread).
Sounds like a pretty in depth course, damn.
Oh boy, i didn't even started watching the vid and i already know this will be fun (for us, for mults will be pain)
I was haha
Looks like an interesting platform.
Loved the Gigguk clip
This is literal torture(for the developer) entertainment for us
Gotta love C strings.
dude you need help
@@sassywoocoooI've spent two weeks mangling some good ol' char arrays! I need help; badly.
unfortunately there is no cure
strtok was the biggest mistake made by humanity probably
It's character building!
One of my first projects i ever did was this, as well as socket connections from beeg's guide. Learned quite a lot doing it all in C. Tracking down some weird buffering issue with sending messages over the socket connection was fun, since it wasnt an error, but just a specific part of how windows handled buffering with a specific function.
Just from 2 minutes into the video I can tell this is a great way to learn about test driven development (although the platform is the one creating the tests).
Clicked on this for the function pointer. You just gotta love C...
The reason you downloaded file is because of MIME type. Browser show only a few types to the user: text/html, plain/text, may be a few others plus images and video formats, but they would be wrapped as image or in video player (and if content is wrong show error), pdf. So, for anyone else browser just download file. There is also a neutral format application/octet-stream that is used for any file format (text, HTML, images, video, etc.) when you want to tell browser to force download file instead of showing it.
1:50 Omg is that detective conan ost? 😭 W CZcamsr or what.
I'm not well versed in C or creating servers, but this was fun and informative :)
Bro i just completed this in python, hats off to you, now i am stuck at routing .
The reason the .txt file was downloaded instead of displayed is because of the MIME type you're sending in the header. Basically if you tell the browser what file you're sending it will display it if it's able to, for example using "video/mp4" as the MIME type when sending a video file will make the browser show it in the player.
That Fate/Zero BGM kicked in making anything appears more epic than it is.
literally just finished a class project on this so I understand the struggle 😭
4:27 bro just roasted Java in a minute
Wasn't expecting gigguk in here
K-on soundtrack = new subscriber
my right ear loved that
C is super fun. It has some idiosyncracies but once you get the basic syntax down, you got if statements, for loops, big bad pointers and arrays and suddenly you can create a LOT of stuff.
how you manage to find all the songs/soundtracks to fill the whole video is astounding, and they're all good 🎉
Just a lot of googling/youtube time. I'm glad you liked them!
Now implement TLS.
Now its time to do the same shit in assembly :D
yo bro can I get the font that you're using in vscode?
Looks really cool
eek, also long time no see :)
Is that Cyber Sleuth music????? Ayy lmao
Yes!
as somebody that is tired of just using everything from a library, this platform is quite interesting.
bro get data and was impressed that he actually got the data
I have written my own HTTP server in C
I was already pretty good in this language and all.
But now I realize how much C and POSIX are braindead.
I feel blessed that I learned programming with Turbo Pascal back in the Olden Golden days, or I'd have given up already.
I was taught Pascal in highschool and I gave up. Idk what you're on about...
@@michalsvihla1403 well, all I can say is that's sad.
Back in tne mid-90s, Borland was pure awesome (compact, practical, powerful, very well supported, affordable...) and i'm sad that the more powerful but less practical GCC dethroned it.
Turbo Pascal would fit in one diskette and despite the limitations (due to the MS-DOS platform) it was a sane, useful platform.
Character strings were not a hassle with tons of caveats.
Then I was forced to switch to C. OMG what a mess in comparison.
@@yxyk-fr Well, if you dislike C, I can't imagine what your relationship with Python is. 😂
@@michalsvihla1403 it's a totally different subject.
I wrote a http server myself recently. I could relate so fucking hard when it downloaded the response body
That thumb-nail had me 😂
Hi great video bro💖
Can you please tell me which VS Code theme you are using?
Thank you bro!
I changed my theme since then but I believe the name of it was Tokyo Night
@@MultsElMesco Hey man! What theme did you changed it to?
Hey, i've just done something similar this month, after spending years without doing any c network coding. Except i learnt about how you do single threaded async(i used select).
last year i build my own http server in c , i also try it in the cython , which i easily port it, i also try it in VBnet and it all working... when i try to use it as a production on my project it working fine, but there are different in most of the http server that is currently stable like nginx and apache, my http server must have a optimization like gpu or cpu... so i stopped the http server because of work overload... i have to time to continue optimizating my http server , until i created my own websocket server and it working.. .. but all of them i stopped,, i ask my self why re invent the wheel if there is existing .... but those project i try it because i want to understand how http or networking work....
wait where is the part where you make a server that puts clients to the queue and stuff
pog
pog indeed
what VScode theme are you using bro?
I think the main issue you faced was that you were hardcoding everything. If you were to generalize your code you probably would of have had an easier time.
What theme are you using on VScode ? I've never seen that before.
I think it was Tokyo Night or a variation of that one
now next step is to benchmark it against a python http server
I was planning on doing that but I didn't want to make the video longer hahaha
@@MultsElMesco did you ever check it out? I'm curious of the performance difference if there is any
Cool story bro
Unreviewed ai generated docs? Doesn't sound good at all
which website are you using
Now implement TLS 1.3, and this could be used in production already.
1:44 i had a *strtok* reading this
1:35 this is how you earn a thumbs up good show good sir may susan's algwhorithm smile on you
LETS GOOOOOO
W-well, ackshually, if the server doesn't conform fully to the specification put forth by the IETF, it doesn't count as a proper HTTP server, but rather an entirely different protocol ☝️🤓
:btools me
What font do you use please?
Caskaydia Cove Nerd Font, you can find it here www.nerdfonts.com/font-downloads . If you've never used a nerd font it takes a bit of setup to install
they were correct for making you.
im trying to code in C# and... i dont know, my brain hurt
Thats what you get from choosing such a language
@@TapetBart No he wont
C# is good tho. I once implemented a basic web server with websocket support with it. its syntax is enjoyable and not cumbersome like other language i've used before.
2:48 The guides are AI generated?? fuck that you just sold me to never use this platform
Can i do with other lang?
Nope impossible
guy uses fork in 2024.
good watch though
What language should I learni to get a job in 1year?
Python is a good option. C# is another.
Bro i can't even make a string in C how tf do you do this
Gone are the days where I had to write C for university. It is now your time to suffer
now make a HTTPS server
It's pretty much the same thing. Different port. A few added requirements.
When there is Windows version
KIZU OST
Varwin
Sub! Great video but IMO a little bit too fast. I literally checked if i have 1.25x setting on speed.
But processes are slow 😭
C Pointer = Troubles
Skill issue
puros zarapos
only 1 thread? and most impotant - need owerlaped socket, cause windows tcp/ip - not enought reliable
Well..
the only good programming lanuages to make http servers in is php and nodejs and maybe python
I did it for fun 💀😞
You should’ve read The Bible before making this video (aka Beej’s guide to networking) ;^)
XD
XD
🤍
C++ > C
C strings are simple. You're confusing "hard" with "complex."
they are simple in its structure but complex in its algorithms
anything that isn't C is gay
next time you make video, get down off this stupid background music !!!!