Skip to content

Instantly share code, notes, and snippets.

@Nimrod007
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nimrod007/7611136725ec6c71ee02 to your computer and use it in GitHub Desktop.
Save Nimrod007/7611136725ec6c71ee02 to your computer and use it in GitHub Desktop.
HTTP server training kit

#HTTP:

  • this should take 2 hours approx.

###Intro:

  • Define HTTP (wikipedia):

"The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web"


* WTF is HTTP: [URL, GET & POST nice movie & easily exaplined](https://www.youtube.com/watch?v=kGOpY2J31pI)

###Going over the basics of HTTP:

* HTTP messages: 
[what is http message, the base of HTTP:](http://www.tutorialspoint.com/http/http_messages.htm)

* HTTP Request:
[request structure, request line, URI, Methods, abit about headers](http://www.tutorialspoint.com/http/http_requests.htm)

* HTTP Response:
[response structure, status codes, headers](http://www.tutorialspoint.com/http/http_responses.htm)

* REST
[short movie of restful api's from facebook and google, and how to use them with postman chrome addon](https://www.youtube.com/watch?v=7YcW25PHnAA)

* Urls:
  + Urls are basically an address of a resource or service on a webserver. They are the way the browser (or server) communicates its needs with the webserver.
  + [short video with questions in the end](https://www.youtube.com/watch?v=SMxx9XEF6m0)
  + nice tutorial about URLS [1](https://developer.mozilla.org/en-US/Learn/Understanding_URLs) AND [2](https://developer.mozilla.org/en-US/Learn/Understanding_domain_names)

* Headers:
  + weve seen abit about headers in the previous request/response, this will be more specific
  + special header -> the HTTP cookie [1](http://en.wikipedia.org/wiki/HTTP_cookie) AND [2](http://www.nczonline.net/blog/2009/05/05/http-cookies-explained/)
  + nice tutorial about http headers 
    - search for "HTTP Headers in HTTP Requests"
    - search for "How to See HTTP Headers"
    - http://code.tutsplus.com/tutorials/http-headers-for-dummies--net-8039
    - for chrome use the developer tools (instead of firebug):
    - http://stackoverflow.com/questions/4423061/view-http-headers-in-google-chrome

* Cookie
  + [Short movie about cookies](https://www.youtube.com/watch?v=I01XMRo2ESg)

###Practice

* After we know the basics of HTTP lets look at wix and how we use them

* Before starting:
    + download chrome
    + install addons: [edit this cookie](https://www.google.co.il/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CBwQFjAA&url=https%3A%2F%2Fchrome.google.com%2Fwebstore%2Fdetail%2Feditthiscookie%2Ffngmhnnpilhplaeedifhccceomclgfbg&ei=-wBnVb7pE7iLsQTx5IHABw&usg=AFQjCNEsOg-MFIRm9OjiXsg3yxxcLnxr1A&sig2=tNl327quba-EXlEa2EwyOg&bvm=bv.93990622,d.ZGU) AND  [postman](https://www.google.co.il/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CBwQFjAA&url=https%3A%2F%2Fchrome.google.com%2Fwebstore%2Fdetail%2Fpostman-rest-client%2Ffdmmgilgnpjigdojojpjoooidkmcomcm%3Fhl%3Den&ei=FwFnVdPUIpWQsQSI3oDAAg&usg=AFQjCNHaecLwAKk91gpdCY_y1x_ViIrHwQ&sig2=oD6jK0vPfMC6RKFY_BxTAA&bvm=bv.93990622,d.ZGU)
  
  + get familiar with the chrome developer console (in chrome press  Command+Option+i )
  
* What to do?
  + go to [www.wix.com](www.wix.com)
  + open the cookie addon (press the cookie icon on the menu bar), a list of cookies should be exposed to you, look at the cookie _wixCIDX and _wixUIDX, see that both of them have a GUID value, the UIDX is your registered userId (if you registerd) and CIDX is your anonymos userId
  + go to the wix editor (edit 1 of your site)
  + open chrome developer tools
  + go to the network tab in developers tools
  + reload the page
  + search for "profile" in the network tab filter bar
  + you will see the HTTP GET request named profileimage

* Few questions (answers are at the buttom)
  + what is the full url of the request?
  + what is the status code of the response
  + what is the request Accept header?
  + open postman addon, send the same request but add a header Accept:application/xml , what is the status code of the response?


* Answers
  + full url:
  + http://editor.wix.com/_api/account-info-server/profileimage
  + status code = 200 success
  + Accept header is application/json
  + server dosent Accept XML so it will return 500 response


The End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment