Web Perl   «Prev  Next»

Lesson 5Web servers and HTTP
ObjectiveExamine the role of HTTP

Web Servers and HTTP

A Web server communicates with its clients by a TCP/IP connection using the HTTP protocol. The HTTP protocol was developed specifically for this purpose, and it has features designed to facilitate the use of Web browsers and servers on the Internet.
Transmission Control Protocol/Internet Protocol is the set of protocols that grew up around the Internet which have become the de-facto standard for networking computers all over the world.

TCP/IP Purpose

TCP/IP was designed to ease connecting networks of all types of computers, across the otherwise insurmountable boundaries of different operating systems, different file systems, and different types of networks (i.e. Ethernet, Appletalk, Token Ring, etc.). Today, TCP/IP is connecting people in hundreds of countries over millions of different networks and computers via the Internet.
The HTTP protocol operates through requests and responses over the TCP/IP connection. The client sends requests to the server, either asking for documents, or submitting data (like responses to forms, or updates to documents).

The server sends back responses:
  1. either requested documents or
  2. results from submitted data.

HTTP Requests and Responses
HTTP Requests and Responses

Perl handles Raw Text

Perl's biggest advantage over many other languages, especially C and Visual Basic, is that it handles raw text and the textual information returned from a database so well. Since most of the web applications rely in one form or another on processing text (from web forms) and then processing, reformatting, and regurgitating that content back out, it is all text in one form or another. In this module, we are going to have a look at most of the issues that surround working with web applications in Perl, starting from the basics of web mechanics (HTML and URLs), through to the interfaces and mechanisms required for Perl to communicate with the web server and ultimately with the user. Along the way, we will also look at methods for post-processing HTML, using cookies, and parsing and reformatting XML documents into HTML format.