Live data from Hacker News

Uses for cURL

httpkit.com

51–60 of 75 posts

Re: Uses for cURL

#51
I can add -I parameter to these. It sends a HEAD request, which only returns headers, works better when you don't need the response body as in -i.

Re: Uses for cURL

#52

Why do people like cURL? I've regularly found it to have stupid defaults compared to wget. Is it because it's default on Mac and wget isn't?

cURL is worth learning in my experience because it is bulletproof, ubiquitous, fast, highly-configurable, and comprehensive. No other option listed in here are all of those things, though they are all easier to use. But start talking about SOCKS5 proxies or FTPS and all of a sudden you have to start monkey patching your (pretty) tool or, you know, learning curl.

Seriously how often are you guys performing PUTs and DELETEs manually from the command line? `man` up and write a wrapper.

Re: Uses for cURL

#54

I would strongly suggest HTTPie for the majority of these tasks: https://github.com/jkbr/httpie

Strongly agree. For Windows users like me, i recommend installing Python and Pip using Chocolatey Nuget and then doing a `pip install httpie` to avoid Windows Python dependency hell and still get httpie.

Re: Uses for cURL

#55
post #22

I hope tomorrow I'll see an even more useful article on sending email from the command line! Wow. /sarcasm

I'd be interested to know exactly what you mean (I usually don't really get sarcasm). It seems that you think this advice is useless, or that people never use the command line, or something, but I don't really know what. Could you be more specific? I find it useful to understand different points of view. Thanks

From the guidelines: On-Topic: Anything that good hackers would find interesting.

My guess is that caludio believes that good hackers would not find this article interesting. I somewhat agree, as I feel that article adds little to what can already be found in the cURL man page. Having said that, I do think there is worth in having good examples, which this article certainly did.

It's a little disheartening to see this at the top of HN though.

Re: Uses for cURL

#56
post #5

> If you only care about headers use the -I flag and the response body will be hidden That is actually wrong. The -I flag set the request method to HEAD. So in some cases it will return different headers than a normal get request (and some servers don't implement HEAD responses at all).

That's why I have this in the shell config and use it daily:

  alias h='curl -sIX GET -w "Total time: %{time_total} s\n"'
It issues a GET request, only prints the response headers and displays the time it took.

Re: Uses for cURL

#57
post #53

Earlier quoted context omitted.

'nc localhost 80' FTFY

exec 5 "/dev/tcp/localhost/80" echo -ne "GET / HTTP/1.1\r\nHost: localhost\r\n\r\n" > &5 cat FTFY

Clever, though nc really is better than telnet. It is much easier to pipe into just for starters.

Re: Uses for cURL

#58
> Test Virtual Hosts, Avoid DNS

> With cURL just point the request at your host’s IP address

It's not even necessary to manually look up the IP, since options have precedence:

  curl server1.example.com -H Host:\ www.example.net
looks up server1.example.com and connects to that IP with the given Host: Header. Just try the "-v" option to see what's going on.

Re: Uses for cURL

#59
post #48

The site does not work on the iPhone at all if you want to zoom in to read the text. If you start to touch and scroll the menu that was hidden away on the left decides to rear its ugly head and makes the site completely unreadable. I'm pretty frustrated with sites that don't just have a basic two column layout. Is this a template theme? Otherwise why would you waste so much time on a left column that reflows and mess…

Thanks for the heads up. Made a quick fix by taking out affix on the column. Tried to get this up pretty quickly with Bootstrap, need to spend some more time on it this weekend. Sorry for the annoyance.

Re: Uses for cURL

#60
post #33

Earlier quoted context omitted.

I'd be interested to know exactly what you mean (I usually don't really get sarcasm). It seems that you think this advice is useless, or that people never use the command line, or something, but I don't really know what. Could you be more specific? I find it useful to understand different points of view. Thanks

Site is "Hacker News", not "How-tos for dummies", last time I checked. Do we really need this kind of stuff in home page? Hardly so. What about an article on how to create a three columns layout with CSS? Or how to edit a file using a text editor? Come on... how to use curl? Really?

Not every hacker knows every tool well. I wouldn't sweat it.
Post reply on HN