SlideShare une entreprise Scribd logo
1  sur  23
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">.
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 requestURI after a "?" character, i.e.,

GET request-URI?query-string HTTP-version
(other optional request headers)
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
<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
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>
Thank you

Contenu connexe

Tendances

Tendances (20)

An Introduction to HTTP
An Introduction to HTTPAn Introduction to HTTP
An Introduction to HTTP
 
Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014
 
Http-protocol
Http-protocolHttp-protocol
Http-protocol
 
HTTP
HTTPHTTP
HTTP
 
What's up with HTTP?
What's up with HTTP?What's up with HTTP?
What's up with HTTP?
 
HTTP
HTTPHTTP
HTTP
 
Http
HttpHttp
Http
 
Http
HttpHttp
Http
 
Lec 7(HTTP Protocol)
Lec 7(HTTP Protocol)Lec 7(HTTP Protocol)
Lec 7(HTTP Protocol)
 
Hypertext transfer protocol (http)
Hypertext transfer protocol (http)Hypertext transfer protocol (http)
Hypertext transfer protocol (http)
 
Hyper text transport protocol
Hyper text transport protocolHyper text transport protocol
Hyper text transport protocol
 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocol
 
21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboards21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboards
 
Http - All you need to know
Http - All you need to knowHttp - All you need to know
Http - All you need to know
 
Http Protocol
Http ProtocolHttp Protocol
Http Protocol
 
Web (HTTP) request to response life cycle
Web (HTTP) request to response life cycleWeb (HTTP) request to response life cycle
Web (HTTP) request to response life cycle
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
Http methods
Http methodsHttp methods
Http methods
 
HTTP
HTTPHTTP
HTTP
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
 

En vedette

μυστράς (2)
μυστράς (2)μυστράς (2)
μυστράς (2)Theod13
 
Tugassejaraharsitektur 131112083046-phpapp01
Tugassejaraharsitektur 131112083046-phpapp01Tugassejaraharsitektur 131112083046-phpapp01
Tugassejaraharsitektur 131112083046-phpapp01frans2014
 
Analisa ecotects
Analisa ecotectsAnalisa ecotects
Analisa ecotectsfrans2014
 
Perencanaan sambungan-profil-baja
Perencanaan sambungan-profil-bajaPerencanaan sambungan-profil-baja
Perencanaan sambungan-profil-bajafrans2014
 
εισαγωγή
εισαγωγή εισαγωγή
εισαγωγή Theod13
 
Tradie Exchange Jobs - Hiring in Australia
Tradie Exchange Jobs - Hiring in AustraliaTradie Exchange Jobs - Hiring in Australia
Tradie Exchange Jobs - Hiring in AustraliaTradieExchange
 
Tradie Exchange Jobs - Referrals in Australia
Tradie Exchange Jobs - Referrals in AustraliaTradie Exchange Jobs - Referrals in Australia
Tradie Exchange Jobs - Referrals in AustraliaTradieExchange
 
2016 IoT Business Forum
2016 IoT Business Forum2016 IoT Business Forum
2016 IoT Business ForumMarlos Bosso
 
Tradie Exchange Jobs Australia
Tradie Exchange Jobs AustraliaTradie Exchange Jobs Australia
Tradie Exchange Jobs AustraliaTradieExchange
 
ნარჩენების სრულად დაშლის დროNew microsoft office power point presentation
ნარჩენების სრულად დაშლის დროNew microsoft office power point presentationნარჩენების სრულად დაშლის დროNew microsoft office power point presentation
ნარჩენების სრულად დაშლის დროNew microsoft office power point presentationNato Khuroshvili
 
An RGB Laser And Its Applications
An RGB Laser And Its ApplicationsAn RGB Laser And Its Applications
An RGB Laser And Its Applicationsznsaja
 
Photoshop Tutorial Clipping path service, Photoshop clipping path. photo clip...
Photoshop Tutorial Clipping path service, Photoshop clipping path. photo clip...Photoshop Tutorial Clipping path service, Photoshop clipping path. photo clip...
Photoshop Tutorial Clipping path service, Photoshop clipping path. photo clip...Clipping Path India
 
Ppipp copy-130823044640-phpapp02
Ppipp copy-130823044640-phpapp02Ppipp copy-130823044640-phpapp02
Ppipp copy-130823044640-phpapp02frans2014
 

En vedette (18)

Web technologies: HTTP
Web technologies: HTTPWeb technologies: HTTP
Web technologies: HTTP
 
Html
HtmlHtml
Html
 
μυστράς (2)
μυστράς (2)μυστράς (2)
μυστράς (2)
 
Tugassejaraharsitektur 131112083046-phpapp01
Tugassejaraharsitektur 131112083046-phpapp01Tugassejaraharsitektur 131112083046-phpapp01
Tugassejaraharsitektur 131112083046-phpapp01
 
Analisa ecotects
Analisa ecotectsAnalisa ecotects
Analisa ecotects
 
Perencanaan sambungan-profil-baja
Perencanaan sambungan-profil-bajaPerencanaan sambungan-profil-baja
Perencanaan sambungan-profil-baja
 
εισαγωγή
εισαγωγή εισαγωγή
εισαγωγή
 
Tradie Exchange Jobs - Hiring in Australia
Tradie Exchange Jobs - Hiring in AustraliaTradie Exchange Jobs - Hiring in Australia
Tradie Exchange Jobs - Hiring in Australia
 
Tradie Exchange Jobs - Referrals in Australia
Tradie Exchange Jobs - Referrals in AustraliaTradie Exchange Jobs - Referrals in Australia
Tradie Exchange Jobs - Referrals in Australia
 
Python session3
Python session3Python session3
Python session3
 
Python slide.1
Python slide.1Python slide.1
Python slide.1
 
2016 IoT Business Forum
2016 IoT Business Forum2016 IoT Business Forum
2016 IoT Business Forum
 
Tradie Exchange Jobs Australia
Tradie Exchange Jobs AustraliaTradie Exchange Jobs Australia
Tradie Exchange Jobs Australia
 
ნარჩენების სრულად დაშლის დროNew microsoft office power point presentation
ნარჩენების სრულად დაშლის დროNew microsoft office power point presentationნარჩენების სრულად დაშლის დროNew microsoft office power point presentation
ნარჩენების სრულად დაშლის დროNew microsoft office power point presentation
 
An RGB Laser And Its Applications
An RGB Laser And Its ApplicationsAn RGB Laser And Its Applications
An RGB Laser And Its Applications
 
Photoshop Tutorial Clipping path service, Photoshop clipping path. photo clip...
Photoshop Tutorial Clipping path service, Photoshop clipping path. photo clip...Photoshop Tutorial Clipping path service, Photoshop clipping path. photo clip...
Photoshop Tutorial Clipping path service, Photoshop clipping path. photo clip...
 
δ.θ
δ.θδ.θ
δ.θ
 
Ppipp copy-130823044640-phpapp02
Ppipp copy-130823044640-phpapp02Ppipp copy-130823044640-phpapp02
Ppipp copy-130823044640-phpapp02
 

Similaire à Http request&response

Under the Covers with the Web
Under the Covers with the WebUnder the Covers with the Web
Under the Covers with the WebTrevor Lohrbeer
 
Web II - 02 - How ASP.NET Works
Web II - 02 - How ASP.NET WorksWeb II - 02 - How ASP.NET Works
Web II - 02 - How ASP.NET WorksRandy Connolly
 
Web essentials client server Lecture1.pptx
Web essentials client server Lecture1.pptxWeb essentials client server Lecture1.pptx
Web essentials client server Lecture1.pptxBalaSubramanian376976
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009Cathie101
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009Cathie101
 
Rpi python web
Rpi python webRpi python web
Rpi python websewoo lee
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1hussulinux
 
009577496.pdf
009577496.pdf009577496.pdf
009577496.pdfEidTahir
 
Проксирование HTTP-запросов web-акселератором / Александр Крижановский (Tempe...
Проксирование HTTP-запросов web-акселератором / Александр Крижановский (Tempe...Проксирование HTTP-запросов web-акселератором / Александр Крижановский (Tempe...
Проксирование HTTP-запросов web-акселератором / Александр Крижановский (Tempe...Ontico
 
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_3Syed Ariful Islam Emon
 

Similaire à Http request&response (20)

HTTP
HTTPHTTP
HTTP
 
Under the Covers with the Web
Under the Covers with the WebUnder the Covers with the Web
Under the Covers with the Web
 
Web II - 02 - How ASP.NET Works
Web II - 02 - How ASP.NET WorksWeb II - 02 - How ASP.NET Works
Web II - 02 - How ASP.NET Works
 
Web essentials client server Lecture1.pptx
Web essentials client server Lecture1.pptxWeb essentials client server Lecture1.pptx
Web essentials client server Lecture1.pptx
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
 
Rpi python web
Rpi python webRpi python web
Rpi python web
 
Appl layer
Appl layerAppl layer
Appl layer
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
 
009577496.pdf
009577496.pdf009577496.pdf
009577496.pdf
 
Network basics
Network basicsNetwork basics
Network basics
 
Проксирование HTTP-запросов web-акселератором / Александр Крижановский (Tempe...
Проксирование HTTP-запросов web-акселератором / Александр Крижановский (Tempe...Проксирование HTTP-запросов web-акселератором / Александр Крижановский (Tempe...
Проксирование HTTP-запросов web-акселератором / Александр Крижановский (Tempe...
 
Starting With Php
Starting With PhpStarting With Php
Starting With Php
 
6 app-tcp
6 app-tcp6 app-tcp
6 app-tcp
 
Http VS. Https
Http VS. HttpsHttp VS. Https
Http VS. Https
 
WWW & HTTP
WWW & HTTPWWW & HTTP
WWW & HTTP
 
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
 
PPT
PPTPPT
PPT
 
WWW and HTTP
WWW and HTTPWWW and HTTP
WWW and HTTP
 
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
 

Dernier

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Dernier (20)

Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Http request&response

  • 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">.
  • 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 requestURI after a "?" character, i.e., GET request-URI?query-string HTTP-version (other optional request headers)
  • 20. 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>
  • 21. 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>
  • 22. 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>