HW4-Telnet
Table of Contents
1 Talking HTTP
- Communicate with a server by typing
- Run our own webserver
- Report what we see
2 Communicate with a server by typing
host yelp.com yelp.com has address 198.51.132.160 ... telnet 198.51.132.160 80 GET / HTTP/1.1 Host: www.yelp.com HTTP/1.1 200 OK Date: Fri, 19 Sep 2014 06:16:32 GMT Server: Apache Content-Length: 121594 ... <!DOCTYPE HTML>
2.1 Secret notes
telnet
will do this host lookup for us- BUT we still must speak proper HTTP: ie specifying the
Host
header - As if you were to see someone at an office. Drive to the office, but once you show up, have to tell front desk who you're there to see
- Lot's of people in a building, lots of hosts on an IP
- To get out of Telnet: ^], ^D
3 Run webserver
cd webarch2014 git checkout master git pull jblomo master git checkout -b hw4-telnet ./server/app.py * Running on http://127.0.0.1:60001/
4 Proxy center
4.1 people => app.py notes
- Apache is proxying requests from your paths to your individual app.py
- If your app.py is not running, will get an error
- This is setup by Kevin in helpdesk, let us know if the mapping is not working
5 Communicate with our webserver
- Keep
server/app.py
running, open another window
telnet 127.0.0.1 $FLASK_PORT GET /home HTTP/1.1 Host: people.ischool.berkeley.edu HTTP/1.0 200 OK Content-Type: text/html; charset=utf-8 Content-Length: 228 Server: Werkzeug/0.8.3 Python/2.7.3 Date: Fri, 14 Sep 2014 05:44:08 GMT
6 HW Questions
- Using
127.0.0.1 $FLASK_PORT
- What is the return code for
GET /home HTTP/1.1
? - What is the return code for
GET /wiki HTTP/1.1
?- What is the next HTTP statement a browser would send after this return code? (provide the statement as you would type it into telnet)
- What is the return code for
PUT /wiki HTTP/1.1
?
- What is the return code for
- Explain what happens when your browser loads http://people.ischool.berkeley.edu/~<USER>/server/wiki from sending the request to loading HTML
- What is the return code for http://people.ischool.berkeley.edu/~<USER>/server/ ?