SlideShare a Scribd company logo
Http Request & Response
HyperText Transfer Protocol (HTTP)
๏ฌ

๏ฌ

๏ฌ

๏ฌ

most popular application protocol used in the
Internet (or The WEB)
An HTTP client sends a request message to an
HTTP server
The server, in turn, returns a response message. In
other words, HTTP is a pull protocol, the client
pulls information from the server (instead of server
pushes information down to the client).
HTTP is a stateless protocol. In other words, the
current request does not know what has been done
in the previous requests.
Browser
Uniform Resource Locator (URL)
A URL (Uniform Resource Locator) is used to uniquely identify a resource over the web. URL has the following syntax:
protocol://hostname:port/path-and-file-name
There are 4 parts in a URL:
Protocol: The application-level protocol used by the client and server, e.g., HTTP, FTP, and telnet.
Hostname: The DNS domain name (e.g., www.test101.com) or IP address (e.g., 192.128.1.2) of the server.
Port: The TCP port number that the server is listening for incoming requests from the clients.
Path-and-file-name: The name and location of the requested resource, under the server document base directory.
For example, in the URL http://www.test101.com/docs/index.html, the communication protocol is HTTP; the hostname is
www.test101.com. The port number was not specified in the URL, and takes on the default number, which is TCP port 80 for
HTTP. The path and file name for the resource to be located is "/docs/index.html".
Other examples of URL are:
ftp://www.ftp.org/docs/test.txt
mailto:user@test101.com
Important Default Port numbers
443 TCP

Hypertext Transfer Protocol over TLS/SSL (HTTPS).

115 TCP

Simple/secure File Transfer Protocol (SFTP).

80

TCP

Hypertext Transfer Protocol (HTTP).

21

TCP

FTP control (command).

22

TCP

Secure Shell (SSH) โ€” used for secure logins.

23

TCP

Telnet protocol.

25

TCP

Simple Mail Transfer Protocol (SMTP).

115 TCP

Simple File Transfer Protocol (SFTP).

110 TCP

Post Office Protocol v3 (POP3).

1414TCP

IBM WebSphere MQ (formerly known as MQSeries).

9060TCP

WebSphere Application Server Administration Console.

9080TCP

WebSphere Application Server HTTP Transport (port 1) default.

8080TCP

Apache Tomcat.

5432TCP

PostgreSQL database system.

3306TCP

MySQL database system.

1521TCP

Oracle database default listener.
Http Request Message
Http Request Message Format
The format of an HTTP request message is as follow:
Http Request Message
Request Line
The first line of the header is called the request line, followed by optional request headers.
The request line has the following syntax:
request-method-name request-URI HTTP-version
request-method-name: HTTP protocol defines a set of request methods, e.g., GET, POST, HEAD,
and OPTIONS. The client can use one of these methods to send a request to the server.
* case sensitive and must be in uppercase.
request-URI: specifies the resource requested.
HTTP-version: Two versions are currently in use: HTTP/1.0 and HTTP/1.1.
Examples of request line are:
GET /test.html HTTP/1.1
HEAD /query.html HTTP/1.0
POST /index.html HTTP/1.1
Http Request Message
Request Headers
The request headers are in the form of name:value pairs.
Multiple values, separated by commas, can be
specified.
request-header-name: request-header-value1, requestheader-value2, ...
Examples of request headers are:
Host: www.xyz.com
Connection: Keep-Alive
Accept: image/gif, image/jpeg, */*
Accept-Language: us-en, fr, cn
username=vignesh&password=qwer1234&......
Http Request Message Format
GET /docs/index.html HTTP/1.1
Host: www.test101.com
Accept: image/gif, image/jpeg, */*
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Referer:http://localhost:8080/home
Cookie:JSESSIONID=DFC52DC1584F89D94009014A77C111EC;city=Coimbatore;
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu
Chromium/32.0.1700.102 Chrome/32.0.1700.102 Safari/537.36
Cache-Control: max-age=0
(blank line)
Http Response
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Expires: Sun, 01 Mar 2015 13:46:19 GMT
Cache-Control: max-age=31556926, must-revalidate
Date: Sat, 01 Mar 2014 07:57:33 GMT
Set-Cookie:JSESSIONID=1D9B00464C03A0923E0AE77ADE16416A; Path=/; HttpOnly
Content-Type:text/html;charset=UTF-8
<html><body><h1>It works!</h1></body></html>
HTTP Response Message
Http Response Message
Status Line
The first line is called the status line, followed by
optional response header(s).
The status line has the following syntax:
HTTP-version status-code reasonphrase
HTTP-version: The HTTP version used in this
session. Either HTTP/1.0 and HTTP/1.1.
status-code: a 3-digit number generated by the server
to reflect the outcome of the request.
Http Response Message
Response Headers
The response headers are in the form name:value
pairs:
response-header-name: response-header-value1,
response-header-value2, ...
Examples of response headers are:
Content-Type: text/html
Content-Length: 35
Connection: Keep-Alive
Keep-Alive: timeout=15, max=100
Http Response Message
Http Response Status Code
Some commonly encountered status codes are:
100 Continue: The server received the request and in
the process of giving the response.
200 OK: The request is fulfilled.
301 Move Permanently: The resource requested for
has been permanently moved to a new location.
The URL of the new location is given in the
response header called Location. The client should
issue a new request to the new location.
Application should update all references to this
new location.
Http Request Using HTML Form
<html>
<head><title>Login</title></head>
<body>
<h2>LOGIN</h2>
<form method="get/post/delete"
action="/user/login">
Username: <input type="text" name="user"
size="25" /><br />
Password: <input type="password" name="pw"
size="10" /><br /><br />
HTML Form Fields
A form contains fields. The types of field include:

Text Box: produced by <input type="text">.
Password Box: produced by <input type="password">.
Radio Button: produced by <input type="radio">.
Checkbox: produced by <input type="checkbox">.
Selection: produced by <select> and <option>.
Text Area: produced by <textarea>.
Submit Button: produced by <input type="submit">.
Reset Button: produced by <input type="reset">.
Hidden Field: produced by <input type="hidden">.
Button: produced by <input type="button"> and <button>
Query String
name1=value1&name2=value2&name3=value3&...
HTML Form Fields
The query string can be sent to the server using either HTTP GET or POST request
method, which is specified in the <form>'s attribute "method".
<form method="get" action="url">
If GET request method is used, the URL-encoded query string will be appended
behind the request-URI after a "?" character, i.e.,

GET request-URI?query-string HTTP-version
(other optional request headers)
(blank line)
(optional request body)
HTML Form Fields
Using GET request to send the query string has the following drawbacks:

The amount of data you could append behind request-URI is limited. If this amount
exceed a server-specific threshold, the server would return an error "414 Request
URI too Large".

The URL-encoded query string would appear on the address box of the browser.
HTML Form Fields
<html>
<head><title>Login</title></head>
<body>
<h2>LOGIN</h2>
<form method="get" action="/bin/login">
Username: <input type="text" name="user" size="25" /><br />
Password: <input type="password" name="pw" size="10" /><br /><br />
<input type="hidden" name="action" value="login" />
<input type="submit" value="SEND" />
</form>
</body>
</html>
HTML Form Fields
Request Data
GET /bin/login?user=Peter+Lee&pw=123456&action=login HTTP/1.1

Accept: image/gif, image/jpeg, */*
Referer: http://127.0.0.1:8000/login.html
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Host: 127.0.0.1:8000
Connection: Keep-Alive

Address Bar
http://127.0.0.1:8000/bin/login?user=Peter+Lee&pw=123456&action=login
HTML Form Fields
<html>
<head><title>Login</title></head>
<body>
<h2>LOGIN</h2>
<form method="post" action="/bin/login">
Username: <input type="text" name="user" size="25" /><br />
Password: <input type="password" name="pw" size="10" /><br /><br />
<input type="hidden" name="action" value="login" />
<input type="submit" value="SEND" />
</form>
</body>
</html>
HTML Form Fields
Request Data
GET /bin/login HTTP/1.1

Accept: image/gif, image/jpeg, */*
Referer: http://127.0.0.1:8000/login.html
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Host: 127.0.0.1:8000
Connection: Keep-Alive

user=Peter+Lee&pw=123456&action=login
Address Bar
http://127.0.0.1:8000/bin/login
HTML Form Fields
File Upload using multipart/form-data POST Request
<html>
<head><title>File Upload</title></head>
<body>
<h2>Upload File</h2>
<form method="post" enctype="multipart/form-data" action="servlet/UploadServlet">
Who are you: <input type="text" name="username" /><br />
Choose the file to upload:
<input type="file" name="fileID" /><br />
<input type="submit" value="SEND" />
</form>
</body>
</html>
HTML Form Fields
POST /bin/upload HTTP/1.1

Host: test101
Accept: image/gif, image/jpeg, */*
Accept-Language: en-us
Content-Type: multipart/form-data; boundary=---------------------------7d41b838504d8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Content-Length: 342
Connection: Keep-Alive
Cache-Control: no-cache
HTML Form Fields
-----------------------------7d41b838504d8 Content-Disposition: form-data; name="username"
Peter Lee
-----------------------------7d41b838504d8 Content-Disposition: form-data; name="fileID"; filename="C:temp.html" ContentType: text/plain
File Content...................................................
-----------------------------7d41b838504d8--
Thank you

More Related Content

What's hot

Http-protocol
Http-protocolHttp-protocol
Http-protocol
Toushik Paul
ย 
An Introduction to HTTP
An Introduction to HTTPAn Introduction to HTTP
An Introduction to HTTP
Keerthana Krishnan
ย 
HTTP Request and Response Structure
HTTP Request and Response StructureHTTP Request and Response Structure
HTTP Request and Response Structure
BhagyashreeGajera1
ย 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
Sahil Agarwal
ย 
Http
HttpHttp
Http
Luavis Kang
ย 
Http
HttpHttp
Http
NITT, KAMK
ย 
Http Introduction
Http IntroductionHttp Introduction
Http Introduction
Akshay Dhole
ย 
HTTP Protocol Basic
HTTP Protocol BasicHTTP Protocol Basic
HTTP Protocol Basic
Chuong Mai
ย 
Hyper text transport protocol
Hyper text transport protocolHyper text transport protocol
Hyper text transport protocol
HarshithaAllu
ย 
Dictributed application by Waqas
Dictributed application by WaqasDictributed application by Waqas
Dictributed application by Waqas
Waqas !!!!
ย 
Under the Covers with the Web
Under the Covers with the WebUnder the Covers with the Web
Under the Covers with the Web
Trevor Lohrbeer
ย 
Http protocol
Http protocolHttp protocol
Http protocol
Arpita Naik
ย 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocol
Rajan Pandey
ย 
What's up with HTTP?
What's up with HTTP?What's up with HTTP?
What's up with HTTP?
Mark Nottingham
ย 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocol
selvakumar_b1985
ย 
HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)
Gurjot Singh
ย 
HTTP Definition and Basics.
HTTP Definition and Basics.HTTP Definition and Basics.
HTTP Definition and Basics.
Halah Salih
ย 
HTTP
HTTPHTTP
HTTP Presentation
HTTP Presentation HTTP Presentation
HTTP Presentation
Lana Dujanovic
ย 

What's hot (19)

Http-protocol
Http-protocolHttp-protocol
Http-protocol
ย 
An Introduction to HTTP
An Introduction to HTTPAn Introduction to HTTP
An Introduction to HTTP
ย 
HTTP Request and Response Structure
HTTP Request and Response StructureHTTP Request and Response Structure
HTTP Request and Response Structure
ย 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
ย 
Http
HttpHttp
Http
ย 
Http
HttpHttp
Http
ย 
Http Introduction
Http IntroductionHttp Introduction
Http Introduction
ย 
HTTP Protocol Basic
HTTP Protocol BasicHTTP Protocol Basic
HTTP Protocol Basic
ย 
Hyper text transport protocol
Hyper text transport protocolHyper text transport protocol
Hyper text transport protocol
ย 
Dictributed application by Waqas
Dictributed application by WaqasDictributed application by Waqas
Dictributed application by Waqas
ย 
Under the Covers with the Web
Under the Covers with the WebUnder the Covers with the Web
Under the Covers with the Web
ย 
Http protocol
Http protocolHttp protocol
Http protocol
ย 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocol
ย 
What's up with HTTP?
What's up with HTTP?What's up with HTTP?
What's up with HTTP?
ย 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocol
ย 
HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)HyperText Transfer Protocol (HTTP)
HyperText Transfer Protocol (HTTP)
ย 
HTTP Definition and Basics.
HTTP Definition and Basics.HTTP Definition and Basics.
HTTP Definition and Basics.
ย 
HTTP
HTTPHTTP
HTTP
ย 
HTTP Presentation
HTTP Presentation HTTP Presentation
HTTP Presentation
ย 

Viewers also liked

Barnes The World Wide Web Module 5
Barnes The World Wide Web Module 5Barnes The World Wide Web Module 5
Barnes The World Wide Web Module 5
netmaven
ย 
What is a Server
What is a ServerWhat is a Server
What is a Server
Kuwait10
ย 
Chapter 2 The Internet & World Wide Web
Chapter 2 The Internet & World Wide WebChapter 2 The Internet & World Wide Web
Chapter 2 The Internet & World Wide Web
Patty Ramsey
ย 
Introduction to HTTP protocol
Introduction to HTTP protocolIntroduction to HTTP protocol
Introduction to HTTP protocol
Aviran Mordo
ย 
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
sanjoysanyal
ย 
World Wide Web and Internet
World Wide Web and InternetWorld Wide Web and Internet
World Wide Web and Internet
Janecatalla
ย 
Internet and World Wide Web
Internet and World Wide WebInternet and World Wide Web
Internet and World Wide Web
Samudin Kassan
ย 
E Mail Basic
E Mail BasicE Mail Basic
E Mail Basic
Lisa Lindsay
ย 
Http Vs Https .
Http Vs Https . Http Vs Https .
Http Vs Https .
simplyharshad
ย 
Smuggling TCP traffic through HTTP
Smuggling TCP traffic through HTTPSmuggling TCP traffic through HTTP
Smuggling TCP traffic through HTTP
Dรกvid Halรกsz
ย 
Email
EmailEmail
Email
ARSD College
ย 
Electronic mail
Electronic mailElectronic mail
Electronic mail
Diwaker Pant
ย 
world wide web
world wide webworld wide web
world wide web
Zainab Muneer
ย 
Email - Electronic Mail
Email - Electronic MailEmail - Electronic Mail
Email - Electronic Mail
Peter R. Egli
ย 
Email ppt
Email pptEmail ppt
Email ppt
melgade
ย 

Viewers also liked (15)

Barnes The World Wide Web Module 5
Barnes The World Wide Web Module 5Barnes The World Wide Web Module 5
Barnes The World Wide Web Module 5
ย 
What is a Server
What is a ServerWhat is a Server
What is a Server
ย 
Chapter 2 The Internet & World Wide Web
Chapter 2 The Internet & World Wide WebChapter 2 The Internet & World Wide Web
Chapter 2 The Internet & World Wide Web
ย 
Introduction to HTTP protocol
Introduction to HTTP protocolIntroduction to HTTP protocol
Introduction to HTTP protocol
ย 
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
ย 
World Wide Web and Internet
World Wide Web and InternetWorld Wide Web and Internet
World Wide Web and Internet
ย 
Internet and World Wide Web
Internet and World Wide WebInternet and World Wide Web
Internet and World Wide Web
ย 
E Mail Basic
E Mail BasicE Mail Basic
E Mail Basic
ย 
Http Vs Https .
Http Vs Https . Http Vs Https .
Http Vs Https .
ย 
Smuggling TCP traffic through HTTP
Smuggling TCP traffic through HTTPSmuggling TCP traffic through HTTP
Smuggling TCP traffic through HTTP
ย 
Email
EmailEmail
Email
ย 
Electronic mail
Electronic mailElectronic mail
Electronic mail
ย 
world wide web
world wide webworld wide web
world wide web
ย 
Email - Electronic Mail
Email - Electronic MailEmail - Electronic Mail
Email - Electronic Mail
ย 
Email ppt
Email pptEmail ppt
Email ppt
ย 

Similar to Http request&response session 1 - by Vignesh.N

Httpbasics 1207412539273264-9-converted
Httpbasics 1207412539273264-9-convertedHttpbasics 1207412539273264-9-converted
Httpbasics 1207412539273264-9-converted
computerorganization
ย 
web_01_HTTP.ppt
web_01_HTTP.pptweb_01_HTTP.ppt
web_01_HTTP.ppt
NIHALKASHINATHSHETYE
ย 
HTTP
HTTPHTTP
HTTP
spacecharge
ย 
HTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
HTTPProtocol HTTPProtocol.pptHTTPProtocol.pptHTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
HTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
VietAnhNguyen337355
ย 
DNS & HTTP overview
DNS & HTTP overviewDNS & HTTP overview
DNS & HTTP overview
Roman Wlodarski
ย 
Http VS. Https
Http VS. HttpsHttp VS. Https
Http VS. Https
Raed Aldahdooh
ย 
Ch2 the application layer protocols_http_3
Ch2 the application layer protocols_http_3Ch2 the application layer protocols_http_3
Ch2 the application layer protocols_http_3
Syed Ariful Islam Emon
ย 
www and http services
www and http serviceswww and http services
www and http services
Jenica Salmorin
ย 
internet programming and java notes 5th sem mca
internet programming and java notes 5th sem mcainternet programming and java notes 5th sem mca
internet programming and java notes 5th sem mca
Renu Thakur
ย 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
hussulinux
ย 
Starting With Php
Starting With PhpStarting With Php
Starting With Php
Harit Kothari
ย 
HTTP.ppt
HTTP.pptHTTP.ppt
HTTP.ppt
Jagdeep Singh
ย 
HTTP.ppt
HTTP.pptHTTP.ppt
HTTP.ppt
NapoMosola
ย 
HTTP_2.ppt
HTTP_2.pptHTTP_2.ppt
HTTP_2.ppt
Ankit Mune
ย 
Chapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxChapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptx
ShitalGhotekar
ย 
Compute rNetwork.pptx
Compute rNetwork.pptxCompute rNetwork.pptx
Compute rNetwork.pptx
ShehryarFreelancer
ย 
Http and its Applications
Http and its ApplicationsHttp and its Applications
Http and its Applications
Nayan Dagliya
ย 
Web Application Technologies
Web Application TechnologiesWeb Application Technologies
Web Application Technologies
Sehan Lee
ย 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
Cathie101
ย 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
Cathie101
ย 

Similar to Http request&response session 1 - by Vignesh.N (20)

Httpbasics 1207412539273264-9-converted
Httpbasics 1207412539273264-9-convertedHttpbasics 1207412539273264-9-converted
Httpbasics 1207412539273264-9-converted
ย 
web_01_HTTP.ppt
web_01_HTTP.pptweb_01_HTTP.ppt
web_01_HTTP.ppt
ย 
HTTP
HTTPHTTP
HTTP
ย 
HTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
HTTPProtocol HTTPProtocol.pptHTTPProtocol.pptHTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
HTTPProtocol HTTPProtocol.pptHTTPProtocol.ppt
ย 
DNS & HTTP overview
DNS & HTTP overviewDNS & HTTP overview
DNS & HTTP overview
ย 
Http VS. Https
Http VS. HttpsHttp VS. Https
Http VS. Https
ย 
Ch2 the application layer protocols_http_3
Ch2 the application layer protocols_http_3Ch2 the application layer protocols_http_3
Ch2 the application layer protocols_http_3
ย 
www and http services
www and http serviceswww and http services
www and http services
ย 
internet programming and java notes 5th sem mca
internet programming and java notes 5th sem mcainternet programming and java notes 5th sem mca
internet programming and java notes 5th sem mca
ย 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
ย 
Starting With Php
Starting With PhpStarting With Php
Starting With Php
ย 
HTTP.ppt
HTTP.pptHTTP.ppt
HTTP.ppt
ย 
HTTP.ppt
HTTP.pptHTTP.ppt
HTTP.ppt
ย 
HTTP_2.ppt
HTTP_2.pptHTTP_2.ppt
HTTP_2.ppt
ย 
Chapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxChapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptx
ย 
Compute rNetwork.pptx
Compute rNetwork.pptxCompute rNetwork.pptx
Compute rNetwork.pptx
ย 
Http and its Applications
Http and its ApplicationsHttp and its Applications
Http and its Applications
ย 
Web Application Technologies
Web Application TechnologiesWeb Application Technologies
Web Application Technologies
ย 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
ย 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
ย 

More from Navaneethan Naveen

Class inheritance 13 session - SHAN
Class inheritance 13 session - SHANClass inheritance 13 session - SHAN
Class inheritance 13 session - SHAN
Navaneethan Naveen
ย 
Python session 12
Python session 12Python session 12
Python session 12
Navaneethan Naveen
ย 
Python session 11
Python session 11Python session 11
Python session 11
Navaneethan Naveen
ย 
V irtualisation.1
V irtualisation.1V irtualisation.1
V irtualisation.1
Navaneethan Naveen
ย 
Python session.11 By Shanmugam
Python session.11 By ShanmugamPython session.11 By Shanmugam
Python session.11 By Shanmugam
Navaneethan Naveen
ย 
Virtualisation-11
Virtualisation-11Virtualisation-11
Virtualisation-11
Navaneethan Naveen
ย 
Networking session-4-final by aravind.R
Networking session-4-final by aravind.RNetworking session-4-final by aravind.R
Networking session-4-final by aravind.R
Navaneethan Naveen
ย 
Networking session3
Networking session3Networking session3
Networking session3
Navaneethan Naveen
ย 
WIN-ADCS-10
WIN-ADCS-10WIN-ADCS-10
WIN-ADCS-10
Navaneethan Naveen
ย 
Python session 10
Python session 10Python session 10
Python session 10
Navaneethan Naveen
ย 
Python multithreading session 9 - shanmugam
Python multithreading session 9 - shanmugamPython multithreading session 9 - shanmugam
Python multithreading session 9 - shanmugam
Navaneethan Naveen
ย 
Python session 8
Python session 8Python session 8
Python session 8
Navaneethan Naveen
ย 
Win 8th
Win 8thWin 8th
Win 8th
Navaneethan Naveen
ย 
Virtualization session 8
Virtualization session 8Virtualization session 8
Virtualization session 8
Navaneethan Naveen
ย 
Virtualization session 7 by Gugan
Virtualization session 7 by GuganVirtualization session 7 by Gugan
Virtualization session 7 by Gugan
Navaneethan Naveen
ย 
Python session 7 by Shan
Python session 7 by ShanPython session 7 by Shan
Python session 7 by Shan
Navaneethan Naveen
ย 
Virtualization s4.1
Virtualization s4.1Virtualization s4.1
Virtualization s4.1
Navaneethan Naveen
ย 
Python session 6
Python session 6Python session 6
Python session 6
Navaneethan Naveen
ย 
Gpo windows(4)
Gpo windows(4)Gpo windows(4)
Gpo windows(4)
Navaneethan Naveen
ย 
Windows session 5 : Basics of active directory
Windows session 5 : Basics of active directoryWindows session 5 : Basics of active directory
Windows session 5 : Basics of active directory
Navaneethan Naveen
ย 

More from Navaneethan Naveen (20)

Class inheritance 13 session - SHAN
Class inheritance 13 session - SHANClass inheritance 13 session - SHAN
Class inheritance 13 session - SHAN
ย 
Python session 12
Python session 12Python session 12
Python session 12
ย 
Python session 11
Python session 11Python session 11
Python session 11
ย 
V irtualisation.1
V irtualisation.1V irtualisation.1
V irtualisation.1
ย 
Python session.11 By Shanmugam
Python session.11 By ShanmugamPython session.11 By Shanmugam
Python session.11 By Shanmugam
ย 
Virtualisation-11
Virtualisation-11Virtualisation-11
Virtualisation-11
ย 
Networking session-4-final by aravind.R
Networking session-4-final by aravind.RNetworking session-4-final by aravind.R
Networking session-4-final by aravind.R
ย 
Networking session3
Networking session3Networking session3
Networking session3
ย 
WIN-ADCS-10
WIN-ADCS-10WIN-ADCS-10
WIN-ADCS-10
ย 
Python session 10
Python session 10Python session 10
Python session 10
ย 
Python multithreading session 9 - shanmugam
Python multithreading session 9 - shanmugamPython multithreading session 9 - shanmugam
Python multithreading session 9 - shanmugam
ย 
Python session 8
Python session 8Python session 8
Python session 8
ย 
Win 8th
Win 8thWin 8th
Win 8th
ย 
Virtualization session 8
Virtualization session 8Virtualization session 8
Virtualization session 8
ย 
Virtualization session 7 by Gugan
Virtualization session 7 by GuganVirtualization session 7 by Gugan
Virtualization session 7 by Gugan
ย 
Python session 7 by Shan
Python session 7 by ShanPython session 7 by Shan
Python session 7 by Shan
ย 
Virtualization s4.1
Virtualization s4.1Virtualization s4.1
Virtualization s4.1
ย 
Python session 6
Python session 6Python session 6
Python session 6
ย 
Gpo windows(4)
Gpo windows(4)Gpo windows(4)
Gpo windows(4)
ย 
Windows session 5 : Basics of active directory
Windows session 5 : Basics of active directoryWindows session 5 : Basics of active directory
Windows session 5 : Basics of active directory
ย 

Recently uploaded

RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
ย 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
ย 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
ย 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
ย 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
ย 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
ย 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
ย 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
ย 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
ย 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
ย 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
ย 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
ย 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
ย 
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ   ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdfู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ   ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ
ย 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
ย 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
National Information Standards Organization (NISO)
ย 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
ย 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
ย 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
ย 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
ย 

Recently uploaded (20)

RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
ย 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
ย 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
ย 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
ย 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
ย 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
ย 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
ย 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
ย 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
ย 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
ย 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
ย 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
ย 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
ย 
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ   ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdfู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ   ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ย 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
ย 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
ย 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
ย 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
ย 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
ย 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
ย 

Http request&response session 1 - by Vignesh.N

  • 1. Http Request & Response
  • 2. HyperText Transfer Protocol (HTTP) ๏ฌ ๏ฌ ๏ฌ ๏ฌ most popular application protocol used in the Internet (or The WEB) An HTTP client sends a request message to an HTTP server The server, in turn, returns a response message. In other words, HTTP is a pull protocol, the client pulls information from the server (instead of server pushes information down to the client). HTTP is a stateless protocol. In other words, the current request does not know what has been done in the previous requests.
  • 4. Uniform Resource Locator (URL) A URL (Uniform Resource Locator) is used to uniquely identify a resource over the web. URL has the following syntax: protocol://hostname:port/path-and-file-name There are 4 parts in a URL: Protocol: The application-level protocol used by the client and server, e.g., HTTP, FTP, and telnet. Hostname: The DNS domain name (e.g., www.test101.com) or IP address (e.g., 192.128.1.2) of the server. Port: The TCP port number that the server is listening for incoming requests from the clients. Path-and-file-name: The name and location of the requested resource, under the server document base directory. For example, in the URL http://www.test101.com/docs/index.html, the communication protocol is HTTP; the hostname is www.test101.com. The port number was not specified in the URL, and takes on the default number, which is TCP port 80 for HTTP. The path and file name for the resource to be located is "/docs/index.html". Other examples of URL are: ftp://www.ftp.org/docs/test.txt mailto:user@test101.com
  • 5. Important Default Port numbers 443 TCP Hypertext Transfer Protocol over TLS/SSL (HTTPS). 115 TCP Simple/secure File Transfer Protocol (SFTP). 80 TCP Hypertext Transfer Protocol (HTTP). 21 TCP FTP control (command). 22 TCP Secure Shell (SSH) โ€” used for secure logins. 23 TCP Telnet protocol. 25 TCP Simple Mail Transfer Protocol (SMTP). 115 TCP Simple File Transfer Protocol (SFTP). 110 TCP Post Office Protocol v3 (POP3). 1414TCP IBM WebSphere MQ (formerly known as MQSeries). 9060TCP WebSphere Application Server Administration Console. 9080TCP WebSphere Application Server HTTP Transport (port 1) default. 8080TCP Apache Tomcat. 5432TCP PostgreSQL database system. 3306TCP MySQL database system. 1521TCP Oracle database default listener.
  • 7. Http Request Message Format The format of an HTTP request message is as follow:
  • 8. Http Request Message Request Line The first line of the header is called the request line, followed by optional request headers. The request line has the following syntax: request-method-name request-URI HTTP-version request-method-name: HTTP protocol defines a set of request methods, e.g., GET, POST, HEAD, and OPTIONS. The client can use one of these methods to send a request to the server. * case sensitive and must be in uppercase. request-URI: specifies the resource requested. HTTP-version: Two versions are currently in use: HTTP/1.0 and HTTP/1.1. Examples of request line are: GET /test.html HTTP/1.1 HEAD /query.html HTTP/1.0 POST /index.html HTTP/1.1
  • 9. Http Request Message Request Headers The request headers are in the form of name:value pairs. Multiple values, separated by commas, can be specified. request-header-name: request-header-value1, requestheader-value2, ... Examples of request headers are: Host: www.xyz.com Connection: Keep-Alive Accept: image/gif, image/jpeg, */* Accept-Language: us-en, fr, cn username=vignesh&password=qwer1234&......
  • 10. Http Request Message Format GET /docs/index.html HTTP/1.1 Host: www.test101.com Accept: image/gif, image/jpeg, */* Accept: */* Accept-Language: en-us Accept-Encoding: gzip, deflate Referer:http://localhost:8080/home Cookie:JSESSIONID=DFC52DC1584F89D94009014A77C111EC;city=Coimbatore; User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.102 Chrome/32.0.1700.102 Safari/537.36 Cache-Control: max-age=0 (blank line)
  • 11. Http Response HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Expires: Sun, 01 Mar 2015 13:46:19 GMT Cache-Control: max-age=31556926, must-revalidate Date: Sat, 01 Mar 2014 07:57:33 GMT Set-Cookie:JSESSIONID=1D9B00464C03A0923E0AE77ADE16416A; Path=/; HttpOnly Content-Type:text/html;charset=UTF-8 <html><body><h1>It works!</h1></body></html>
  • 13. Http Response Message Status Line The first line is called the status line, followed by optional response header(s). The status line has the following syntax: HTTP-version status-code reasonphrase HTTP-version: The HTTP version used in this session. Either HTTP/1.0 and HTTP/1.1. status-code: a 3-digit number generated by the server to reflect the outcome of the request.
  • 14. Http Response Message Response Headers The response headers are in the form name:value pairs: response-header-name: response-header-value1, response-header-value2, ... Examples of response headers are: Content-Type: text/html Content-Length: 35 Connection: Keep-Alive Keep-Alive: timeout=15, max=100
  • 16. Http Response Status Code Some commonly encountered status codes are: 100 Continue: The server received the request and in the process of giving the response. 200 OK: The request is fulfilled. 301 Move Permanently: The resource requested for has been permanently moved to a new location. The URL of the new location is given in the response header called Location. The client should issue a new request to the new location. Application should update all references to this new location.
  • 17. Http Request Using HTML Form <html> <head><title>Login</title></head> <body> <h2>LOGIN</h2> <form method="get/post/delete" action="/user/login"> Username: <input type="text" name="user" size="25" /><br /> Password: <input type="password" name="pw" size="10" /><br /><br />
  • 18. HTML Form Fields A form contains fields. The types of field include: Text Box: produced by <input type="text">. Password Box: produced by <input type="password">. Radio Button: produced by <input type="radio">. Checkbox: produced by <input type="checkbox">. Selection: produced by <select> and <option>. Text Area: produced by <textarea>. Submit Button: produced by <input type="submit">. Reset Button: produced by <input type="reset">. Hidden Field: produced by <input type="hidden">. Button: produced by <input type="button"> and <button> Query String name1=value1&name2=value2&name3=value3&...
  • 19. HTML Form Fields The query string can be sent to the server using either HTTP GET or POST request method, which is specified in the <form>'s attribute "method". <form method="get" action="url"> If GET request method is used, the URL-encoded query string will be appended behind the request-URI after a "?" character, i.e., GET request-URI?query-string HTTP-version (other optional request headers) (blank line) (optional request body)
  • 20. HTML Form Fields Using GET request to send the query string has the following drawbacks: The amount of data you could append behind request-URI is limited. If this amount exceed a server-specific threshold, the server would return an error "414 Request URI too Large". The URL-encoded query string would appear on the address box of the browser.
  • 21. HTML Form Fields <html> <head><title>Login</title></head> <body> <h2>LOGIN</h2> <form method="get" action="/bin/login"> Username: <input type="text" name="user" size="25" /><br /> Password: <input type="password" name="pw" size="10" /><br /><br /> <input type="hidden" name="action" value="login" /> <input type="submit" value="SEND" /> </form> </body> </html>
  • 22. HTML Form Fields Request Data GET /bin/login?user=Peter+Lee&pw=123456&action=login HTTP/1.1 Accept: image/gif, image/jpeg, */* Referer: http://127.0.0.1:8000/login.html Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Host: 127.0.0.1:8000 Connection: Keep-Alive Address Bar http://127.0.0.1:8000/bin/login?user=Peter+Lee&pw=123456&action=login
  • 23. HTML Form Fields <html> <head><title>Login</title></head> <body> <h2>LOGIN</h2> <form method="post" action="/bin/login"> Username: <input type="text" name="user" size="25" /><br /> Password: <input type="password" name="pw" size="10" /><br /><br /> <input type="hidden" name="action" value="login" /> <input type="submit" value="SEND" /> </form> </body> </html>
  • 24. HTML Form Fields Request Data GET /bin/login HTTP/1.1 Accept: image/gif, image/jpeg, */* Referer: http://127.0.0.1:8000/login.html Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Host: 127.0.0.1:8000 Connection: Keep-Alive user=Peter+Lee&pw=123456&action=login Address Bar http://127.0.0.1:8000/bin/login
  • 25. HTML Form Fields File Upload using multipart/form-data POST Request <html> <head><title>File Upload</title></head> <body> <h2>Upload File</h2> <form method="post" enctype="multipart/form-data" action="servlet/UploadServlet"> Who are you: <input type="text" name="username" /><br /> Choose the file to upload: <input type="file" name="fileID" /><br /> <input type="submit" value="SEND" /> </form> </body> </html>
  • 26. HTML Form Fields POST /bin/upload HTTP/1.1 Host: test101 Accept: image/gif, image/jpeg, */* Accept-Language: en-us Content-Type: multipart/form-data; boundary=---------------------------7d41b838504d8 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Content-Length: 342 Connection: Keep-Alive Cache-Control: no-cache
  • 27. HTML Form Fields -----------------------------7d41b838504d8 Content-Disposition: form-data; name="username" Peter Lee -----------------------------7d41b838504d8 Content-Disposition: form-data; name="fileID"; filename="C:temp.html" ContentType: text/plain File Content................................................... -----------------------------7d41b838504d8--