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

Поділитися
Вставка
  • Опубліковано 10 чер 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...
  • Розваги

КОМЕНТАРІ • 153

  • @volbla
    @volbla 3 місяці тому +858

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

    • @olvasztar5956
      @olvasztar5956 3 місяці тому +40

      underrated comment

    • @MultsElMesco
      @MultsElMesco  3 місяці тому +99

      So true

    • @lucors-ch
      @lucors-ch 3 місяці тому +6

      You make my day

    • @chigozie123
      @chigozie123 3 місяці тому +43

      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 3 місяці тому +39

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

  • @ghostslikeme
    @ghostslikeme 3 місяці тому +277

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

  • @Julianiolo
    @Julianiolo 3 місяці тому +146

    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 3 місяці тому

      Did u use fork for multithreading?

    • @Julianiolo
      @Julianiolo 3 місяці тому

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

    • @Ciborg085
      @Ciborg085 3 місяці тому

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

    • @Julianiolo
      @Julianiolo 3 місяці тому +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 2 місяці тому +12

      Sounds like a pretty in depth course, damn.

  • @marxy37dev
    @marxy37dev 3 місяці тому +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)

  • @bryangichuru9
    @bryangichuru9 3 місяці тому +21

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

  • @doce3609
    @doce3609 3 місяці тому +15

    Looks like an interesting platform.
    Loved the Gigguk clip

  • @tuhkiscgibin6627
    @tuhkiscgibin6627 3 місяці тому +97

    Gotta love C strings.

    • @sassywoocooo
      @sassywoocooo 3 місяці тому +4

      dude you need help

    • @tuhkiscgibin6627
      @tuhkiscgibin6627 3 місяці тому +27

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

    • @memes_gbc674
      @memes_gbc674 2 місяці тому +3

      unfortunately there is no cure

    • @iulic9833
      @iulic9833 2 місяці тому +9

      strtok was the biggest mistake made by humanity probably

    • @antdorf0825
      @antdorf0825 2 місяці тому +4

      It's character building!

  • @MyWatermelonz
    @MyWatermelonz 2 місяці тому

    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 2 місяці тому +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 2 місяці тому +3

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

  • @XCanG
    @XCanG 2 місяці тому +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 Місяць тому +2

    1:50 Omg is that detective conan ost? 😭 W UA-camr or what.

  • @teodoraportase8737
    @teodoraportase8737 3 місяці тому +4

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

  • @rajmajumdar5253
    @rajmajumdar5253 3 місяці тому +1

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

  • @yihan4835
    @yihan4835 2 місяці тому +1

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

  • @The_G_YT
    @The_G_YT Місяць тому

    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.

  • @akialter
    @akialter 3 місяці тому +4

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

  • @xravenx24fe
    @xravenx24fe Місяць тому

    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.

  • @bombzxo
    @bombzxo 19 днів тому

    my right ear loved that

  • @ricardovaleriocarera436
    @ricardovaleriocarera436 2 місяці тому +1

    K-on soundtrack = new subscriber

  • @cylian8422
    @cylian8422 3 місяці тому +13

    Wasn't expecting gigguk in here

  • @rijugamerplayzzz1164
    @rijugamerplayzzz1164 Місяць тому +1

    4:27 bro just roasted Java in a minute

  • @bundlesofun9568
    @bundlesofun9568 3 місяці тому

    That thumb-nail had me 😂

  • @truestbluu
    @truestbluu 2 місяці тому

    eek, also long time no see :)

  • @frann8487
    @frann8487 2 місяці тому +1

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

  • @casperx102
    @casperx102 3 місяці тому +1

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

    • @MultsElMesco
      @MultsElMesco  2 місяці тому +2

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

  • @giorgos-4515
    @giorgos-4515 2 місяці тому

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

  • @ozkarandresespinozapaolett7609
    @ozkarandresespinozapaolett7609 3 місяці тому

    LETS GOOOOOO

  • @MrMultiDesigner
    @MrMultiDesigner 3 місяці тому

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

  • @rodolphov.santoro8829
    @rodolphov.santoro8829 3 місяці тому +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).

  • @libredove
    @libredove 3 місяці тому +5

    Now implement TLS.

  • @music4life467
    @music4life467 2 місяці тому +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....

  • @codegenesis2130
    @codegenesis2130 3 місяці тому +1

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

    • @MultsElMesco
      @MultsElMesco  2 місяці тому +1

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

    • @attilamiszkuly5868
      @attilamiszkuly5868 Місяць тому

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

  • @tanja_the_fox
    @tanja_the_fox 2 місяці тому

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

  • @vadiks20032
    @vadiks20032 2 місяці тому

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

  • @yxyk-fr
    @yxyk-fr 2 місяці тому +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 2 місяці тому

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

    • @yxyk-fr
      @yxyk-fr 2 місяці тому

      @@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 2 місяці тому

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

    • @yxyk-fr
      @yxyk-fr 2 місяці тому

      @@michalsvihla1403 it's a totally different subject.

  • @enesguler6034
    @enesguler6034 Місяць тому

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

  • @TheLegendaryHacker
    @TheLegendaryHacker 3 місяці тому +1

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

  • @GingerNingerish
    @GingerNingerish 3 місяці тому

    pog

  • @nowaynoway1798
    @nowaynoway1798 3 місяці тому +5

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

    • @MultsElMesco
      @MultsElMesco  3 місяці тому +1

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

    • @PraiseYeezus
      @PraiseYeezus 2 місяці тому

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

  • @sassywoocooo
    @sassywoocooo 3 місяці тому

    which website are you using

  • @illegalsmirf
    @illegalsmirf 3 місяці тому

    Cool story bro

  • @theMadZakuPilot
    @theMadZakuPilot 2 місяці тому

    what VScode theme are you using bro?

  • @Scriabinfan593
    @Scriabinfan593 3 місяці тому

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

    • @MultsElMesco
      @MultsElMesco  2 місяці тому

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

  • @jungervin8765
    @jungervin8765 3 місяці тому +1

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

  • @Fazehamster69
    @Fazehamster69 Місяць тому

    1:44 i had a *strtok* reading this

  • @Zooiest
    @Zooiest 3 місяці тому

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

  • @himalayo
    @himalayo 2 місяці тому +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.

  • @user-zo1kn8ob7h
    @user-zo1kn8ob7h 2 місяці тому

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

  • @Ski4974
    @Ski4974 3 місяці тому +4

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

  • @iogilarb
    @iogilarb 3 місяці тому +1

    Can i do with other lang?

  • @XxProGamerUSAxX
    @XxProGamerUSAxX 3 місяці тому +3

    :btools me

  • @justcurious1940
    @justcurious1940 3 місяці тому

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

    • @miyu545
      @miyu545 2 місяці тому

      Python is a good option. C# is another.

  • @_Leaf53
    @_Leaf53 3 місяці тому +3

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

    • @mrx6555
      @mrx6555 3 місяці тому +3

      Thats what you get from choosing such a language

    • @kerojey4442
      @kerojey4442 3 місяці тому +1

      ​@@TapetBart No he wont

    • @casperx102
      @casperx102 3 місяці тому +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.

  • @Atlas-Coder
    @Atlas-Coder Місяць тому

    What font do you use please?

    • @MultsElMesco
      @MultsElMesco  Місяць тому

      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 2 місяці тому

    they were correct for making you.

  • @KyleGarzon-gx3hd
    @KyleGarzon-gx3hd 2 місяці тому

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

  • @AlFasGD
    @AlFasGD 3 місяці тому

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

  • @Vitaxses
    @Vitaxses 3 місяці тому

    Well..

  • @sussypointer
    @sussypointer 2 місяці тому

    KIZU OST

  • @FaZekiller-qe3uf
    @FaZekiller-qe3uf 2 місяці тому

    But processes are slow 😭

  • @TrueSQN
    @TrueSQN 2 місяці тому

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

  • @jansustar4565
    @jansustar4565 3 місяці тому +4

    now make a HTTPS server

    • @miyu545
      @miyu545 2 місяці тому

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

  • @thepuppetqueen57
    @thepuppetqueen57 14 днів тому

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

  • @dogshome8658
    @dogshome8658 3 місяці тому

    When there is Windows version

  • @varwinchik
    @varwinchik 3 місяці тому

    Varwin

  • @valseedian
    @valseedian 2 місяці тому

    guy uses fork in 2024.
    good watch though

  • @nefton001
    @nefton001 2 місяці тому

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

  • @Entropia404
    @Entropia404 2 місяці тому

    C Pointer = Troubles

  • @gustavojoaquin_arch
    @gustavojoaquin_arch 3 місяці тому

    XD

  • @yt-spikegaming7394
    @yt-spikegaming7394 2 місяці тому

    I did it for fun 💀😞

  • @Skult1
    @Skult1 3 місяці тому +13

    Skill issue

  • @NithinJune
    @NithinJune 3 місяці тому +5

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

  • @Kyoz
    @Kyoz 3 місяці тому

    🤍

  • @yogxoth1959
    @yogxoth1959 3 місяці тому +1

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

  • @anonyaro9789
    @anonyaro9789 2 місяці тому

    C++ > C

  • @FaZekiller-qe3uf
    @FaZekiller-qe3uf 2 місяці тому

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

    • @himalayo
      @himalayo 2 місяці тому

      they are simple in its structure but complex in its algorithms

  • @laughingvampire7555
    @laughingvampire7555 2 місяці тому

    anything that isn't C is gay

  • @KaradevNetLtd
    @KaradevNetLtd 2 місяці тому

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