A Company Forced Me to Code my Own HTTP Server in C

Sdílet
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

Komentáře • 151

  • @volbla
    @volbla Před 3 měsíci +844

    Ah yes, CRLF. Because we still need backwards compatibility with typewriters.

    • @olvasztar5956
      @olvasztar5956 Před 3 měsíci +38

      underrated comment

    • @MultsElMesco
      @MultsElMesco  Před 3 měsíci +97

      So true

    • @lucors-ch
      @lucors-ch Před 3 měsíci +6

      You make my day

    • @chigozie123
      @chigozie123 Před 3 měsíci +42

      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

    • @minhthinle2104
      @minhthinle2104 Před 3 měsíci +38

      ​@@chigozie123windows is not that far off from being a typewriter wdym

  • @ghostslikeme
    @ghostslikeme Před 3 měsíci +272

    so what?? am i supposed to act like i know whats going on??

  • @Julianiolo
    @Julianiolo Před 3 měsíci +145

    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)

    • @vatanak8146
      @vatanak8146 Před 3 měsíci

      Did u use fork for multithreading?

    • @Julianiolo
      @Julianiolo Před 3 měsíci

      @@vatanak8146 We also did a webserver with fork, although that would be called multiprocessing :)

    • @Ciborg085
      @Ciborg085 Před 2 měsíci

      ​@@vatanak8146fork creates a new process, not a thread

    • @Julianiolo
      @Julianiolo Před 2 měsíci +5

      @@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).

    • @BacklTrack
      @BacklTrack Před 2 měsíci +12

      Sounds like a pretty in depth course, damn.

  • @marxy37dev
    @marxy37dev Před 3 měsíci +116

    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)

  • @doce3609
    @doce3609 Před 2 měsíci +13

    Looks like an interesting platform.
    Loved the Gigguk clip

  • @bryangichuru9
    @bryangichuru9 Před 3 měsíci +22

    This is literal torture(for the developer) entertainment for us

  • @tuhkiscgibin6627
    @tuhkiscgibin6627 Před 3 měsíci +97

    Gotta love C strings.

    • @sassywoocooo
      @sassywoocooo Před 3 měsíci +4

      dude you need help

    • @tuhkiscgibin6627
      @tuhkiscgibin6627 Před 3 měsíci +27

      ​@@sassywoocoooI've spent two weeks mangling some good ol' char arrays! I need help; badly.

    • @memes_gbc674
      @memes_gbc674 Před 2 měsíci +3

      unfortunately there is no cure

    • @iulic9833
      @iulic9833 Před 2 měsíci +9

      strtok was the biggest mistake made by humanity probably

    • @antdorf0825
      @antdorf0825 Před 2 měsíci +4

      It's character building!

  • @MyWatermelonz
    @MyWatermelonz Před měsícem

    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.

  • @honokasawada9170
    @honokasawada9170 Před 2 měsíci +2

    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).

  • @kalebbruwer
    @kalebbruwer Před 2 měsíci +3

    Clicked on this for the function pointer. You just gotta love C...

  • @XCanG
    @XCanG Před 2 měsíci +4

    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.

  • @terabhaininja9
    @terabhaininja9 Před měsícem +1

    1:50 Omg is that detective conan ost? 😭 W CZcamsr or what.

  • @teodoraportase8737
    @teodoraportase8737 Před 3 měsíci +4

    I'm not well versed in C or creating servers, but this was fun and informative :)

  • @rajmajumdar5253
    @rajmajumdar5253 Před 3 měsíci +1

    Bro i just completed this in python, hats off to you, now i am stuck at routing .

  • @The_G_YT
    @The_G_YT Před 22 dny

    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.

  • @yihan4835
    @yihan4835 Před 2 měsíci +1

    That Fate/Zero BGM kicked in making anything appears more epic than it is.

  • @akialter
    @akialter Před 3 měsíci +5

    literally just finished a class project on this so I understand the struggle 😭

  • @rijugamerplayzzz1164
    @rijugamerplayzzz1164 Před měsícem +1

    4:27 bro just roasted Java in a minute

  • @cylian8422
    @cylian8422 Před 3 měsíci +13

    Wasn't expecting gigguk in here

  • @ricardovaleriocarera436
    @ricardovaleriocarera436 Před 2 měsíci +1

    K-on soundtrack = new subscriber

  • @bombzxo
    @bombzxo Před 10 dny

    my right ear loved that

  • @xravenx24fe
    @xravenx24fe Před měsícem

    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.

  • @casperx102
    @casperx102 Před 2 měsíci +1

    how you manage to find all the songs/soundtracks to fill the whole video is astounding, and they're all good 🎉

    • @MultsElMesco
      @MultsElMesco  Před 2 měsíci +2

      Just a lot of googling/youtube time. I'm glad you liked them!

  • @libredove
    @libredove Před 2 měsíci +5

    Now implement TLS.

  • @enesguler6034
    @enesguler6034 Před měsícem

    Now its time to do the same shit in assembly :D

  • @frann8487
    @frann8487 Před 2 měsíci +1

    yo bro can I get the font that you're using in vscode?
    Looks really cool

  • @truestbluu
    @truestbluu Před 2 měsíci

    eek, also long time no see :)

  • @TheLegendaryHacker
    @TheLegendaryHacker Před 2 měsíci +1

    Is that Cyber Sleuth music????? Ayy lmao

  • @giorgos-4515
    @giorgos-4515 Před 2 měsíci

    as somebody that is tired of just using everything from a library, this platform is quite interesting.

  • @MrMultiDesigner
    @MrMultiDesigner Před 3 měsíci

    bro get data and was impressed that he actually got the data

  • @yxyk-fr
    @yxyk-fr Před 2 měsíci +3

    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.

    • @michalsvihla1403
      @michalsvihla1403 Před 2 měsíci

      I was taught Pascal in highschool and I gave up. Idk what you're on about...

    • @yxyk-fr
      @yxyk-fr Před 2 měsíci

      @@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.

    • @michalsvihla1403
      @michalsvihla1403 Před 2 měsíci

      @@yxyk-fr Well, if you dislike C, I can't imagine what your relationship with Python is. 😂

    • @yxyk-fr
      @yxyk-fr Před 2 měsíci

      @@michalsvihla1403 it's a totally different subject.

  • @tanja_the_fox
    @tanja_the_fox Před měsícem

    I wrote a http server myself recently. I could relate so fucking hard when it downloaded the response body

  • @bundlesofun9568
    @bundlesofun9568 Před 2 měsíci

    That thumb-nail had me 😂

  • @codegenesis2130
    @codegenesis2130 Před 2 měsíci +1

    Hi great video bro💖
    Can you please tell me which VS Code theme you are using?

    • @MultsElMesco
      @MultsElMesco  Před 2 měsíci +1

      Thank you bro!
      I changed my theme since then but I believe the name of it was Tokyo Night

    • @attilamiszkuly5868
      @attilamiszkuly5868 Před měsícem

      @@MultsElMesco Hey man! What theme did you changed it to?

  • @rodolphov.santoro8829
    @rodolphov.santoro8829 Před 3 měsíci +1

    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).

  • @music4life467
    @music4life467 Před 2 měsíci +1

    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....

  • @vadiks20032
    @vadiks20032 Před 2 měsíci

    wait where is the part where you make a server that puts clients to the queue and stuff

  • @GingerNingerish
    @GingerNingerish Před 3 měsíci

    pog

  • @theMadZakuPilot
    @theMadZakuPilot Před měsícem

    what VScode theme are you using bro?

  • @himalayo
    @himalayo Před 2 měsíci +1

    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.

  • @Scriabinfan593
    @Scriabinfan593 Před 3 měsíci

    What theme are you using on VScode ? I've never seen that before.

    • @MultsElMesco
      @MultsElMesco  Před 2 měsíci

      I think it was Tokyo Night or a variation of that one

  • @nowaynoway1798
    @nowaynoway1798 Před 3 měsíci +5

    now next step is to benchmark it against a python http server

    • @MultsElMesco
      @MultsElMesco  Před 3 měsíci +1

      I was planning on doing that but I didn't want to make the video longer hahaha

    • @PraiseYeezus
      @PraiseYeezus Před 2 měsíci

      @@MultsElMesco did you ever check it out? I'm curious of the performance difference if there is any

  • @illegalsmirf
    @illegalsmirf Před 2 měsíci

    Cool story bro

  • @Ski4974
    @Ski4974 Před 2 měsíci +4

    Unreviewed ai generated docs? Doesn't sound good at all

  • @sassywoocooo
    @sassywoocooo Před 3 měsíci

    which website are you using

  • @jungervin8765
    @jungervin8765 Před 3 měsíci +1

    Now implement TLS 1.3, and this could be used in production already.

  • @Fazehamster69
    @Fazehamster69 Před měsícem

    1:44 i had a *strtok* reading this

  • @user-zo1kn8ob7h
    @user-zo1kn8ob7h Před 2 měsíci

    1:35 this is how you earn a thumbs up good show good sir may susan's algwhorithm smile on you

  • @ozkarandresespinozapaolett7609

    LETS GOOOOOO

  • @Zooiest
    @Zooiest Před 2 měsíci

    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 ☝️🤓

  • @XxProGamerUSAxX
    @XxProGamerUSAxX Před 3 měsíci +3

    :btools me

  • @Atlas-Coder
    @Atlas-Coder Před měsícem

    What font do you use please?

    • @MultsElMesco
      @MultsElMesco  Před 28 dny

      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

  • @samuelbarber5097
    @samuelbarber5097 Před 2 měsíci

    they were correct for making you.

  • @_Leaf53
    @_Leaf53 Před 3 měsíci +3

    im trying to code in C# and... i dont know, my brain hurt

    • @mrx6555
      @mrx6555 Před 3 měsíci +3

      Thats what you get from choosing such a language

    • @kerojey4442
      @kerojey4442 Před 3 měsíci +1

      ​@@TapetBart No he wont

    • @casperx102
      @casperx102 Před 2 měsíci +2

      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.

  • @NithinJune
    @NithinJune Před 2 měsíci +5

    2:48 The guides are AI generated?? fuck that you just sold me to never use this platform

  • @iogilarb
    @iogilarb Před 3 měsíci +1

    Can i do with other lang?

  • @valseedian
    @valseedian Před měsícem

    guy uses fork in 2024.
    good watch though

  • @justcurious1940
    @justcurious1940 Před 2 měsíci

    What language should I learni to get a job in 1year?

    • @miyu545
      @miyu545 Před 2 měsíci

      Python is a good option. C# is another.

  • @KyleGarzon-gx3hd
    @KyleGarzon-gx3hd Před 2 měsíci

    Bro i can't even make a string in C how tf do you do this

  • @AlFasGD
    @AlFasGD Před 2 měsíci

    Gone are the days where I had to write C for university. It is now your time to suffer

  • @jansustar4565
    @jansustar4565 Před 3 měsíci +4

    now make a HTTPS server

    • @miyu545
      @miyu545 Před 2 měsíci

      It's pretty much the same thing. Different port. A few added requirements.

  • @dogshome8658
    @dogshome8658 Před 3 měsíci

    When there is Windows version

  • @sussypointer
    @sussypointer Před 2 měsíci

    KIZU OST

  • @varwinchik
    @varwinchik Před 2 měsíci

    Varwin

  • @TrueSQN
    @TrueSQN Před měsícem

    Sub! Great video but IMO a little bit too fast. I literally checked if i have 1.25x setting on speed.

  • @FaZekiller-qe3uf
    @FaZekiller-qe3uf Před 2 měsíci

    But processes are slow 😭

  • @Entropia404
    @Entropia404 Před měsícem

    C Pointer = Troubles

  • @Skult1
    @Skult1 Před 3 měsíci +12

    Skill issue

  • @nefton001
    @nefton001 Před měsícem

    only 1 thread? and most impotant - need owerlaped socket, cause windows tcp/ip - not enought reliable

  • @Vitaxses
    @Vitaxses Před 3 měsíci

    Well..

  • @thepuppetqueen57
    @thepuppetqueen57 Před 5 dny

    the only good programming lanuages to make http servers in is php and nodejs and maybe python

  • @yt-spikegaming7394
    @yt-spikegaming7394 Před 2 měsíci

    I did it for fun 💀😞

  • @yogxoth1959
    @yogxoth1959 Před 2 měsíci +1

    You should’ve read The Bible before making this video (aka Beej’s guide to networking) ;^)

  • @gustavojoaquin_arch
    @gustavojoaquin_arch Před 3 měsíci

    XD

  • @Kyoz
    @Kyoz Před 3 měsíci

    🤍

  • @anonyaro9789
    @anonyaro9789 Před 2 měsíci

    C++ > C

  • @FaZekiller-qe3uf
    @FaZekiller-qe3uf Před 2 měsíci

    C strings are simple. You're confusing "hard" with "complex."

    • @himalayo
      @himalayo Před 2 měsíci

      they are simple in its structure but complex in its algorithms

  • @laughingvampire7555
    @laughingvampire7555 Před 2 měsíci

    anything that isn't C is gay

  • @KaradevNetLtd
    @KaradevNetLtd Před 2 měsíci

    next time you make video, get down off this stupid background music !!!!