M1-introductiontotheinternet
M1-introductiontotheinternet
Module 1
KTU Course: CS368 Web Technologies
Instructor: Jinesh Jose
Department of Computer Science & Engineering
Government Engineering College Idukki
Syllabus
• Introduction to the Internet: The World Wide
Web, Web Browsers, Web Servers, Uniform
Resource Locators,
• Multipurpose Internet Mail Extensions,
• The Hypertext Transfer Protocol.
• Common Gateway Interface(CGI),
• Content Management System – Basics
• Case Study: Apache Server, WordPress.
Expected outcome
• Understand the basics of www
• Create a wordpress web site, which allows
logged in users to publish their blogs!
Primary reference
Robert W Sebesta, Programming the World
Wide Web, 7/e, Pearson Education Inc., 2014.
History of Internet
The Internet is a huge collection of computers connected in a
communications network
•Origins
–ARPAnet - late 1960s and early 1970s
• Network reliability
• For ARPA-funded research organizations
•BITnet(Because It’s Time Network), CSnet - late 1970s & early 1980s
• email and file transfer for other institutions
–NSFnet - 1986
• Originally for non-DOD funded places
• Funded by National Science Foundation (NSF)
• Initially connected five supercomputer centers
• By 1990, it had replaced ARPAnet for non-military uses
• Soon became the network for all (by the early 1990s)
–NSFnet eventually became known as the Internet
Internet (cntd)
•What the Internet is:
•A world-wide network of computer networks
•At the lowest level, since 1982, all connections use
TCP/IP
•TCP/IP hides the differences among devices connected
to the Internet
Barry M. Leiner, Vinton G. Cerf, David D. Clark, Robert E. Kahn, Leonard Kleinrock, Daniel C. Lynch, Jon
Postel, Larry G. Roberts, Stephen Wolff. A Brief History of the Internet. Internet Society.
http://www.isoc.org/internet/history/brief.shtml
Internet Protocols
• Internet Protocol (IP) Addresses
– Every node has a unique numeric address
– Form: 32-bit binary number
• New standard, IPv6, has 128 bits (1998)
• Organizations are assigned groups of IPs for
their computers
Cntd..
• Domain names
– Form: host-name.domain-names
– First domain is the smallest; last is the largest
– Last domain specifies the type of organization
– Fully qualified domain name - the host name and
all of the domain names
– DNS servers - convert fully qualified domain
names to IPs
Sample domain name
movies.comedy.marxbros.com
• Here, movies is the hostname and comedy is
movies’s local domain, which is a part of
marxbros’s domain, which is a part of the com
domain.
• The hostname and all of the domain names
are together called a fully qualified domain
name
Domain Name System
Proliferation of protocols
Problem: By the mid-1980s, several different
protocols had been invented and were being
used on the Internet, all with different user
interfaces (Telnet, FTP, Usenet, mailto etc)
GET Request
HEAD Request
<?xml version="1.0"
encoding="utf-8"?> <string
xmlns="http://clearforest.com/
">string</string>
PUT Method
The PUT method is used to request the server to store the
included entity-body at a location specified by the given UR
PUT Request
Response
PUT /hello.htm HTTP/1.1
User-Agent: Mozilla/4.0 HTTP/1.1 201 Created Date: Mon, 27 Jul 2009 12:28:53
(compatible; MSIE5.01; GMT Server: Apache/2.2.14 (Win32) Content-type:
Windows NT) Host: text/html Content-length: 30 Connection: Closed
www.tutorialspoint.com
Accept-Language: en-us <html> <body> <h1>The file was created.</h1> </body>
Connection: Keep-Alive </html>
Content-type: text/html
Content-Length: 182
OPTIONS Request
Response
OPTIONS * HTTP/1.1
User-Agent: Mozilla/4.0 HTTP/1.1 200 OK Date: Mon, 27 Jul 2009 12:28:53 GMT
(compatible; MSIE5.01; Server: Apache/2.2.14 (Win32)
Windows NT) Allow: GET,HEAD,POST,OPTIONS,TRACE
Content-Type: httpd/unix-directory
TRACE Method
The TRACE method is used to echo the contents of an HTTP
Request back to the requester which can be used for
debugging purpose at the time of development.
TRACE Request
Response
TRACE / HTTP/1.1
Host: www.tutorialspoint.com HTTP/1.1 200 OK Date: Mon, 27 Jul 2009 12:28:53 GMT
User-Agent: Mozilla/4.0 Server: Apache/2.2.14 (Win32)
(compatible; MSIE5.01; Connection: close
Windows NT) Content-Type: message/http Content-Length: 39
TRACE / HTTP/1.1
Host: www.tutorialspoint.com
User-Agent: Mozilla/4.0 (compatible; MSIE5.01;
Windows NT)
HTTP/1.0 Network Interaction
• Clients make requests to port 80 on servers
– Uses DNS to resolve server name
• Clients make separate TCP connection for each URL
– Some browsers open multiple TCP connections
• Netscape default = 4
• Server returns HTML page
– Many types of servers with a variety of implementations
– Apache is the most widely used
• Freely available in source form
• Client parses page
– Requests embedded objects
HTTP/1.1 Performance Enhancements
• HTTP/1.0 is a “stop and wait” protocol
– Separate TCP connection for each file
• Connect setup and tear down is incurred for each file
• Inefficient use of packets
• Server must maintain many connections in TIME_WAIT
• Mogul and Padmanabahn studied these issues in
’95
– Resulted in HTTP/1.1 specification focused on
performance enhancements
• Persistent connections
• Pipelining
• Enhanced caching options
• Support for compression
Persistent Connections and Pipelining
• Persistent connections
– Use the same TCP connection(s) for transfer of multiple
files
– Reduces packet traffic significantly
– May or may not increase performance from client
perspective
• Load on server increases
• Pipelining
– Pack as much data into a packet as possible
– Requires length field(s) within header
– May or may not reduce packet traffic or increase
performance
• Page structure is critical
What HTTP/1.1 problems does HTTP/2
address?
• Multiplexing: Multiple asynchronous HTTP requests over a
single TCP connection.
Server sends its responses in the same order that the
requests were received — so the entire connection remains
first-in-first-out and HOL blocking(delay of one response will
delay other too) can occur (As per 1.1).
Status (just the numeric return code followed by the brief text explanation, since the server will
add the server version)
Content-type, in the usual MIME form
Location, (optional) a URL to be followed and returned to the client
blank line (CRLF)
After the header lines, the cgi program generates its data (HTML?)
CGI - Samples
#!/usr/bin/perl -wT
print "Content-type: text/html\n\n";
print "<html><head><title>Hello
World</title></head>\n";
print "<body>\n";
print "<h2>Hello, world!</h2>\n";
print "</body></html>\n";
CGI - Samples
#!/usr/local/bin/perl
print "200 ok\n"; print "content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>echo cgi env. vars.</TITLE>\n";
print "<H2>Echo CGI Environment Variables</H2>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<HR>\n";
print "<H3>Environment Variables</H3>\n";
print "<UL>\n";
foreach $key (keys %ENV)
{ print "<LI>$key = $ENV{$key}\n"; }
print "</UL>\n";
print "</BODY>\n";
print "</HTML>\n";
CGI - Form
<FORM action = "/cgi-bin/hello_get.cgi" method
= "GET">
First Name: <input type = "text" name =
"first_name"> <br>
Last Name: <input type = "text" name =
"last_name">
<input type = "submit" value = "Submit">
</FORM>
#!/usr/bin/perl
CGI - hello_get.cgi
local ($buffer, @pairs, $pair, $name, $value, %FORM);
# Read in text
$ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/;
if ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
} else {
$buffer = $ENV{'QUERY_STRING'};
}
$first_name = $FORM{first_name};
$last_name = $FORM{last_name};
print "Content-type:text/html\r\n\r\n";
print "<html>";
print "<head>";
print "<title>Hello - Second CGI Program</title>";
print "</head>";
print "<body>";
print "<h2>Hello $first_name $last_name - Second CGI Program</h2>";
print "</body>";
print "</html>";
Content Management System
• The Content Management System (CMS) is a
software which stores all the data such as
text, photos, music, documents, etc. and is
made available on your website.
• It helps in editing, publishing and modifying
the content of the website.
Content Management System – Basics
• A CMS allows non-technical users to make
changes to an existing website with little or no
training.
• Primarily a Web-site maintenance tool for
non-technical administrators.
• Typically requires an experienced coder to set
up and add features
CMS
• A CMS facilitates:
• Content creation
• Content control
• Editing
• Maintenance functions
CMS
• Designed for users with little or no knowledge
of programming languages or markup
languages
• Tools to create and manage content with
relative ease of use.
• Most systems use a database to store content,
metadata, and/or artifacts that might be
needed by the system.
CMS – Key features
• Automated templates
• Easily editable content
• Scalable feature sets
• Web standards upgrades
• Workflow management
• Delegation
• Document management
• Content virtualization
CMS – Key features
• Automated templates
• Easily editable content
• Scalable feature sets
• Web standards upgrades
• Workflow management
• Delegation
• Document management
• Content virtualization
Key features
Automated templates
• Create standard output templates (usually
HTML and XML) that can be automatically
applied to new and existing content
• Allows the appearance of all content to be
changed from one central place.
Key features
Easily editable content
• Once content is separated from the visual
presentation of a site, it usually becomes
much easier and quicker to edit and
manipulate.
• Most WCMS software includes WYSIWYG
editing tools allowing non-technical
individuals to create and edit content.
Key features
Scalable feature sets
• Most WCMS software includes plug-ins or modules
that can be easily installed to extend an existing
site's functionality.