Materi 1 Kuliah Pemrograman Web

34
HTTP Pemrograman Web Antonius PG Manginsela [email protected], [email protected]

description

Topik HTTP dalam Kuliah Pemrograman Web

Transcript of Materi 1 Kuliah Pemrograman Web

Page 1: Materi 1 Kuliah Pemrograman Web

HTTPPemrograman WebAntonius PG [email protected], [email protected]

Page 2: Materi 1 Kuliah Pemrograman Web

Company Logo

Topik Bahasan

5. Versi HTTP

4. Connections

3. HTTP Messages

2. Overview HTTP

1. Terminologi & Definisi

6. Komponen Arsitektur Web

Page 3: Materi 1 Kuliah Pemrograman Web

user ISP

internet

Web server

http://www.facebook.com.

DNS

Internet & Akses Web

Page 4: Materi 1 Kuliah Pemrograman Web

[email protected]

1. TerminologiInternet :

Interconected Network (jaringan komputer yang saling interkoneksi.

WWW :World Wide Web

Web Page | Laman WebHalaman world wide web

Web Site | Situs Web :Situs World Wide Web

Home page | Beranda :Halaman Utama / Indeks

HTTP :Hyper Text Transfer Protocol

HTML :Hyper Text Mark Up Language

Browser :Chrome, Internet Expolorer, Mozilla/Firefox, etc

Page 5: Materi 1 Kuliah Pemrograman Web

2. Overview HTTPHTTP: The Internet's Multimedia Courier

Jutaaan data gambar .JPEG,laman HTML, File Teks, Video/ Film MPEG, WAV audio files, Java applets, dan bentuk-bentuk lainnya berjalan dan berpindah melalui Internet setiap hari 7/24. HTTP memindahkan paket besar informasi dengan cepat, tepat dan reliable dari web server ke komputer atau telepon pintar setiap individu.

[email protected]

Page 6: Materi 1 Kuliah Pemrograman Web

Web Client & Server

[email protected]

1. Membuka sebuah laman : "http://www.oreilly.com/index.html," 2. Browser akan mengirimkan permintaan HTTP ke server

www.oreilly.com3. Server akan meresponse dengan mencari objek yang diminta,

halaman awal adalah "/index.html“, jika ada maka objek akandikirimkan ke klien dalam bentuk HTTP, bersama denganinformasi data panjang object dan informasi lainnya.

Page 7: Materi 1 Kuliah Pemrograman Web

Web Client & Server

[email protected]

Komponen-komponen komunikasi Web Client & Web Server 1. Resources – Jenis, isi dan lokasi dari data / media pada laman web2. Transactions – Jenis Transaksi antara Client & Server3. Messages – Pesan yang di kirim dan diterima4. Connections – Koneksi 5. Protocol - Aturan / tata cara

Arsitektur Komponen Web 1. Proxies

HTTP intermediaries that sit between clients and servers2. Caches

HTTP storehouses that keep copies of popular web pages close to clients 3. Gateways

Special web servers that connect to other applications4. Tunnels

Special proxies that blindly forward HTTP communications5. Agents

Semi-intelligent web clients that make automated HTTP requests

Page 8: Materi 1 Kuliah Pemrograman Web

2.1 Web Resources

[email protected]

Jenis Web Sources :1. Media Types2. URIs3. URLs4. URNs

A web resource is the source of web content

Page 9: Materi 1 Kuliah Pemrograman Web

2.1.1 Jenis Data/Media

[email protected]

MIME type. : MIME (Multipurpose Internet Mail Extensions) Digunakan pada protocol HTTP untuk memberikan keterangan dan label mengenai isi multimdia dalam halaman web

• HTML-formatted text document : ”text/html” • ASCII text document : ”text/plain” • JPEG : ”image/jpeg”• GIF-format : ”image/gif”• Apple QuickTime : ”video/quicktime”• Microsoft PowerPoint : ”application/vnd.ms-powerpoint”

Page 10: Materi 1 Kuliah Pemrograman Web

2.1.2 URIs

[email protected]

URI :Universal Resources Identifier

Page 11: Materi 1 Kuliah Pemrograman Web

2.1.3 URLs

[email protected]

URLs: Uniform Resource Locator

1. URL scheme, memberitahukan protocol http yang digunakan : http, ftp, mail etc

2. Nama Domain (www.polimdo.ac.id) adalah lokasi server/hosting3. Lokasi Resources (//index.html)

scheme server location resource path:// /

Page 12: Materi 1 Kuliah Pemrograman Web

2.1.3 URLs

[email protected]

Component Description Default value

scheme Which protocol to use when accessing a server to get a resource. Noneuser The username some schemes require to access a resource. anonymous

password The password that may be included after the username, separated by a colon (:). <Email address>

host The hostname or dotted IP address of the server hosting the resource. None

port The port number on which the server hosting the resource is listening. Many schemes have default port numbers (the default port number for HTTP is 80).

Scheme-specific

path The local name for the resource on the server, separated from the previous URL components by a slash (/). The syntax of the path component is server- and scheme-specific. None

paramsUsed by some schemes to specify input parameters. Params are name/value pairs. A URL can contain multiple params fields, separated from themselves and the rest of the path by semicolons (;).

None

queryUsed by some schemes to pass parameters to active applications (such as databases, bulletin boards, search engines, and other Internet gateways). There is no common format for the contents of the query component. It is separated from the rest of the URL by the "?" character.

None

fragA name for a piece or part of the resource. The frag field is not passed to the server when referencing the object; it is used internally by the client. It is separated from the rest of the URL by the "#" character.

None

Syntax :<scheme>://<user>:<password>@<host>:<port>/<path>;<params>?<query>#<frag>

Tabel Komponen-komponen URL

Page 13: Materi 1 Kuliah Pemrograman Web

2.1.3 URNs

[email protected]

• A URN serves as a unique name for a particular piece of content, independent of where the resource currently resides.

• These location-independent URNs allow resources to move from place to place. URNs also allow resources to be accessed by multiple network access protocols while maintaining the same name.

• For example, the following URN might be used to name the Internet standards document "RFC 2141" regardless of where it resides (it may even be copied in several places):

urn:ietf:rfc:2141• URNs are still experimental and not yet widely adopted. To work effectively,

URNs need a supporting infrastructure to resolve resource locations; the lack of such an infrastructure has also slowed their adoption

Uniform Resource Name

Page 14: Materi 1 Kuliah Pemrograman Web

2.2 Transactions

[email protected]

• Methods• Status Codes• Multiple Objects

Transaksi HTTP : “request” (client to server), “response” (server to client)Disebut “HTTP messages”

Page 15: Materi 1 Kuliah Pemrograman Web

2.2.1 Methods

[email protected]

GET PUT

HEAD

POST

Page 16: Materi 1 Kuliah Pemrograman Web

2.2.1 Methods

[email protected]

DELETE OPTION

TRACE

Extension Methods

Method Description

LOCKAllows a user to "lock" a resource—for example, you could lock a resource while you are editing it to prevent others from editing it at the same time

MKCOL Allows a user to create a resource

COPY Facilitates copying resources on a server

MOVE Moves a resource on a server

Page 17: Materi 1 Kuliah Pemrograman Web

2.2.2 Status Codes

[email protected]

Kelompok Status Codes :1. 100-199: Informational Status Codes2. 200-299: Success Status Codes3. 300-399: Redirection Status Codes4. 400-499: Client Error Status Codes5. 500-599: Server Error Status Codes

Setiap pesan balasan dari Server ke Klien berisi “Status Code”.Status Code adalah tiga digit kode numeric yang memberitahukan klien jika permintaan berhasil atau kondisi/aksi yang diperlukan.

Page 18: Materi 1 Kuliah Pemrograman Web

2.2.3 Multi Objek

[email protected]

Jadi, "web page" sering merupakankumpulan dari berbagai resources bukanhanya sebuah resource.

Page 19: Materi 1 Kuliah Pemrograman Web

3. HTTP Messages

[email protected]

Request Messages Response Messages

HTTP messages adalah paket-paket data yang digunakan untuk memindahkandata/informasi keberbagai tujuan. Terdiri atas :1. Start line

Untuk memberikan informasi awal atas permintaan/ request atau apa yang terjadiatas permintaan / response.

2. Header fields Setiap header fields terdiri atas nama dan nilai yang dipisahkan oleh titik dua (:) diakhiri dengan 1 baris kosong.

3. Body Berisi berbagai jenis data (teks, gambar, video, audio etc)Requet body membawa permintaan data ke ServerResponse body membawa data ke client

Page 20: Materi 1 Kuliah Pemrograman Web

3. HTTP Messages

[email protected]

Page 21: Materi 1 Kuliah Pemrograman Web

4. Connections

[email protected]

1. TCP/IP2. Connections, IP Addresses, and Port Numbers

HTTP NETWORK PROTOCOL STACK

TCP/IP LAYER

HTTP : application layer protocol. TCP :

Error-free data transportation In-order delivery Unsegmented data stream

Sekali koneksi TCP telah terbentuk,pertukaran messages antar klien &server tidak hilang, tertukar maupunrusak.

Page 22: Materi 1 Kuliah Pemrograman Web

4.1 IP Addresses & Numbers

[email protected]

Before an HTTP client can send a message to a server, it needs to establish a TCP/IP connection between the client and server using Internet protocol (IP) addresses and port numbers.

In TCP, you need the IP address of the server computer and the TCP port number associated with the specific software program running on the server.

Contoh : http://www.polimdo.ac.id/index.html http://119.81.88.232:80/index.html

Page 23: Materi 1 Kuliah Pemrograman Web

Koneksi Browser

[email protected]

a. The browser extracts the server's hostname from the URL.

b. The browser converts the server's hostname into the server's IP address.

c. The browser extracts the port number (if any) from the URL.

d. The browser establishes a TCP connection with the web server.

e. The browser sends an HTTP request message to the server.

f. The server sends an HTTP response back to the browser.

g. The connection is closed, and the browser displays the document.

a

b

c d

e

f

g

Page 24: Materi 1 Kuliah Pemrograman Web

5. Versi HTTP HTTP/0.9

Support GET method, tidak support MIME, HTTP headers, atau version numbers.

HTTP/1.0 1.0 was the first version of Support tampilan grafik dan form-interaktif pada halaman web

HTTP/1.0+ Dikembangkan mid-1990s kebutuhan penggunaan web komersil, Fitur

ditambahkan "keep-alive" connections, virtual hosting support, and proxy connection support, dan menjadi standar de-facto.

HTTP/1.1 , Fokus pada perbaikan architectural flaws dalam disain HTTP,. HTTP/1.1 is the

current version of HTTP.

HTTP-NG (a.k.a. HTTP/2.0)tambahkan disini

[email protected]

Page 25: Materi 1 Kuliah Pemrograman Web

6. Komponen Arsitektur Web

Proxies [Server] Alat yang terletak diantara clients dan servers

Caches Tempat penyimpanan duplikat dari laman, dokumen/ file di

dekat klien (Proxy Server) Gateways / Portal Web Server khusus yang terhubung dengan aplikasi /

serer lainnya. Tunnels Meneruskan komunikasi lain melalui saluran HTTP atau

Non-HTTP. Agents Web Client yang secara otomatis mengirimkan permintaan

HTTP secara terprogram, ex. Search [email protected]

Page 26: Materi 1 Kuliah Pemrograman Web

6.1 Proxies Sebuah proxy alat / aplikasi yang berada diantara client

dan sebuah server, Proxy menerima semua permintaan HTTP dari para client

dan meneruskan ke server tujuan. Proxy digunakan untuk maksud keamanan, memfilter isi

maupun data yang masuk maupun keluar pada client. Contoh :

Mendeteksi virus pada suatu web Filter isi web seperti Pornografi, Kekerasan dlsb.

[email protected]

Topologi Proxy

Page 27: Materi 1 Kuliah Pemrograman Web

6.2 Caches

HTTP proxy server yang menyimpan laman/dokumen/file yang sering diakses (Web Cache) yang melewati sebuah proxy server.

Cara penyimpanan ini memperbaiki kinerja jaringan. Client lebih cepat mengunduh file/laman/dokumen

[email protected]

Topologi Cache Private & Public Cache

Page 28: Materi 1 Kuliah Pemrograman Web

6.3 GatewaysHTTP/FTP GatewayDapat berfungsi seperti penterjemah atau penunjuk jalan untuk menuju/mendapatkan resources

[email protected]

Sebuah Gateway HTTP/FTP menerima permintaan data ke URL FTP melalui HTTP Request, tetapi mengambilnya dengan menggunakan protocol FTP dari FTP Server.

Page 29: Materi 1 Kuliah Pemrograman Web

6.4 TunnelsTunnels meneruskan data/laman http melalui jaringan non-HTTP

[email protected]

Salah satu penggunaan HTTP Tunnel adalah membawa lalulintas data ter-enkripsi atau encrypted Secure Sockets Layer (SSL) melalui sebuah koneksi HTTP dan mengijinkan lalu lintas data SSL melewati sebuah Firewall Jaringan LAN sebuah organisasi.

Page 30: Materi 1 Kuliah Pemrograman Web

6.5 AgentsAutomated search engine "spiders" are agents, fetching web pages around the world

Komputer yang secara otomatis mengakses laman web tanpa diawasi oleh manusia disebut “spider” atau “Web Robots”

[email protected]

Page 31: Materi 1 Kuliah Pemrograman Web

KesimpulanPeran HTTP's sebagai tata cara

mengirim dan menerima file multimediaMempelajarai penggunaan HTTP,

komponen dan struktur.

[email protected]

Hypertext Transfer Protocol (HTTP) dimanfaatkan banyak tugas selain untuk hypertext.

HTTP adalah bahasa komunikasi antara web browser dan web server, dimana kebanyakan komunikasi ini di luar perhatian pemakai web browser.

Page 32: Materi 1 Kuliah Pemrograman Web

Tugas Individu Buka 5 (Lima) Situs Indonesia (.id) :

CO.ID AC.ID GO.ID

Buka 5 (Lima) Situs Luar Negeri .COM .GOV .EDU

Capture Tampilan Halaman Utama masing-masing web

Buat kesimpulan anda sendiri mengenai : Layout / Tata Letak Navigasi / Petunjuk Laman Fasilitas / Fitur

[email protected]

Page 33: Materi 1 Kuliah Pemrograman Web

Referensi & Sumber Internet1. Anon, “The HTTP Definitive Guide”,

O'Reilly & Associates, USA, 2002 2. http://www.w3.org/Protocols/This W3C web page contains many great

links about the HTTP protocol.

[email protected]