From 30271843fe50f2aaffba0bafcf0a583717308fee Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Thu, 1 May 2014 09:59:37 -0400 Subject: [PATCH] finish slides --- slides/{1_intro.md => 01_intro.md} | 2 +- .../{2_what_is_curl.md => 02_what_is_curl.md} | 4 ++-- ...quick_examples.md => 03_quick_examples.md} | 0 .../{4_helpful_args.md => 04_helpful_args.md} | 3 ++- .../{5_dowload_file.md => 05_dowload_file.md} | 6 +++--- slides/{6_head.md => 06_head.md} | 6 +++--- slides/{7_cookies.md => 07_cookies.md} | 6 +++--- slides/08_redirects.md | 19 +++++++++++++++++ slides/09_http_post.md | 19 +++++++++++++++++ slides/10_post_file.md | 21 +++++++++++++++++++ slides/11_ssl.md | 16 ++++++++++++++ slides/12_learn_more.md | 12 +++++++++++ 12 files changed, 101 insertions(+), 13 deletions(-) rename slides/{1_intro.md => 01_intro.md} (72%) rename slides/{2_what_is_curl.md => 02_what_is_curl.md} (91%) rename slides/{3_quick_examples.md => 03_quick_examples.md} (100%) rename slides/{4_helpful_args.md => 04_helpful_args.md} (72%) rename slides/{5_dowload_file.md => 05_dowload_file.md} (60%) rename slides/{6_head.md => 06_head.md} (70%) rename slides/{7_cookies.md => 07_cookies.md} (82%) create mode 100644 slides/08_redirects.md create mode 100644 slides/09_http_post.md create mode 100644 slides/10_post_file.md create mode 100644 slides/11_ssl.md create mode 100644 slides/12_learn_more.md diff --git a/slides/1_intro.md b/slides/01_intro.md similarity index 72% rename from slides/1_intro.md rename to slides/01_intro.md index d1c1df6..c617277 100644 --- a/slides/1_intro.md +++ b/slides/01_intro.md @@ -2,4 +2,4 @@ class: center,middle # cURL ### [brettlangdon](http://brett.is) | [Shapeways](https://www.shapeways.com) - http://brettlangdon.github.io/curl-talk +http://brettlangdon.github.io/curl-talk diff --git a/slides/2_what_is_curl.md b/slides/02_what_is_curl.md similarity index 91% rename from slides/2_what_is_curl.md rename to slides/02_what_is_curl.md index ffcd6ae..16589d5 100644 --- a/slides/2_what_is_curl.md +++ b/slides/02_what_is_curl.md @@ -9,8 +9,8 @@ Supported Protocols: * FTP * FTPS * GOPHER -* HTTP -* HTTPS] +* **HTTP** +* **HTTPS**] .float-block[ * IMAP * IMAPS diff --git a/slides/3_quick_examples.md b/slides/03_quick_examples.md similarity index 100% rename from slides/3_quick_examples.md rename to slides/03_quick_examples.md diff --git a/slides/4_helpful_args.md b/slides/04_helpful_args.md similarity index 72% rename from slides/4_helpful_args.md rename to slides/04_helpful_args.md index 439d13d..3c399d8 100644 --- a/slides/4_helpful_args.md +++ b/slides/04_helpful_args.md @@ -4,6 +4,7 @@ * `-h` - __Help:__ Show all CLI options * `-F CONTENT` - __Form Data:__ Add Multipart Form data to request * `-H HEADER` - __Header:__ Add HEADER to request header -* `-X COMMAND` - __Method:__ Which request method to use (GET/POST/etc) +* `-X COMMAND` - __Method:__ Set request method (GET/POST/etc) * `-o FILE` - __Output:__ Output to FILE rather than stdout * `-L` - __Follow Redirects:__ Follow all redirects +* `-i` - __Response Headers:__ Show the requests response headers diff --git a/slides/5_dowload_file.md b/slides/05_dowload_file.md similarity index 60% rename from slides/5_dowload_file.md rename to slides/05_dowload_file.md index cdd6bb6..8ccabae 100644 --- a/slides/5_dowload_file.md +++ b/slides/05_dowload_file.md @@ -1,5 +1,5 @@ # Download a File - +### Download to stdout ```bash $ curl http://www.google.com ... ``` -### Save to a File +### Save to a File "google-home.html" ```bash -$ curl -o google.com http://www.google.com +$ curl -o google-home.html http://www.google.com ``` diff --git a/slides/6_head.md b/slides/06_head.md similarity index 70% rename from slides/6_head.md rename to slides/06_head.md index a8726fe..7a24fbb 100644 --- a/slides/6_head.md +++ b/slides/06_head.md @@ -1,5 +1,5 @@ # Response Headers Only - +* `-I` - Show response headers _ONLY_ ```bash $ curl -I http://www.google.com HTTP/1.1 200 OK @@ -7,8 +7,8 @@ Date: Sat, 26 Apr 2014 20:40:04 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 -Set-Cookie: PREF=ID=61629e9495553921:FF=0:TM=1398544804:LM=... -Set-Cookie: NID=67=HHSAgTCIZ3zd6w2hjrNqoX1VX9NDaqscV9YckpI2... +Set-Cookie: PREF=ID=61629e9495553921:FF=0:TM=1398544804... +Set-Cookie: NID=67=HHSAgTCIZ3zd6w2hjrNqoX1VX9NDaqscV9Yc... P3P: CP="This is not a P3P policy! See ..." Server: gws X-XSS-Protection: 1; mode=block diff --git a/slides/7_cookies.md b/slides/07_cookies.md similarity index 82% rename from slides/7_cookies.md rename to slides/07_cookies.md index 6d55a64..a809553 100644 --- a/slides/7_cookies.md +++ b/slides/07_cookies.md @@ -1,7 +1,9 @@ # Save/Reuse Cookies +* `-c FILE` - Save cookies to _FILE_ +* `-b FILE` - Load cookies from _FILE_ ```bash -$ curl -c cookies http://www.google.com +$ curl -c cookies -b cookies http://www.google.com $ cat cookies # Netscape HTTP Cookie File # http://curl.haxx.se/docs/http-cookies.html @@ -9,6 +11,4 @@ $ cat cookies ID=bec963a425f5d8ca:FF=0:TM=1398545024:LM=1398545024:S=... 67=BV0jhMokci-G3ZbOJ2UeFaNX1faFdfbFVcPHYIpAh35Uz2th6lVq... -# resuse stored cookies -$ curl -c cookies -b cookies http://www.google.com ``` diff --git a/slides/08_redirects.md b/slides/08_redirects.md new file mode 100644 index 0000000..f465196 --- /dev/null +++ b/slides/08_redirects.md @@ -0,0 +1,19 @@ +# Following Redirects +* `-I` - Response headers only +* `-L` - Follow redirects + +```bash +$ curl -I -L http://google.com +HTTP/1.1 301 Moved Permanently +Location: http://www.google.com/ +... +Expires: Sat, 31 May 2014 12:50:05 GMT +Cache-Control: public, max-age=2592000 + +HTTP/1.1 200 OK +Date: Thu, 01 May 2014 12:50:05 GMT +Expires: -1 +Cache-Control: private, max-age=0 +Content-Type: text/html; charset=ISO-8859-1 +... +``` diff --git a/slides/09_http_post.md b/slides/09_http_post.md new file mode 100644 index 0000000..d8e9c26 --- /dev/null +++ b/slides/09_http_post.md @@ -0,0 +1,19 @@ +# HTTP POST Data +* `-X METHOD` - Set HTTP Request Method +* `-d DATA` - Send request form data + +```bash +$ curl -X POST -d "name=brett&talk=curl" http://httpbin.org/post +{ + "form": { + "name": "brett", + "talk": "curl" + }, + "headers": { + "Host": "httpbin.org", + "Content-Type": "application/x-www-form-urlencoded", + ... + }, + ... +} +``` diff --git a/slides/10_post_file.md b/slides/10_post_file.md new file mode 100644 index 0000000..4f2a93d --- /dev/null +++ b/slides/10_post_file.md @@ -0,0 +1,21 @@ +# HTTP POST File +* `-d @FILE` - Send _FILE_ with the request +* `-X METHOD` - Set HTTP request method +* `-H HEADER` - Add _HEADER_ to request headers + +```bash +$ cat data.json +{"name": "brett","talk": "curl"} +$ curl -X POST -d @data.json \ + -H "Content-Type: application/json" http://httpbin.org/post +{ + "data": "{\"name\": \"brett\",\"talk\": \"curl\"}", + "json": { + "talk": "curl", + "name": "brett" + }, + "headers": { + "Content-Type": "application/json", + ... +} +``` diff --git a/slides/11_ssl.md b/slides/11_ssl.md new file mode 100644 index 0000000..52ab7bf --- /dev/null +++ b/slides/11_ssl.md @@ -0,0 +1,16 @@ +# HTTPS + +```bash +$ curl https://www.google.com + +... +``` + +#### Allow Insecure Certs +* `-k` - Allow Insecure Certs + +```bash +$ curl -k https://insecure-site.gov +``` diff --git a/slides/12_learn_more.md b/slides/12_learn_more.md new file mode 100644 index 0000000..043aaa4 --- /dev/null +++ b/slides/12_learn_more.md @@ -0,0 +1,12 @@ +# Learning More +* cURL Website + * http://curl.haxx.se/ +* This talk + * http://brettlangdon.github.io/curl-talk +* httpbin (test http request/response) + * http://httpbin.org/ + +```bash +$ man curl +$ curl --help +```