0% found this document useful (0 votes)
4 views

Capa de aplicación

The document discusses the application layer of computer networking, focusing on network application protocols such as HTTP, FTP, and SMTP. It explains the client-server and peer-to-peer architectures, the role of sockets in communication, and the requirements for transport services in various applications. Additionally, it covers the evolution of HTTP, including its versions and the differences between non-persistent and persistent connections.

Uploaded by

2003gfmarta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Capa de aplicación

The document discusses the application layer of computer networking, focusing on network application protocols such as HTTP, FTP, and SMTP. It explains the client-server and peer-to-peer architectures, the role of sockets in communication, and the requirements for transport services in various applications. Additionally, it covers the evolution of HTTP, including its versions and the differences between non-persistent and persistent connections.

Uploaded by

2003gfmarta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Application Layer

Computer
Networking: A Top
Down Approach
6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012

Transparencias adaptadas por:


Carmen Benavides e Isaías García
Application Layer 2-1
Application Layer
2.1 principles of network
applications
2.2 Web and HTTP

Application Layer 2-2


Application layer
our goals:  learn about protocols by
 conceptual, examining popular
implementation aspects application-level
of network application protocols
protocols  HTTP
 transport-layer  FTP
service models  SMTP / POP3 / IMAP
 client-server  DNS
paradigm  …
 peer-to-peer
paradigm

Application Layer 2-3


Creating a network app application
transport
network
data link

write programs that: physical

 run on (different) end systems


 communicate over network
 e.g., web server software
communicates with browser
software

no need to write software for application


transport

network-core devices network


data link application
physical transport
 network-core devices do not network
data link
run user applications physical

 applications on end systems


allows for rapid app
development, propagation

Application Layer 2-4


Some network apps
 e-mail  voice over IP (e.g., Skype)
 web  real-time video
 text messaging conferencing
 remote login  social networking
 P2P file sharing  search
 multi-user network games  …
 streaming stored video  …
(YouTube)

Application Layer 2-5


Application architectures
possible structure of applications:
 client-server
 peer-to-peer (P2P)

Application architecture
It is designed by the application developer and
dictates how the application is structured over the
various end systems.
Client-server architecture
server:
 always-on host
 permanent IP address
 data centers for scaling

no need to write software for


network-core devices
client/server  network-core devices do not
run user applications
 applications on end systems
allows for rapid app
development, propagation

Application Layer 2-7


peer-peer
P2P architecture
 no always-on server
 arbitrary end systems directly
communicate
 peers request service from other
peers, provide service in return to
other peers
 self scalability – new peers bring
new service capacity, as well as
new service demands
 peers are intermittently connected
and change IP addresses
 complex management
 ISP friendly, security, incentives to
volunteer
Application Layer 2-8
Processes communicating
process: program running clients, servers
within a host client process: process that
 within same host, two initiates communication
processes communicate server process: process that
using inter-process waits to be contacted
communication (defined by
OS)
 processes in different hosts
communicate by exchanging
messages

Application Layer 2-9


Sockets
 process sends/receives messages to/from its socket
 socket analogous to door
 sending process shoves message out door
 sending process relies on transport infrastructure on
other side of door to deliver message to socket at
receiving process

application application
socket controlled by
process process app developer

transport transport
network network controlled
link by OS
link Internet
physical physical

Application Layer 2-10


Addressing processes
 to receive messages,  identifier includes both IP
process must have identifier address and port numbers
 host device has unique 32- associated with process on
bit IP address host.
 Q: does IP address of host  example port numbers:
on which process runs  HTTP server: 80
suffice for identifying the  mail server: 25
process?  to send HTTP message to
gaia.cs.umass.edu web
 A: no, many processes server:
can be running on same  IP address: 128.119.245.12
host  port number: 80

Application Layer 2-11


App-layer protocol defines
 types of messages open protocols:
exchanged,  defined in RFCs
 e.g., request, response  allows for interoperability
 message syntax:  e.g., HTTP, SMTP
 what fields in messages proprietary protocols:
& how fields are
 e.g., Skype
delineated
 message semantics
 meaning of information
in fields
 rules for when and how
processes send & respond
to messages

Application Layer 2-12


What transport service does an app need?
data integrity BandWith
 some apps (e.g., file transfer,  some apps (e.g.,
web transactions) require multimedia) require
100% reliable data transfer minimum amount of
 other apps (e.g., audio) can
throughput to be
tolerate some loss “effective”
 other apps (“elastic apps”)

timing make use of whatever


throughput they get
 some apps (e.g., Internet
telephony, interactive security
games) require low delay
to be “effective”  encryption, data integrity,

2-13
Transport service requirements: common apps

application data loss throughput time sensitive

file transfer no loss elastic no


e-mail no loss elastic no
Web documents no loss elastic no
real-time audio/video loss-tolerant audio: 5kbps-1Mbps yes, 100’s
video:10kbps-5Mbps msec
stored audio/video loss-tolerant same as above
interactive games loss-tolerant few kbps up yes, few secs
text messaging no loss elastic yes, 100’s
msec
yes and no

Application Layer 2-14


Internet transport protocols services

TCP service: UDP service:


 reliable transport between  unreliable data transfer
sending and receiving between sending and
process receiving process
 flow control: sender won’t  does not provide:
overwhelm receiver
reliability, flow control,
 congestion control: throttle congestion control,
sender when network
overloaded timing, throughput
 does not provide: timing, guarantee, security,
minimum throughput orconnection setup,
guarantee, security
 connection-oriented: setup
required between client and
server processes

Application Layer 2-15


Internet apps: application, transport protocols

application underlying
application layer protocol transport protocol

e-mail SMTP [RFC 2821] TCP


remote terminal access Telnet [RFC 854] TCP
Web HTTP [RFC 2616] TCP
file transfer FTP [RFC 959] TCP
streaming multimedia HTTP (e.g., YouTube), TCP or UDP
RTP [RFC 1889]
Internet telephony SIP, RTP, proprietary
(e.g., Skype) TCP or UDP

Application Layer 2-16


Application Layer: outline
Principles of network applications
 app architectures
 app requirements
Servicio Web
 Introducción
 Conexiones TCP subyacentes
 Mensajes de HTTP
 Cookies
 Caché en los clientes
 Proxies de HTTP
 SSL

Application Layer 2-18


Internet vs Web Orígen
 A finales de los 60
Internet  ARPAnet
 En 1972 tenía 15 nodos
 Comunicaba ordenadores.
 Conexión remota,
transferencia de ficheros,
email.

Actualmente
 Red de ámbito mundial
 Conecta cientos de
millones de nodos
 ¿Qué conecta?

Fuente de imagen:http://www.taringa.net/posts/info/16879754/Como-se-creo-la-Internet-y-Porque-Resubido.html Application Layer2-19


http://www.pandasecurity.com/spain/mediacenter/consejos/ataque-internet-de-las-cosas/
Internet vs Web
Web  Tim Berners-Lee, en el Cern, 1994
 Sistema de Información Hipermedia
 World Wide Web
 Cambió radicalmente la forma de interactuar.

¿Por qué?
 Ves lo que quieres cuando quieres
 Cualquiera puede publicar información fácilmente.
 Killer applications after 2003
 Se ha apropiado de la funcionalidad de otros servicios

https://los40.com/los40/2017/11/13/video
s/1510584879_602675.html ‘53

¡La Web es el servicio más importante actualmente!


Fuente de imagen:www.thinglink.com/scene/662605069589413890 Application Layer 2-
Servicio Web
Arquitectura Cliente-Servidor

1. Servidor Web
3. URL (Uniform Resource Locator)

2. Cliente Web
5. HyperText Markup Language

HTTP funciona sobre TCP


Puerto 80
Application Layer 2-21
Web and HTML
Resumiendo…

¿Qué es HTML?
Lenguaje de creación de documentos para la World Wide Web

¿Qué es World Wide Web?


Es un SERVICIO de información HIPERMEDIA de la red Internet.

¿Qué es Internet?
Es una red mundial de dispositivos conectados con los protocolos TCP/IP

¿Qué es TCP/IP?
Es un conjunto de especificaciones que define el modo en que dos
dispositivos conectados a una red se comunican
Web and HTML
Resumiendo…

HTML Lenguaje:
formato de documentos

HTTP

TCP

IP Protocolos:
transmisión de
Capa de enlace los documentos por la red

Capa física
Web and HTML

VER TRANSPARENCIAS HTML


Herramienta “inspeccionar elemento” de los navegadores Web (botón derecho)

Application Layer 2-24


Web and HTTP
First, a review…
 web page consists of objects
 object can be HTML file, JPEG image, Java applet,
audio file,…
 web page consists of base HTML-file which can
include several referenced objects
 each object is addressable by a URL, e.g.,
www.someschool.edu/someDept/pic.gif

Application Layer 2-25


Web and HTTP
Se necesita un método para localizar el objeto:

URL: Uniform Resource Locator

http://www.unileon.es/estudiantes/informacion/inicio.htm

http:// indica el protocolo (HTTP)


unileon.es indica el dominio.
www indica el ordenador dentro del dominio
/estudiantes/informacion/ indica el directorio dentro del ordenador
inicio.htm indica la página dentro del directorio
HTTP overview
HTTP: hypertext
transfer protocol
 Web’s application layer
protocol PC running
Firefox browser
 client/server model
 client: browser that
requests, receives,
(using HTTP protocol) server
and “displays” Web running
objects Apache Web
server
 server: Web server
sends (using HTTP iphone running
protocol) objects in Safari browser
response to requests
Dos tipos de Mensajes: Request, Response

Application Layer 2-27


HTTP overview
uses TCP: HTTP is “stateless”
 client initiates TCP  server maintains no
connection (creates information about
socket) to server, port 80 past client requests

 server accepts TCP aside


connection from client protocols that maintain
“state” are complex!
 HTTP messages  past history (state) must be
(application-layer protocol maintained
messages) exchanged  if server/client crashes, their
between browser (HTTP views of “state” may be
client) and Web server inconsistent, must be
(HTTP server) reconciled
 TCP connection closed
Application Layer 2-28
HTTP overview

HTTP 0.9 • Sólo páginas con hipertexto.


• Muy simple (2 pgs)

HTTP 1.0
• 176 pgs
• Introduce tipos MIME (Extensiones Multipropósito de Correo Internet)
• Limitaciones:
• Cada sitio una IP diferente (no virtual hosts)

1996, RFC 1945


• Cada sesión HTTP sólo admite una petición (Conexiones no persistentes)
• No admite cacheo, proxies, recuperación parcial del recurso…

HTTP 1.1
• Soporte para múltiples hosts (virtual hosts)
• Conexiones persistentes y pipelining.
• Recuperación parcial del recurso (P. e. resume)
• Soporta cacheo, proxies.

1999, RFC 2616


• Negociación del contenido.
• Seguridad, posibilidad de autenticación.

Application Layer 2-29


HTTP connections
non-persistent HTTP persistent HTTP
 at most one object sent  multiple objects can be
over TCP connection sent over single TCP
 connection then closed connection between
 downloading multiple client, server
objects required multiple  HTTP/1.1 utiliza por
connections defecto conexiones
 HTTP/1.0 utiliza persistentes, aunque
conexiones no puede usar tb conexiones
persistentes. no persistentes.

Application Layer 2-31


Non-persistent HTTP
suppose user enters URL: (contains text,
www.someSchool.edu/someDepartment/home.index references to 10
jpeg images)
1a. HTTP client initiates TCP
connection to HTTP server
(process) at 1b. HTTP server at host
www.someSchool.edu on port www.someSchool.edu waiting
80 for TCP connection at port 80.
“accepts” connection, notifying
2. HTTP client sends HTTP request client
message (containing URL) into
TCP connection socket. 3. HTTP server receives request
Message indicates that client message, forms response
wants object message containing requested
someDepartment/home.index object, and sends message into
its socket
time
Application Layer 2-32
Non-persistent HTTP
4. HTTP server closes TCP
connection.
5. HTTP client receives response
message containing html file,
displays html. Parsing html file,
finds 10 referenced jpeg objects

time
6. Steps 1-5 repeated for each of
10 jpeg objects
Las conexiones que se abren en el
paso 6 suelen ser en paralelo

Application Layer 2-33


Non-persistent HTTP

non-persistent HTTP issues:


 OS overhead for each TCP
connection
 browsers often open
parallel TCP connections
to fetch referenced objects

Application Layer 2-34


Persistent HTTP
 Server leaves connection
open after sending
response

 Subsequent HTTP
messages between same
client/server sent over
open connection

 Pipelining: client sends


requests as soon as it
encounters a referenced
object

Application Layer 2-35


HTTP request message

 Two types of HTTP messages: request, response


 HTTP request message:
 ASCII (human-readable format)
carriage return character
line-feed character
request line
(GET, POST, GET /index.html HTTP/1.1\r\n
HEAD commands) Host: www-net.cs.umass.edu\r\n
User-Agent: Firefox/3.6.10\r\n
Accept: text/html,application/xhtml+xml\r\n
header Accept-Language: en-us,en;q=0.5\r\n
lines Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
carriage return, Keep-Alive: 115\r\n
line feed at start Connection: keep-alive\r\n
\r\n
of line indicates
end of header lines
Application Layer 2-36
HTTP request message: General format

method sp URL sp Version cr lf request


line
header field name value cr lf
header
~
~ ~
~ lines

header field name value cr lf


cr lf Línea en blanco

~
~ entity body ~
~ body

Application Layer 2-37


HTTP request message: Request line

Specifies the resource being requested


 Name of the method (GET, POST, HEAD,…)
 URL, path.
 HTTP version (HTTP/x.y)

Example: GET /index.html HTTP/1.1\r\n


Host: www-net.cs.umass.edu\r\n
User-Agent: Firefox/3.6.10\r\n
Accept: text/html,application/xhtml+xml\r\n
Accept-Language: en-us,en;q=0.5\r\n
Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
Keep-Alive: 115\r\n
Connection: keep-alive\r\n
\r\n
Application Layer 2-38
HTTP request message: Method types

HTTP/1.0: HTTP/1.1:
 GET  GET, POST, HEAD
 requests server an object  PUT
specifying url
 POST  uploads file in entity
 the client sends data to the
body to path specified
server , typically entered by in URL field
the user in a form  DELETE
 HEAD  deletes file specified in
 As a get but just ask the
headers
the URL field
 asks server to leave requested
object out of response

Application Layer 2-39


HTTP request message: Uploading form input

Web page often


includes form input

POST method:
 input is uploaded to
server in entity body

GET method:
 input is uploaded in URL field of request line:
https://accounts.google.com?Email=carmen.benavides.cuellar%40gmail.com
HTTP response message
protocol status code status phrase
status line
HTTP/1.1 200 OK\r\n
Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n
Server: Apache/2.0.52 (CentOS)\r\n
Last-Modified: Tue, 30 Oct 2007 17:00:02
GMT\r\n
header ETag: "17dc6-a5c-bf716880"\r\n
Accept-Ranges: bytes\r\n
lines Content-Length: 2652\r\n
Keep-Alive: timeout=10, max=100\r\n
Connection: Keep-Alive\r\n
Content-Type: text/html; charset=ISO-8859-
1\r\n
\r\n
data, e.g., data data data data data ...
requested
HTML file
Application Layer 2-41
HTTP response message: Status codes
 Status code appears in 1st line in server-to-
client response message.
 Some sample codes:
200 OK
 request succeeded, requested object later in this msg
301 Moved Permanently
 requested object moved, new location specified later in this msg
(Location:)
400 Bad Request
 request msg not understood by server
404 Not Found
 requested document not found on this server
505 HTTP Version Not Supported
Application Layer 2-42
HTTP response message: Status codes
Si empieza por:

Proporciona información general

La petición ha resultado correcta

El servidor tiene que redireccionar la petición

Error en el lado del cliente. La petición no es válida

Error en el lado del Servidor o no tenemos permisos.

Application Layer 2-43


HTTP messages: Cabeceras
 Header lines ( 0 or more):
 Header-X: value-X <CR><LF>

HTTP/1.0 HTTP/1.1
16 headers 46headers

being mandatory, in
no mandatory request, the Host
header

 In requests, it is recommended to include:


 User-Agent (Mozilla/4.7)
 In responses, it is recommended to include:
 Server ( Apache/1.3)
 Last-Modified (date and time last modified)
Application Layer 2-44
HTTP messages: Header lines
Cabeceras generales referentes al mensaje en sí:

• Indica la fecha completa del mensaje


Date (la hora del servidor cuando envía el
mensaje)

•close: no persistente
Connection
•Keep alive: persistente

Cache-Control • Gestiona y maneja el sistema de cacheo

Son comunes para peticiones y respuestas. Application Layer 2-45


HTTP messages: Header lines
Cabeceras generales referentes al contenido del mensaje (entidad)

• Indica la longitud en bytes de los datos


enviados
Content-Length

• Descripción MIME de la información contenida


en el mensaje (text/html, image/gif)
Content-Type

• Especifica fecha y hora en la que la entidad


debe considerarse obsoleta.
Expires

• Fecha y hora en la que fue modificado por


última vez el objeto
Last- Modified

• Método utilizado para codificar la entidad. Content-


• Se utiliza cuando se envía comprimida Enconding

Application Layer 2-46


Trying out HTTP (client side) for yourself
1. Telnet to your favorite Web server:

telnet www.unileon.es 80 opens TCP connection to port 80


(default HTTP server port) at www.unileon.es
anything typed in sent
to port 80 at www.unileon.es

2. type in a GET HTTP request:


GET /actualidad HTTP/1.1 by typing this in (hit carriage
Host: www.unileon.es return twice), you send
this minimal (but complete)
GET request to HTTP server

3. look at response message sent by HTTP server!


(or use Wireshark to look at captured HTTP request/response)
Application Layer 2-47
HTTP messages: Header lines
Cabeceras Request

• Lista de tipos MIME aceptados por el cliente Accept

• Especifica nombre DNS y puerto (opcional). Permite que


con una IP un Servidor pueda almacenar más de un sitio Host
Web.

• Permite indicar al servidor que le envíe sólo una porción de


la entidad. Permite hacer “resume” cuando se ha cortado Range
una transferencia

• Ofrece información sobre el cliente (navegador) User-Agent

• Indica en qué página estaba el enlace que se pinchó para


realizar esta petición
Referrer

Sólo para peticiones.. Application Layer 2-48


HTTP messages:header lines
Cabeceras Response

• El servidor indica si acepta enviar partes


Accept-Range
de recursos.

• Nueva URL cuando el servidor redirecciona


Location • URL de un nuevo recurso creado con
método PUT.

Server • Indica el tipo y versión del Servidor.

Sólo para respuestas Application Layer 2-49


Cookies
HTTP is designed so that servers
do not store the status of clients

What cookies can be used for: HTTP is used for Keeps the
 authorization state on clients
 shopping carts
 recommendations
 user session state (Web e-mail) aside
Cookies and privacy:
 cookies permit sites to
learn a lot about you
 you may supply name and
e-mail to sites

Application Layer 2-50


User-server state: cookies
Example:
Many Web sites use cookies  Susan always access Internet from PC
Four components:  visits specific e-commerce site for
1) cookie header line of first time
HTTP response message  when initial HTTP requests arrives at
site, site creates:
2) cookie header line in
 unique ID
next HTTP request
 entry in backend database for ID
message
3) cookie file kept on
user’s host, managed by
user’s browser
4) back-end database at
Web site

Application Layer 2-51


Cookies: keeping “state” (cont.)
client server

ebay 8734
usual http request msg Amazon server
cookie file creates ID
usual http response
1678 for user create backend
ebay 8734
set-cookie: 1678 entry database
amazon 1678
usual http request msg
cookie: 1678 cookie- access
specific
usual http response msg action

one week later:


access
ebay 8734 usual http request msg
amazon 1678 cookie: 1678 cookie-
specific
usual http response msg action
Application Layer 2-52
Cookies: Ver cookies almacenadas en vuestro host

Application Layer 2-53


Web Caches: Client cache. Conditional GET
 Goal: don’t send object if cache has
up-to-date cached version
 no object transmission delay client server
 lower link utilization

 Client: specify date of cached copy in HTTP request msg


HTTP request If-modified-since: <date> object
If-modified-since: <date> not
modified
HTTP response
before
 Server: response contains no object HTTP/1.0
if cached copy is up-to-date: 304 Not Modified <date>
HTTP/1.0 304 Not Modified

HTTP request msg


If-modified-since: <date> object
modified
HTTP response after
Es necesario que los servidores HTTP/1.0 200 OK <date>
respondan siempre con la cabecera
Date, con la fecha y hora actual.
<data>
Application Layer 2-54
Web Caches: Client cache. Conditional GET

En Chrome poner en la barra de navegación about:cache

Application Layer 2-55


Web caches: Proxy server
Goal: satisfy client request without involving origin server

 User sets browser: Web


accesses via Proxy proxy
server
 Browser sends all HTTP client
origin
requests to proxy server
 object in proxy: cache
returns object
 else proxy requests
object from origin
server, then returns
client origin
object to client
server

Application Layer 2-56


Web caches: Proxy server
Proxy
server Server for original requesting client
acts as Client to origin server
both client
and server

Typically
University, company, Proxies is
residential ISP installed by
ISP

Reduce response time for client request


Why Web
Caching? Reduce traffic on an institution’s access link
Reduce traffic on Internet

Application Layer 2-57


HTTPS: HTTP sobre SSL

SSL Secure Socket Layer

TCP y UDP no proporcionan encriptación.

SSL permite enviar datos sensibles entre Servidor Web y Navegador Web.

SSL proporciona:

• Confidencialidad
• Integridad de los datos
• Autenticación

Las URLs comienzan por https://

Fuente de imagen: http://www.vattios.com/dominios


HTTPS: SSL and TCP/IP
Application Application
SSL
TCP
TCP
IP IP
Normal application Application with SSL

 SSL provides application programming interface (API) to applications


 SSL es usado por aplicaciones: Web, FTPS, Email, Telnet sobre SSH…
 C and Java SSL libraries/classes readily available

Class SSLSocket
java.lang.Object
java.net.Socket
javax.net.ssl.SSLSocket

public abstract class SSLSocket extends Socket


HTTPS: HTTP sobre SSL
SSL Secure Socket Layer
Todos los navegadores y
Servidores Web
soportan SSL

SSL
Billones de euros se
mueven a través de SSL
Se utiliza en casi todos los
sitios Web comerciales.

Historia
SSL desarrollado por Netscape, 1994
• Versiones 1.0, 2.0, 3.0
TLS Transport Layer Security
• Es SSL v3 modificada.
• Estándar por el IETF (RFC 4346)
• También varias versiones
Se habla indistintamente de SSL/TLS
HTTP 2.0

HTTP/2 is the future of the Web,


and it is already here!
HTTP/2 is about to get very real.
The standard has just been finalized
Leading browsers are beginning to support it

https://www.youtube.com/watch?v=GIDXISQs67w

Fuente: https://http2.akamai.com/
HTTP 3.0

HTTP/3
Oficialmente en el 2020HTTP sobre QUIC.
QUIC is a transport layer protocol designed in 2012 by Jim
Roskind at Google
 Quick UDP Internet Connections
 No da el servicio de fiabilidad
 Cifrado por defecto conTLS
Leading browsers are beginning to support it

Fuente: https://developer.akamai.com/blog/2020/04/14/quick-introduction-http3

You might also like