Skip to content

Latest commit

 

History

History
146 lines (131 loc) · 3.5 KB

File metadata and controls

146 lines (131 loc) · 3.5 KB

#HTML tutorial
from

#Formats
##Version
HTTP/1.1
##URI
http://abc.com:80/~smith/home.html
http://ABC.com/%7Esmith/home.html
http://ABC.com:/%7esmith/home.html
##Time
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
##Encoding
US-ASCII
ISO-8859-1
ISO-8859-7
##Lang
en, en-US, en-cockney, i-cherokee, x-pig-latin
##MIME
Multipurpose Internet Mail Extensions (MIME) [RFC2045]

#Structure
##A Start-line

GET /hello.htm HTTP/1.1     (This is Request-Line sent by the client)  
  
HTTP/1.1 200 OK             (This is Status-Line sent by the server)  

##Zero or more header fields followed by CRLF

message-header = field-name ":" [ field-value ]  
User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3  
Host: www.example.com  
Accept-Language: en, mi  
Date: Mon, 27 Jul 2009 12:28:53 GMT  
Server: Apache  
Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT  
ETag: "34aa387-d-1568eb00"  
Accept-Ranges: bytes  
Content-Length: 51  
Vary: Accept-Encoding  
Content-Type: text/plain  

##An empty line (i.e., a line with nothing preceding the CRLF) indicating the end of the header fields

##Optionally a message-body

<html>  
<body>  
<h1>Hello, World!</h1>  
</body>  
</html>  

#Request
##Methods
GET - just return
HEAD - GET status and headers
POST - just send
PUT - override this
DELETE
CONNECT - establish a tunnel
OPTIONS
TRACE

##Examples

GET /hello.htm HTTP/1.1  
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)  
Host: www.tutorialspoint.com  
Accept-Language: en-us  
Accept-Encoding: gzip, deflate  
Connection: Keep-Alive  

#Response
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF

1xx: Informational
2xx: Success
3xx: Redirection
4xx: Client Error -bad syntax
5xx: Server Error

HTTP/1.1 200 OK  
Date: Mon, 27 Jul 2009 12:28:53 GMT  
Server: Apache/2.2.14 (Win32)  
Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT  
Content-Length: 88  
Content-Type: text/html  
Connection: Closed  
  
<html>  
<body>  
<h1>Hello, World!</h1>  
</body>  
</html>  
HTTP/1.1 404 Not Found  
Date: Sun, 18 Oct 2012 10:36:20 GMT  
Server: Apache/2.2.14 (Win32)  
Content-Length: 230  
Connection: Closed  
Content-Type: text/html; charset=iso-8859-1  
     
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">  
<html>  
<head>  
   <title>404 Not Found</title>  
</head>  
<body>  
   <h1>Not Found</h1>  
   <p>The requested URL /t.html was not found on this server.</p>  
</body>  
</html>  

#Connect

CONNECT www.tutorialspoint.com HTTP/1.1  
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)  
  
HTTP/1.1 200 Connection established  
Date: Mon, 27 Jul 2009 12:28:53 GMT  
Server: Apache/2.2.14 (Win32)  

#Options
send to the web browser

OPTIONS * HTTP/1.1  
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)  
  
The server will send information based on the current configuration of the server, for example:  
  
HTTP/1.1 200 OK  
Date: Mon, 27 Jul 2009 12:28:53 GMT  
Server: Apache/2.2.14 (Win32)  
Allow: GET,HEAD,POST,OPTIONS,TRACE  
Content-Type: httpd/unix-directory