6 ms·
Tutorial: HTTP Client in C with libdill
- bfred_it 9y agoIf this is wget, my bicycle is a car. This isn't "Wget in 50 lines of C code", just `wget --help` page is 192 lines.
- dewey 9y agoIt’s just the title that’s a bit simplified. First paragraph already says: “This tutorial is meant as an introduction to libdill socket library. We are going to develop a simple version of wget utility, that can be used to download webpages from the net.”
- moosekaka 9y agoa bit simplified? title would be considered clickbait if it were a webpage.
- mandelbulb 9y agoEditorialized clickbait from the HN user, that is. The original is just fine.
- scsh 9y agoApparently the author and HN user are the same person.
- mandelbulb 9y agoOh, wow! Indeed. That's disappointing.
- yeowMeng 9y agoIt’s a mvp wget clone.
- irundebian 9y ago+k lines of libdill.c
- wereHamster 9y ago… and don't forget libc!
- taneq 9y agoYou can't conflate using a special-purpose library with using a fundamental dependency like libc. It's like claiming you "rewrote Quake in 2 lines" then posting a .bat file with the contents "echo Starting quake lol...\r\nquake.exe"
- rootlocus 9y ago... and don't forget the OS. It's a deep rabbit hole.
- z3t4 9y agoIt's all abstractions and sometimes concretions. Then there's leaky abstractions where you need to know details of the implementation in order to use it.
- squarefoot 9y agoActually one could go without that library and code would not be that much bigger. To me it seems it provides an easier way to open secure pages through TLS, but if all one needs is sockets communicating each other, then the usual network libraries are more than enough. Ages ago I've written C network code under Linux that compiled and run under Windows just by changing a couple lines. Not sure if that would be doable today though: at that time Microsoft was forced to include a POSIX compatibility layer, and Winsock itself was not that far from the classic UNIX implementation.
- Aissen 9y agolibdill looks interesting, but I'm a bit surprised by the lack of prefix in the functions, types, etc. C does not have namespaces, but open source libraries usually use short prefixes for readability. What do you think ?
- anonfunction 9y agoPort to Golang using stdlib: https://play.golang.org/p/vXTpR9IjBxV https://play.golang.org/p/vXTpR9IjBxV
- xstartup 9y agowget has a default read timeout of 900s, yours has no timeout.
- Skunkleton 9y agoIt is disingenuous to plug your own library with a click bait title and no indication that you are the author.
- JepZ 9y agoThose titles suck. Next week I post my 'Wget in 2 lines of Bash code': #!/usr/bin/env bash curl "${@:2}" I mean, if you use a lib it is no wonder you have a low line count and the result is in fact as much Wget as curl is wget (probably even less). How about 'Tutorial: HTTP Client in C with libdill'?
- dang 9y agoOK, changed. Thanks!
- teacpde 9y agoIt would be interesting to see a performance comparison between libdill and goroutine for concurrent network requests.
- FraKtus 9y agoWhat is the difference with libcurl ?
- usr1106 9y agolibdill is about concurrency made easy (according to the home page). But this tutorial has no concurrency as far as I can see after a quick read. That's a bit weird way introducing a library.