SlideShare una empresa de Scribd logo
1 de 32
Descargar para leer sin conexión
© 2014 Adobe Systems Incorporated. All Rights Reserved. 1
Brent Shaffer
Introduction to HTTP - The Protocol of Our Lives
© 2014 Adobe Systems Incorporated. All Rights Reserved. 2
What is HTTP?
• Hypertext Transfer Protocol (Hypertext?!??)
• One of the least understood aspect of web development
• The language your browser speaks to web servers
• The technology used for most web traffic
• The foundation for other web technologies such as REST, AJAX, and
HTTPS
© 2014 Adobe Systems Incorporated. All Rights Reserved. 3
What isn't HTTP?
• Web Sockets - same port, different protocol
• IRC (chat), SMTP (mail), FTP (files)
• Anything prefixed with :// other than http and https
• A gooey slice of pizza
• Your mother
© 2014 Adobe Systems Incorporated. All Rights Reserved. 4
I'm so excited! What do I need?
• an HTTP Server
• the internet
• your computer
• PHP and RoR have built-in web servers
• Apache is pre-installed on OS X
© 2014 Adobe Systems Incorporated. All Rights Reserved. 5
I'm so excited! What do I need?
• an HTTP Client
• a browser
• cURL
• command-line http utility
• Telnet
• for those who like it raw
© 2014 Adobe Systems Incorporated. All Rights Reserved. 6
Is there anything else I can use?
• an HTTP Proxy
• Charles (charlesproxy.com)
• spy on your own network traffic!
© 2014 Adobe Systems Incorporated. All Rights Reserved. 7
1. Open Charles
a. OS X: ensure "Mac OS X Proxy" is checked
b. Windows: ensure "Windows I.E. Proxy" is checked
c. ensure Charles is recording
Let's Get Started!
© 2014 Adobe Systems Incorporated. All Rights Reserved. 8
1. Open Charles
d. Take a moment to observe some of your
network traffic
e. Go to Proxy > Recording Settings > Include and
enter "httpbin.org"
Let's Get Started!
© 2014 Adobe Systems Incorporated. All Rights Reserved. 9
2. Open your Browser
• Browse to "httpbin.org"
• Click on the request you just made
in Charles
• Click the "Request" tab
• Select the "Raw" tab at the bottom
Let's Get Started!
© 2014 Adobe Systems Incorporated. All Rights Reserved. 10
Raw HTTP Request
3. You Did It!
© 2014 Adobe Systems Incorporated. All Rights Reserved. 11
Method
Protocol / Version
Path
Headers
© 2014 Adobe Systems Incorporated. All Rights Reserved. 12
Raw HTTP Response
© 2014 Adobe Systems Incorporated. All Rights Reserved. 13
Status Code
Protocol / Version
Headers
Body
© 2014 Adobe Systems Incorporated. All Rights Reserved. 14
Browser Love
1. Using Chrome
a. Go to View > Developer > Developer Tools
b. Load (or reload) the page
c. Click Network > [url]
d. Click Headers to see the request and
response headers
© 2014 Adobe Systems Incorporated. All Rights Reserved. 15
HTTP Basics - Methods
• Possible Methods
• GET / PUT / POST / DELETE / HEAD / OPTIONS / PATCH /
TRACE / CONNECT
• Methods YOU should care about
• GET and POST
• Eventually PUT / DELETE
© 2014 Adobe Systems Incorporated. All Rights Reserved. 16
HTTP Basics - Methods
• GET
• no request body
• variables in URL via query string parameters
• safe - meaning the request does not modify a resource
• idempotent - meaning the call can be made many times without
changing the outcome
© 2014 Adobe Systems Incorporated. All Rights Reserved. 17
HTTP Basics - Methods
• POST
• variables in request body or URL
• used to modify resources
• not safe
• not idempotent
• your browser performs these on form submission
© 2014 Adobe Systems Incorporated. All Rights Reserved. 18
HTTP Basics - Let's get POSTin'
<form method="post" action="http://httpbin.org/post">
Field 1: <input type="text" name="field1" /><br />
Field 2: <input type="text" name="field2" /><br />
<input type="submit" />
</form>
1. Create an HTML form with method POST
© 2014 Adobe Systems Incorporated. All Rights Reserved. 19
HTTP Basics - Let's get POSTin'
2. Submit the form
© 2014 Adobe Systems Incorporated. All Rights Reserved. 20
View the POST request in Charles
© 2014 Adobe Systems Incorporated. All Rights Reserved. 21
Method Protocol / Version
Path
Headers
Body
© 2014 Adobe Systems Incorporated. All Rights Reserved. 22
HTTP Basics - Status Codes
• Possible Status Codes
• Informational - 1xx (3)
• Success - 2xx (10)
• Redirection - 3xx (9)
• Client Error - 4xx (~30)
• Server Error - 5xx (14)
© 2014 Adobe Systems Incorporated. All Rights Reserved. 23
HTTP Basics - Status Codes
• Status Codes YOU should care about
• 200 OK - everything's groovy, baby
• 301 Moved Permanently - this resource now has a new URI
• 302 Found - you performed some action, now go somewhere else
• 400 Bad Request - there was a problem, and it's your fault
• 401 Unauthorized - you need to authorize before accessing this resource
• 403 Forbidden - you may have authorized, but you still don't have access
• 404 Not Found - this is not the page you are looking for
• 500 Internal Server Error - there was a problem, and it's not your fault
© 2014 Adobe Systems Incorporated. All Rights Reserved. 24
HTTP Basics - Status Codes
• Status codes which are useless but you are required to know
• 418 I'm A Teapot
• http://httpbin.org/status/418
• this WILL be on the exam
© 2014 Adobe Systems Incorporated. All Rights Reserved. 25
HTTP Basics - Headers
• Possible Headers
• Lots
• http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
© 2014 Adobe Systems Incorporated. All Rights Reserved. 26
HTTP Basics - Headers
• Request Headers YOU should know about
• Host - typically required (IP + Host = Web Request)
• Accept - content type(s) your client can handle
• User-Agent - The HTTP Client for the request
• Cookie - the cookies you want to send to the web server
• Content-Type - the encoding of your request body (if applicable)
• Content-Length - the length of your request body (if applicable)
© 2014 Adobe Systems Incorporated. All Rights Reserved. 27
HTTP Basics - Headers
• Response Headers YOU should know about
• Date - the date of the response
• Content-Type - the content type of the response
• Content-Length - the length of the response
• Set-Cookie - that's how cookies are made!
• Location - where the browser should go, in the case of 301 and 302 redirects
© 2013 Adobe Systems Incorporated. All Rights Reserved. 28
• Postman (easy)
• Chrome extension for HTTP Requests
• Good for testing API calls
• Paw (easy) - https://luckymarmot.com/paw
• Native OS X app for API calls
HTTP Tools
© 2013 Adobe Systems Incorporated. All Rights Reserved. 29
HTTP Tools
• cURL (intermediate)
• just like the browser, cURL is an HTTP Client
• unlike the browser, cURL is a Command Line Interface (CLI) rather
than a Graphical User Interface (GUI)
• This is useful for making specific http requests without a browser
© 2013 Adobe Systems Incorporated. All Rights Reserved. 30
HTTP Tools
# curl -v http://httpbin.org/post
-d 'foo=bar&test=123'
# curl -v http://httpbin.org/post
-d '{"foo":"bar","test":"123"}'
-H 'Content-Type:application/json'
# curl -v http://httpbin.org/post
-d '{"foo":"bar","test":"123"}'
-H 'Content-Type:application/json'
-x localhost:8888
# POST request
# POST request using JSON
# POST request using JSON and
sent to an HTTP Proxy (Charles)
© 2013 Adobe Systems Incorporated. All Rights Reserved. 31
HTTP Tools
• Telnet (expert)
• Raw HTTP request
• You type it in!
# telnet httpbin.org 80
Trying 50.16.189.35...
Connected to httpbin.org.
Escape character is '^]'.
GET / HTTP/1.1
Host: httpbin.org
# The simplest possible HTTP request
# Press enter twice once you've finished
to complete the request
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Más contenido relacionado

La actualidad más candente

Hypertext transfer protocol (http)
Hypertext transfer protocol (http)Hypertext transfer protocol (http)
Hypertext transfer protocol (http)
johnny19910916
 

La actualidad más candente (20)

Http basics by-joshi_29_4_15-ppt
Http basics by-joshi_29_4_15-pptHttp basics by-joshi_29_4_15-ppt
Http basics by-joshi_29_4_15-ppt
 
HTTP Protocol Basic
HTTP Protocol BasicHTTP Protocol Basic
HTTP Protocol Basic
 
Http - All you need to know
Http - All you need to knowHttp - All you need to know
Http - All you need to know
 
21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboards21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboards
 
HTTP
HTTPHTTP
HTTP
 
Hypertext transfer protocol (http)
Hypertext transfer protocol (http)Hypertext transfer protocol (http)
Hypertext transfer protocol (http)
 
HTTP fundamentals for developers
HTTP fundamentals for developersHTTP fundamentals for developers
HTTP fundamentals for developers
 
HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)
 
HTTP Presentation
HTTP Presentation HTTP Presentation
HTTP Presentation
 
Http-protocol
Http-protocolHttp-protocol
Http-protocol
 
Http Protocol
Http ProtocolHttp Protocol
Http Protocol
 
HTTP
HTTPHTTP
HTTP
 
Introducing HTTP/2
Introducing HTTP/2Introducing HTTP/2
Introducing HTTP/2
 
HTTP
HTTPHTTP
HTTP
 
What HTTP/2.0 Will Do For You
What HTTP/2.0 Will Do For YouWhat HTTP/2.0 Will Do For You
What HTTP/2.0 Will Do For You
 
Understanding the Web through HTTP
Understanding the Web through HTTPUnderstanding the Web through HTTP
Understanding the Web through HTTP
 
HTTP vs HTTPS, Do You Really Need HTTPS?
HTTP vs HTTPS, Do You Really Need HTTPS?HTTP vs HTTPS, Do You Really Need HTTPS?
HTTP vs HTTPS, Do You Really Need HTTPS?
 
HTTP/2 Introduction
HTTP/2 IntroductionHTTP/2 Introduction
HTTP/2 Introduction
 
An Introduction To World Wide Web
An Introduction To World Wide WebAn Introduction To World Wide Web
An Introduction To World Wide Web
 
Covert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache HeadersCovert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache Headers
 

Similar a HTTP - The Protocol of Our Lives

Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
Tomas Doran
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
Tomas Doran
 
Lesson 6 web based attacks
Lesson 6 web based attacksLesson 6 web based attacks
Lesson 6 web based attacks
Frank Victory
 

Similar a HTTP - The Protocol of Our Lives (20)

Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
 
CNIT 129S: Ch 3: Web Application Technologies
CNIT 129S: Ch 3: Web Application TechnologiesCNIT 129S: Ch 3: Web Application Technologies
CNIT 129S: Ch 3: Web Application Technologies
 
CNIT 129S - Ch 3: Web Application Technologies
CNIT 129S - Ch 3: Web Application TechnologiesCNIT 129S - Ch 3: Web Application Technologies
CNIT 129S - Ch 3: Web Application Technologies
 
Web technology Unit I Part C
Web technology Unit I  Part CWeb technology Unit I  Part C
Web technology Unit I Part C
 
RESTful web
RESTful webRESTful web
RESTful web
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
Embracing HTTP in the era of API’s
Embracing HTTP in the era of API’sEmbracing HTTP in the era of API’s
Embracing HTTP in the era of API’s
 
Ch 3: Web Application Technologies
Ch 3: Web Application TechnologiesCh 3: Web Application Technologies
Ch 3: Web Application Technologies
 
Class 1 - World Wide Web Introduction
Class 1 - World Wide Web IntroductionClass 1 - World Wide Web Introduction
Class 1 - World Wide Web Introduction
 
Lesson 6 web based attacks
Lesson 6 web based attacksLesson 6 web based attacks
Lesson 6 web based attacks
 
Создание API, которое полюбят разработчики. Глубокое погружение
Создание API, которое полюбят разработчики. Глубокое погружениеСоздание API, которое полюбят разработчики. Глубокое погружение
Создание API, которое полюбят разработчики. Глубокое погружение
 
Middleware in Golang: InVision's Rye
Middleware in Golang: InVision's RyeMiddleware in Golang: InVision's Rye
Middleware in Golang: InVision's Rye
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
WordPress Rest API
WordPress Rest APIWordPress Rest API
WordPress Rest API
 
1. web technology basics
1. web technology basics1. web technology basics
1. web technology basics
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
The 3 Top Techniques for Web Security Testing Using a Proxy
The 3 Top Techniques for Web Security Testing Using a ProxyThe 3 Top Techniques for Web Security Testing Using a Proxy
The 3 Top Techniques for Web Security Testing Using a Proxy
 
rest3d Web3D 2014
rest3d Web3D 2014rest3d Web3D 2014
rest3d Web3D 2014
 
Hey My Web App is Slow Where is the Problem
Hey My Web App is Slow Where is the ProblemHey My Web App is Slow Where is the Problem
Hey My Web App is Slow Where is the Problem
 

Más de Brent Shaffer

Más de Brent Shaffer (9)

Web Security 101
Web Security 101Web Security 101
Web Security 101
 
OAuth2 - The Swiss Army Framework
OAuth2 - The Swiss Army FrameworkOAuth2 - The Swiss Army Framework
OAuth2 - The Swiss Army Framework
 
Why Open Source is better than Your Homerolled Garbage
Why Open Source is better than Your Homerolled GarbageWhy Open Source is better than Your Homerolled Garbage
Why Open Source is better than Your Homerolled Garbage
 
OAuth 2.0 (as a comic strip)
OAuth 2.0 (as a comic strip)OAuth 2.0 (as a comic strip)
OAuth 2.0 (as a comic strip)
 
In The Future We All Use Symfony2
In The Future We All Use Symfony2In The Future We All Use Symfony2
In The Future We All Use Symfony2
 
Symfony Events
Symfony EventsSymfony Events
Symfony Events
 
Nashville Symfony Functional Testing
Nashville Symfony Functional TestingNashville Symfony Functional Testing
Nashville Symfony Functional Testing
 
Nashvile Symfony Routes Presentation
Nashvile Symfony Routes PresentationNashvile Symfony Routes Presentation
Nashvile Symfony Routes Presentation
 
Nashville Php Symfony Presentation
Nashville Php Symfony PresentationNashville Php Symfony Presentation
Nashville Php Symfony Presentation
 

Último

Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Último (20)

Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 

HTTP - The Protocol of Our Lives

  • 1. © 2014 Adobe Systems Incorporated. All Rights Reserved. 1 Brent Shaffer Introduction to HTTP - The Protocol of Our Lives
  • 2. © 2014 Adobe Systems Incorporated. All Rights Reserved. 2 What is HTTP? • Hypertext Transfer Protocol (Hypertext?!??) • One of the least understood aspect of web development • The language your browser speaks to web servers • The technology used for most web traffic • The foundation for other web technologies such as REST, AJAX, and HTTPS
  • 3. © 2014 Adobe Systems Incorporated. All Rights Reserved. 3 What isn't HTTP? • Web Sockets - same port, different protocol • IRC (chat), SMTP (mail), FTP (files) • Anything prefixed with :// other than http and https • A gooey slice of pizza • Your mother
  • 4. © 2014 Adobe Systems Incorporated. All Rights Reserved. 4 I'm so excited! What do I need? • an HTTP Server • the internet • your computer • PHP and RoR have built-in web servers • Apache is pre-installed on OS X
  • 5. © 2014 Adobe Systems Incorporated. All Rights Reserved. 5 I'm so excited! What do I need? • an HTTP Client • a browser • cURL • command-line http utility • Telnet • for those who like it raw
  • 6. © 2014 Adobe Systems Incorporated. All Rights Reserved. 6 Is there anything else I can use? • an HTTP Proxy • Charles (charlesproxy.com) • spy on your own network traffic!
  • 7. © 2014 Adobe Systems Incorporated. All Rights Reserved. 7 1. Open Charles a. OS X: ensure "Mac OS X Proxy" is checked b. Windows: ensure "Windows I.E. Proxy" is checked c. ensure Charles is recording Let's Get Started!
  • 8. © 2014 Adobe Systems Incorporated. All Rights Reserved. 8 1. Open Charles d. Take a moment to observe some of your network traffic e. Go to Proxy > Recording Settings > Include and enter "httpbin.org" Let's Get Started!
  • 9. © 2014 Adobe Systems Incorporated. All Rights Reserved. 9 2. Open your Browser • Browse to "httpbin.org" • Click on the request you just made in Charles • Click the "Request" tab • Select the "Raw" tab at the bottom Let's Get Started!
  • 10. © 2014 Adobe Systems Incorporated. All Rights Reserved. 10 Raw HTTP Request 3. You Did It!
  • 11. © 2014 Adobe Systems Incorporated. All Rights Reserved. 11 Method Protocol / Version Path Headers
  • 12. © 2014 Adobe Systems Incorporated. All Rights Reserved. 12 Raw HTTP Response
  • 13. © 2014 Adobe Systems Incorporated. All Rights Reserved. 13 Status Code Protocol / Version Headers Body
  • 14. © 2014 Adobe Systems Incorporated. All Rights Reserved. 14 Browser Love 1. Using Chrome a. Go to View > Developer > Developer Tools b. Load (or reload) the page c. Click Network > [url] d. Click Headers to see the request and response headers
  • 15. © 2014 Adobe Systems Incorporated. All Rights Reserved. 15 HTTP Basics - Methods • Possible Methods • GET / PUT / POST / DELETE / HEAD / OPTIONS / PATCH / TRACE / CONNECT • Methods YOU should care about • GET and POST • Eventually PUT / DELETE
  • 16. © 2014 Adobe Systems Incorporated. All Rights Reserved. 16 HTTP Basics - Methods • GET • no request body • variables in URL via query string parameters • safe - meaning the request does not modify a resource • idempotent - meaning the call can be made many times without changing the outcome
  • 17. © 2014 Adobe Systems Incorporated. All Rights Reserved. 17 HTTP Basics - Methods • POST • variables in request body or URL • used to modify resources • not safe • not idempotent • your browser performs these on form submission
  • 18. © 2014 Adobe Systems Incorporated. All Rights Reserved. 18 HTTP Basics - Let's get POSTin' <form method="post" action="http://httpbin.org/post"> Field 1: <input type="text" name="field1" /><br /> Field 2: <input type="text" name="field2" /><br /> <input type="submit" /> </form> 1. Create an HTML form with method POST
  • 19. © 2014 Adobe Systems Incorporated. All Rights Reserved. 19 HTTP Basics - Let's get POSTin' 2. Submit the form
  • 20. © 2014 Adobe Systems Incorporated. All Rights Reserved. 20 View the POST request in Charles
  • 21. © 2014 Adobe Systems Incorporated. All Rights Reserved. 21 Method Protocol / Version Path Headers Body
  • 22. © 2014 Adobe Systems Incorporated. All Rights Reserved. 22 HTTP Basics - Status Codes • Possible Status Codes • Informational - 1xx (3) • Success - 2xx (10) • Redirection - 3xx (9) • Client Error - 4xx (~30) • Server Error - 5xx (14)
  • 23. © 2014 Adobe Systems Incorporated. All Rights Reserved. 23 HTTP Basics - Status Codes • Status Codes YOU should care about • 200 OK - everything's groovy, baby • 301 Moved Permanently - this resource now has a new URI • 302 Found - you performed some action, now go somewhere else • 400 Bad Request - there was a problem, and it's your fault • 401 Unauthorized - you need to authorize before accessing this resource • 403 Forbidden - you may have authorized, but you still don't have access • 404 Not Found - this is not the page you are looking for • 500 Internal Server Error - there was a problem, and it's not your fault
  • 24. © 2014 Adobe Systems Incorporated. All Rights Reserved. 24 HTTP Basics - Status Codes • Status codes which are useless but you are required to know • 418 I'm A Teapot • http://httpbin.org/status/418 • this WILL be on the exam
  • 25. © 2014 Adobe Systems Incorporated. All Rights Reserved. 25 HTTP Basics - Headers • Possible Headers • Lots • http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
  • 26. © 2014 Adobe Systems Incorporated. All Rights Reserved. 26 HTTP Basics - Headers • Request Headers YOU should know about • Host - typically required (IP + Host = Web Request) • Accept - content type(s) your client can handle • User-Agent - The HTTP Client for the request • Cookie - the cookies you want to send to the web server • Content-Type - the encoding of your request body (if applicable) • Content-Length - the length of your request body (if applicable)
  • 27. © 2014 Adobe Systems Incorporated. All Rights Reserved. 27 HTTP Basics - Headers • Response Headers YOU should know about • Date - the date of the response • Content-Type - the content type of the response • Content-Length - the length of the response • Set-Cookie - that's how cookies are made! • Location - where the browser should go, in the case of 301 and 302 redirects
  • 28. © 2013 Adobe Systems Incorporated. All Rights Reserved. 28 • Postman (easy) • Chrome extension for HTTP Requests • Good for testing API calls • Paw (easy) - https://luckymarmot.com/paw • Native OS X app for API calls HTTP Tools
  • 29. © 2013 Adobe Systems Incorporated. All Rights Reserved. 29 HTTP Tools • cURL (intermediate) • just like the browser, cURL is an HTTP Client • unlike the browser, cURL is a Command Line Interface (CLI) rather than a Graphical User Interface (GUI) • This is useful for making specific http requests without a browser
  • 30. © 2013 Adobe Systems Incorporated. All Rights Reserved. 30 HTTP Tools # curl -v http://httpbin.org/post -d 'foo=bar&test=123' # curl -v http://httpbin.org/post -d '{"foo":"bar","test":"123"}' -H 'Content-Type:application/json' # curl -v http://httpbin.org/post -d '{"foo":"bar","test":"123"}' -H 'Content-Type:application/json' -x localhost:8888 # POST request # POST request using JSON # POST request using JSON and sent to an HTTP Proxy (Charles)
  • 31. © 2013 Adobe Systems Incorporated. All Rights Reserved. 31 HTTP Tools • Telnet (expert) • Raw HTTP request • You type it in! # telnet httpbin.org 80 Trying 50.16.189.35... Connected to httpbin.org. Escape character is '^]'. GET / HTTP/1.1 Host: httpbin.org # The simplest possible HTTP request # Press enter twice once you've finished to complete the request
  • 32. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Notas del editor

  1. So here's a little about me. My name is Brent (don't stay on this page long)
  2. Adobe Marketing Cloud - Web Services Team - this means we are in charge of all the APIs here
  3. We are a folk duo, and if you're into listening to music while you code, it would mean the world to me if you checked us out Music is free at morehazards.com
  4. Those are probably a lot of words you don't care about, but it makes me feel important
  5. Web Sockets - protocol for maintaining live connections for two-way communication file:// for example is not http your mother is not http, unless you're https, and even then it's questionable
  6. You need an http web server. I know of one, it's called the internet! In the event the internet is broken, you can use your computer Other web servers: Ngynx, Tomcat, IIS, etc.
  7. Demo HTTPBin.org - /headers - compare with browser headers / charles headers - /get - show a few querystring parameters - note "post" (also "put" and "delete") as options to be shown later
  8. idempotent - drop this word at your job and you'll get a raise. works every time safe - slightly different - means no permanent changes were made forms - "method = post"
  9. idempotent - drop this word at your job and you'll get a raise. works every time safe - slightly different - means no permanent changes were made forms - "method = post"
  10. show POST in httpbin show POST in charles
  11. show POST in httpbin show POST in charles
  12. change method to GET in html change method to GET in browser
  13. 404 - https://github.com/asdfasdfds 500 error - server error, code exception, syntax error, etc
  14. It doesn't even look like a teapot
  15. curl prevents you from making wrong requests... now you can!