telnet
Let's use Charles to analyze a visit to http://www.ikdoeict.be/ and thereby study the HTTP protocol which is defined in RFC 2616
GET / HTTP/1.1
OPTIONS
, GET
, POST
, HEAD
, PUT
, DELETE
, TRACE
, or CONNECT
/
)HTTP/1.1
Host: www.ikdoeict.be
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:26.0) Gecko/20100101 Firefox/26.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: PREF=ID=39391363bc...xdN
Key: Value
Host
is mandatory: it tells the server which site you want to accessAccept
, Accept-Charset
, Accept-Encoding
, Accept-Language
, Authorization
, If-Match
, Referer
, User-Agent
X-
prefix<head>
and <body>
— not to be confused with the response head/response body!HTTP/1.1 200 OK
HTTP/1.1
)
Age
, Location
, Retry-After
, Server
X-
prefix200 - OK
301 - Moved Permanently
302 - Found
304 - Not Modified
400 - Bad Request
401 - Unauthorized
403 - Forbidden
404 - Not Found
500 - Internal Server Error
telnet
to a webserver
bramus$ telnet www.ikdoeict.be 80
Trying 178.18.22.176...
Connected to www.ikdoeict.be.
Escape character is '^]'.
HEAD / HTTP/1.1
Host: www.ikdoeict.be
Content-Length: 8
s=bramus
HTTP/1.1 200 OK
Date: Sun, 29 Sep 2013 13:10:48 GMT
Server: Apache/1.3.42 (Unix) mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.7a
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
X-Powered-By: PHP/5.4.20
Set-Cookie: PHPSESSID=7b25f....a52e67; path=/
Content-Type: text/html
192.168.0.2
or brm.local
or ikdoeict.be
127.0.0.1
or localhost
www.ikdoeict.be/
is the same as http://www.ikdoeict.be/
80
(http) or 443
(https) is used
http://www.ikdoeict.be:8080/
.php
before sending it's output to the client
<!DOCTYPE html>
<html>
<head>
<title>Sample ASP Page</title>
<meta charset="UTF-8" />
</head>
<body>
<%
Response.Write "<Hello, I am an ASP script!";
%>
</body>
</html>
If you open a file directly from disk, it remains unparsed!
A file served by the webserver is parsed before being sent to the client
.asp
.
<% Response.Write "I am ASP"; %>
<?php echo 'I am PHP'; ?>
<% out.println("I am JSP"); %>
<cfoutput>#"I am ColdFusion"#</cfoutput>
print "I am Perl";
... but we'll choose ;-)