internet programming and java notes 5th sem mca
TRANSCRIPT
![Page 1: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/1.jpg)
Format of an HTTP Request
It has three main components, which are:-
HTTP Request Method, URI, and Protocol Version - this should always be the first line of an HTTP Request. As it's quite evident from the name itself, it contains the HTTP Request method being used for that particular request, the URI, and the HTTP protocol name with the version being used. It may look like 'GET /servlet/jspName.jsp HTTP/1.1' where the request method being used is 'GET', the URI is '/servlet/jspName.jsp', and the protocol (with version) is 'HTTP/1.1'.
HTTP Request Headers - this section of an HTTP Request contains the request headers, which are used to communicate information about the client environment. Few of these headers are: Content-Type, User-Agent,Accept-Encoding, Content-Length, Accept-Language, Host, etc. Very obvious to understand what info do these headers carry, isn't it? The names are quite self-explanatory.
HTTP Request Body - this part contains the actual request being sent to the HTTP Server. The HTTP Request Header and Body are separated by a blank line (CRLF sequence, where CR means Carriage Return and LF means Line Feed). This blank line is a mandatory part of a valid HTTP Request.
Format of an HTTP Response
Similar to an HTTP Request, an HTTP Response also has three main components, which are:-
Protocol/Version, Status Code, and its Description - the very first line of a valid HTTP Response is consists of the protocol name, it's version, status code of the request, and a short description of the status code. A status code of 200means the processing of request was successful and the description in this case will be 'OK'. Similarly, a status code of '404' means the file requested was not found at the HTTP Server at the expected location and the description in this case is 'File Not Found'.
HTTP Response Headers - similar to HTTP Request Headers, HTTP Response Headers also contain useful information. The only difference is that HTTP Request Headers contain information about the environment of the client machine whereas HTTP Response Headers contain information about the environment of the server machine. This is easy to understand as HTTP Requests are formed at the client machine whereas HTTP Responses are formed at the server machine. Few of these HTTP Response headers are: Server, Content-Type, Last-Modified, Content-Length, etc.
HTTP Response Body - this the actual response which is rendered in the client window (the browser window). The content of the body will be HTML code. Similar to HTTP Request, in this case also the Body and the Headers components are separated by a mandatory blank line (CRLF sequence).
![Page 2: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/2.jpg)
HTTP Request Types:
We have already seen the GET request type in the above example, let's see some more types of HTTP request types.
HTTP Head Request HTTP head request is very much similar to the GET request. Its the
easiest method to know the complete details of the resource available on a particular URL, without downloading the entire data.
For example, if we use HEAD request in our above example, we will get all the header's in the response except our page containing the "Hello" message.
This kind of a request is used only to retrieve attributes of the data without the data. This can give you information about the resource by saving your bandwidth.
HTTP Post Request POST request is mostly used to send data from the client to the server.
Let's see an example of HTTP post request from the client to the server.
HTTP Put request: HTTP put request is very much similar to the post request. PUT request
sends or creates a resource in the specified URI. IF the resource is already present in that specified URI, it will update
that URI, otherwise it will create the resource.
HTTP Delete Request: HTTP delete request deletes a specified resource on a specified URI. It's not at all advisable to configure a webserver for HTTP delete
operation. However if you want to enable such functionalities, its better to that with a http POST operation using a web form, which intern will delete a resource.
HTTP Trace Request HTTP trace request is used to trouble shoot http web pages. For example, if suppose a web page is not getting loaded the way you
want in your browser. Then in such cases http trace request can be used to retrieve the complete request that the server got from the client back to the client itself.
This kind of request kind is mostly disabled in most of the web server's. The main reason is that its very much similar to viewing the web server log of the request you send.
![Page 3: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/3.jpg)
File Transfer Protocol (FTP) E-Mail Print A AA AAA inShare 1 Facebook Twitter Share This RSS Reprints
File Transfer Protocol (FTP) is a standard Internet protocol for transmitting files between computers on the Internet. FTP is an application protocol that uses the Internet's TCP/IPprotocols. FTP is commonly used to transfer Web page files from their creator to the computer that acts as their server for everyone on the Internet. It's also commonly used to download programs and other files to your computer from other servers.
you can use FTP with a simple command line interface (for example, from the Windows MS-DOS Prompt window) or with a commercial program that offers a graphical user interface. Your Web browser can also make FTP requests to download programs you select from a Web page. Using FTP, you can also update (delete, rename, move, and copy) files at a server.
Basic FTP support is usually provided as part of a suite of programs that come with TCP/IP. However, any FTP client program with a graphical user interface usually must be downloaded from the company that makes it.
Originated by Abhay Bhushan in 1971 for use in the military and scientific research network
known as ARPANET, FTP has evolved into a protocol for far wider applications on the World
Wide Web with numerous revisions throughout the years.
FTP is the easiest way to transfer files between computers via the internet, and utilizes TCP,
transmission control protocol, and IP, internet protocol, systems to perform uploading and
downloading tasks.
How It Works
TCP and IP are the two major protocols that keep the internet running smoothly. TCP manages data
transfer while IP directs traffic to internet addresses. FTP is an underling of TCP and shuttles files
![Page 4: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/4.jpg)
back and forth between FTP server and FTP client. Because FTP requires that two ports be open--
the server's and the client's--it facilitates the exchange of large files of information.
First, you as client make a TCP control connection to the FTP server's port 21 which will remain
open during the transfer process. In response, the FTP server opens a second connection that is the
data connection from the server's port 20 to your computer.
Using the standard active mode of FTP, your computer communicates the port number where it will
stand by to receive information from the controller and the IP address--internet location--from which
or to which you want files to be transferred.
If you are using a public--or anonymous--FTP server, you will not need proprietary sign-in
information to make a file transfer, but you may be asked to enter your email address. If you are
using a private FTP server, however, you must sign in with a user name and password to initiate the
exchange of data.
Modes of File Transfer
Three modes of transferring data are available via FTP. The system can use a stream mode, in
which it transfers files as a continuous stream from port to port with no intervention or processing of
information into different formats. For example, in a transfer of data between two computers with
identical operating systems, FTP does not need to modify the files.
In block mode, FTP divides the data to be transferred into blocks of information, each with a header,
byte count, and data field. In the third mode of transfer, the compressed mode, FTP compresses the
files by encoding them. Often these modifications of data are necessary for successful transfer
because the file sender and file receiver do not have compatible data storage systems.
Passive FTP
Should your computer have firewall protection, you may have difficulties using FTP. A firewall
protects your PC by preventing internet sites from initiating file transfers. You can circumvent your
firewall's function by using the PASV command that reverses the FTP process, allowing your
computer to initiate the transfer request.
Many corporate networks use PASV FTP as a security measure to protect their internal network
from assaults of unwanted external files. Also called passive FTP, the process requires that any
transfer of information from the internet or other external source must be initiated by the client or
private network rather than the external source.
Further FTP Security
![Page 5: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/5.jpg)
In response to the need for a more secure transfer process for sensitive information such as
financial data, Netscape developed a Secure Sockets Layer (SSL) protocol in 1994 that it
used primarily to secure HTTP--HyperText Transfer Protocol--transmissions from tampering
and eavesdropping. The industry subsequently applied this security protocol to FTP
transfers, developing SFTP, a file transfer protocol armored with SSL for protection from
hackers.
Objectives of FTP were:
1. to promote sharing of files (computer programs and/or data),2. to encourage indirect or implicit (via programs) use of remote
computers,3. to shield a user from variations in file storage systems among
hosts, and4. to transfer data reliably and efficiently.
5.
What Is Email Protocol?
Email protocol is a method by which a communication channel is established between two computers and email is transferred between them. When an email is transferred, a mail server and two computers are involved. One computer sends the mail and the other one receives it. The mail server stores the mail and lets the receiving device access it and download it if needed. There are four different mail protocols. These protocols differ in the way by which they establish connections and allow user access to emails.
Read more: http://www.ehow.com/about_6168931_email-protocol_.html#ixzz2ktWLtS2E
Usage in Various Email Applications
![Page 6: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/6.jpg)
Various email applications exist. Microsoft Outlook is one of the most popular commercial applications. Lotus Notes is another particularly common one. These applications can support various email protocols. Different ports are used for different mail protocols. Microsoft Outlook can support mail servers compatible with IMAP and POP3 protocols. UNIX machines and simple mail applications support SMTP protocol. Following are the different email protocols.
POP3 (Post Office Protocol 3) This is a simple, standardized protocol that allows users to access their
mailboxes on the Internet and download messages to their computers. The simple design of POP3 allows casual email users who have a temporary Internet connection (dial-up access) to access emails. They can read their emails, draft new emails or reply to emails while they are offline, and can send these emails when they are back online. Yahoo! Mail (mail.yahoo.com) is an example of a mail server that uses POP3 protocol.
Email clients like Microsoft Outlook may be used to access emails and download them from mail.yahoo.com. Users may also access them on web browsers like Internet Explorer.
IMAP (Internet Message Access Protocol) This is a standard protocol used for email transfer by users. Like POP3, it also
supports both online and offline modes of email access. The email message is downloaded to the user's machine only when a specific request is made to read it. Users can download mails to their computers while keeping a copy on the server. The mails on the server are the primary copy and anything changed on the local machine is updated by what is on the server.
IMAP provides powerful search capability for savvy email users to search for emails in server. This is useful, as the mails need not be downloaded--saving time for users.
Users can also create new mailboxes which are shown as folders on the server, and move messages between folders. This feature allows access to shared and public folders.
Gmail is an example of a mail server which uses IMAP protocol. Email clients like Microsoft Outlook may be used to access these emails directly on the server and the local machine after downloading. Again, users may use IE to access these emails.
SMTP (Simple Mail Transfer Protocol) As the name suggests, SMTP is a simple, text-based protocol that works best
when devices are interconnected to each other. However, SMTP protocol can only be used to send emails. Unlike POP3 and IMAP protocols, SMTP does not
![Page 7: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/7.jpg)
provide the functionality to the users to retrieve emails from the server. This limits the use of SMTP to some extent. To overcome this problem, SMTP provides a feature to queue mails on a server so that the messages bound for the receiving system could be delivered.
One of the main issues with SMTP is the lack of sender email authentication. SMTP lacks security features too and thus users get spam emails.
UNIX systems and simple applications like "mailsend" make use of SMTP protocol. Commercial applications don't use SMTP to a great extent.
HTTP (Hyper text transfer protocol) Even though HTTP is not used exclusively for mail transfer, it still plays a vital
part for users who use Internet browsers for accessing their mails (both for sending and receiving).
Hotmail and Yahoo! use HTTP protocol for accessing emails through the Internet.
MAPI
As noted, MAPI is Microsoft's proprietary email protocol. It provides greater functionality than IMAP for Outlook email clients interacting with an Exchange email server. It doesn't work for anything else. (In Outlook you may simply see the connection option "Microsoft Exchange Server" rather than MAPI. It's offering the same thing.)
Remote access using MAPI may require use of a VPN connection, because the ports (communications channels) that MAPI uses are otherwise blocked for security reasons. (That's the case when accessing the medical campus Exchange system remotely.)
Dial-up Internet Connectivity
Today, dial-up Internet connectivity is the most common type of access promoted by ISPs or Internet Service Providers. The connection is cheap and slow, but enables users to connect via a local server, that exhibits strength of a standard 56 Kilobits per second modem. Dial-up Internet access is basically, access to the Internet via integrated telephone lines. The user's router or computer enables access via the attached modem, which in turn connects to the preferred Internet service provider's node. The resultant modem-to-modem link empowers the routing of dedicated Internet Protocol Packets on the Internet. The technology has come a long way, to establish computer-based telecommunication between terminal emulator software, to integrated mainframes, online services, minicomputers and dedicated bulletin board systems. The technology does not require any infrastructure, other than a telephone connection. The dial-up Internet connection is very useful to travelers and for access in rural or remote areas. It appeals to users on limited budgets.
Broadband Internet Connection
The term 'Broadband Internet Connection' has different meanings in different contexts. In the world of data communication, it refers to data transmission over a fiber optic cable. In the case of a DSL or Digital Subscriber Line, this service relates to the transfer of digital information over a high-bandwidth channel; while on the Ethernet, the technology implies a baseband transmission using the complete
![Page 8: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/8.jpg)
bandwidth of the preferred medium (as in the case of 100BASE-T Ethernet). In power-line communication, it refers to high-speed signaling to achieve high data rates (as in the case of ITU-T G.hn standard); while in video distribution the term refers to the modulation of individual channels, at fixed frequencies. Broadband Internet connectivity in telecommunication refers to a specially developed signaling system that integrates a wide frequency range (or band). Basically, the technology enables greater information-carrying capacity and quicker Internet access.
What is the difference between dial up and broadband Internet connections?
The fundamental difference between dialup and broadband connections is the manner in which the connection is made from PC to the Internet.
A dialup service connects to the Internet through a phone line with a maximum speed of 56kbps.
Broadband refers to a connection that has capacity to transmit large amount of data at high speed. Presently a connection having download speeds of 256kbps or more is classified as broadband.
Broadband comes in a number of forms - depending how the data is delivered - for example via cable, satellite and most commonly using a telephone line where as a dialup service always connects
to the Internet through a phone line.
While using a dialup connection, we need to pay for a local call every time we dial the Internet. In addition phone line is engaged while we are on the Internet. With a broadband connection, phone
line (if existing phone line is used) can still be used while using the Internet and both the phone and the Internet work simultaneously and no dialup costs are incurred. Telecommunication systems were
originally built to carry analogue signals. In a dial up connection, modems are used to translate digital into analogue signals and communicating with Internet.
However, analogue transmission between the subcriber and the telephone company is a bandwidth bottleneck. Dialup connection speeds make it more difficult to view certain types of media, such as
video, and it can take much longer to download and open emial attachments, play online games and so on.
In an broadband system, digital data does not have to be converted into analogue. it uses a different part of the line's frequency spectrum, offers much wider bandwidth 9more lanes) and does not interfere with the use of the line for voice transmission. When connected to the Internet, such a
connection allows surfing or downloading much faster than a dial-up connection. Dialup connection users a built-in modem to connect and does not require a special router, whereas broadband
requires a special router or modem.
In terms of security for attack, dialup is more secured then broadband, Broadband users need to use a firewall to keep the computer "invisible" to the outside.
How to Create a Dial-Up Connection in Windows XP
1. From the Start menu, choose Control Panel.
2. Click the Network and Internet Connections icon.
![Page 9: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/9.jpg)
3. Click the Set up or change your Internet connection icon.
4. Click the Setup button.
5. Click the Next button.
6. Select Connect to the Internet.7. Click the Next button.
8. Select Set up my connection manually.9. Click the Next button.
10.Select Connect using a dial-up modem.11.Click the Next button.
If you get to this poing and the screen will not allow you to choose "Connect using a dial-up modem" Then hit the Cancel button.
Go to the start Menu
Go to Settings
Go to Control Panel
Select Network
Select the option of "Set up or Change a dial up Account"
At that point it will take you to step 4 and you continue down the list.
![Page 10: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/10.jpg)
12. In the ISP Name field, type a name to identify your connection (ie. AztecaNet).13.Click the Next button.
14. In the Phone number field, type your local access number exactly as it needs to be dialed.
Note: If you require 10-digit dialing in order to access a local number, make sure to include your area code.
15.Click the Next button.
16. In the User name field, type your email address.17. In the Password field, type your password.18. In the Confirm password field, type your password.19.Uncheck the box next to Use this account name and password when anyone
connects to the Internet from this computer.20.Uncheck the box next to Make this the default Internet connection.21.Uncheck the box next to Turn on Internet Connection Firewall for this
connection.22.Click the Next button.
23.Check the box next to Add a shortcut to this connection to my desktop if you wish to have a shortcut to the connection on your desktop.
24.Click the Finish button.
You have successfully created a Dial-up Connection in Windows XP.
E-commerce (electronic commerce or EC) is the buying and selling of goods and services on the Internet, especially the World Wide Web. In practice, this term and a newer term, e-business, are often used interchangably. For online retail selling, the term e-tailing is sometimes used.
![Page 11: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/11.jpg)
E-commerce can be divided into:
E-tailing or "virtual storefronts" on Web sites with online catalogs, sometimes gathered into a "virtual mall"
The gathering and use of demographic data through Web contacts Electronic Data Interchange (EDI), the business-to-business exchange of data E-mail and fax and their use as media for reaching prospects and established customers (for
example, with newsletters) Business-to-business buying and selling The security of business transactions
Often referred to as simply ecommerce (or e-commerce) the phrase is used to describe business that is conducted over the Internet using any of the applications that rely on the Internet, such as e-mail, instant messaging, shopping carts, Web services, UDDI, FTP, and EDI, among others. Electronic commerce can be between two businesses transmitting funds, goods, services and/or data or between a business and a customer.
E-commerce refers to the purchase and sale of goods and/or services via electronic
channels, such as the Internet. Online retail is convenient due to its 24-hour availability,
global reach and ease of customer service.
Though purchasing items online is a major facet, e-commerce is more than that. This type
of commerce can be useful at the enterprise level as well. E-commerce is not just on the
Web — it was first introduced in the 1960s via electronic data interchange (EDI) through
value-added networks (VANs). In the mid-1990s, e-commerce was transformed with the
introduction of Amazon and eBay. Amazon started as a book shipping business, out of Jeff
Bezos' garage, in 1995. EBay, which enabled consumers to sell things online, introduced
online auctions in 1995 and exploded with the 1997 Beanie Babies frenzy.
There are four main categories: B2B, B2C, C2B, and C2C.
B2B (Business to Business) — this kind of e-commerce involves companies doing
business with each other. One example is manufacturers selling to distributors and
wholesalers selling to retailers.
![Page 12: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/12.jpg)
B2C (Business to Consumer) — This is what most people think of when they hear "e-
commerce." B2C consists of businesses selling to the general public through
shopping cart software, without needing any human interaction. An example of this
would be Amazon.
C2B (Consumer to Business) — In this scenario, a consumer would post a project
with a set budget online, and companies bid on the project. The consumer reviews
the bids and selects the company — Elance is an example of this.
C2C (Consumer to Consumer) — this type of e-commerce is made up of online
classifieds or forums where individuals can buy and sell their goods, thanks to
systems like PayPal. An example of this would be eBay or etsy.
E-commerce strategy
Just like any type of business, e-commerce businesses need to have a fully fleshed strategy.
The first step is to set goals. Do you plan to increase revenue from existing customers?
Gain new customers? Increase the average order value? Sell through new channels? Lower
prices? Once you have figured out your goals, the next step is to set a plan.
Your first step is to conduct a SWOT analysis and assess the strengths, weaknesses,
opportunities and threats of where your business is. What does the market look like?
Where does your business excel, and where does it falter? Review your entire business, not
just segments of it. Evaluate external opportunities, because this is the often the primary
place to invest time and money. Be honest with yourself when analyzing weaknesses and
threats, or else the analysis will not be helpful.
After the SWOT analysis is done, see how it fits into your overall vision. Where do you see
your business in five years? In 10 years? This will help you set business objectives for the
current year, where you set objectives for sales, profits, customers, traffic, new systems,
and new staff. After the objectives are set, a strategy can be put in place, either by you or
by a hiring an e-commerce consultant.
![Page 13: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/13.jpg)
In addition to having a strong business strategy, it's important to have a basic
understanding of e-commerce law. There are different legal and financial considerations,
especially with privacy, security, copyright, and taxation. The Federal Trade Commission
(FTC) regulates most e-commerce activities, including the use of commercial emails, online
advertising, and consumer privacy. Through any average day, businesses collect and retain
personal information from their customers — information that is often sensitive. You are
subject to federal and state privacy laws, depending on the type of data that you collect.
There are also online advertising laws that protect consumer privacy and ensure truthful
marketing practices online. As an e-commerce business, online advertising is a major part
of your strategy. Over the past decade, federal and state governments have passed new
online advertising laws — it's important to be familiar with these.
In addition to protecting consumers from data leaks and misleading online advertising,
digital works are also protected on the Internet via the Digital Millennium Copyright Act
(DMCA). There are a number of provisions that e-commerce businesses need to be aware
of, including copyright infringement liability and a service provider's responsibilities.
Like any digital technology or consumer-based purchasing market, e-commerce has
evolved over the years. As mobile devices became more popular, m-commerce because its
own market. With the rise of Facebook and sites like Pinterest, f-commerce and s-
commerce (social commerce) have become the newest versions of e-commerce. As the
market changes, businesses must also change to stay relevant and understand business
opportunities out there in the e-commerce world.
Here are a few examples of e-commerce:
accepting credit cards for commercial online sales generating online advertising revenue trading stock in an online brokerage account driving information through a company via its intranet
![Page 14: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/14.jpg)
driving manufacturing and distribution through a value chain with partners on an extranet
selling to consumers on a pay-per-download basis, through a Web site
portal, meaning roughly the gate - which means the main providers of information.
e-commerce, electronic commerce is a transaction between parties is usually done between computers. Often people make the overlap between portal & e-commerce, e-commerce should not use the portal also do not have to do e-commerce portals.
website, often referred to as the website is a forum / place to put the script that is written in HTML format which can be downloaded using a web browser like internet explorer. Well portals, e-commerce is just one of two applications that run on top of the website - of course there are many more types of applications that can run on top of the website can take the form of online media, etc. teleeducation....
What is CGI? The Common Gateway Interface, or CGI, is a set of standards that define how information is exchanged between the
web server and a custom script.
The CGI specs are currently maintained by the NCSA and NCSA defines CGI is as follows:
The Common Gateway Interface, or CGI, is a standard for external gateway programs to interface with information servers such as HTTP servers.
The current version is CGI/1.1 and CGI/1.2 is under progress.
Web BrowsingTo understand the concept of CGI, lets see what happens when we click a hyper link to browse a particular web page or URL.
Your browser contacts the HTTP web server and demands for the URL i.e., filename.
Web Server will parse the URL and will look for the filename in if it finds that file then sends it back to the browser, otherwise sends an error message indicating that you have requested a wrong file.
Web browser takes response from web server and displays either the received file or error message.
However, it is possible to set up the HTTP server so that whenever a file in a certain directory is requested that file is not sent back; instead it is executed as a program, and whatever that program outputs is sent back for your browser to display. This function is called the Common Gateway Interface or CGI and the programs are called CGI scripts. These CGI programs can be a Python Script, PERL Script, Shell Script, C or C++ program, etc.
CGI Architecture Diagram
![Page 15: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/15.jpg)
CGI Environment VariablesAll the CGI program will have access to the following environment variables. These variables play an important role while writing any CGI program.
Variable Name Description
CONTENT_TYPEThe data type of the content. Used when the client is sending attached content to the server. For example, file upload, etc.
CONTENT_LENGTH The length of the query information. It's available only for POST requests.
![Page 16: internet programming and java notes 5th sem mca](https://reader036.vdocuments.net/reader036/viewer/2022062513/5558c4f0d8b42a235c8b4719/html5/thumbnails/16.jpg)
HTTP_COOKIE Returns the set cookies in the form of key & value pair.
HTTP_USER_AGENTThe User-Agent request-header field contains information about the user agent originating the request. Its name of the web browser.
PATH_INFO The path for the CGI script.
QUERY_STRING The URL-encoded information that is sent with GET method request.
REMOTE_ADDRThe IP address of the remote host making the request. This can be useful for logging or for authentication purpose.
REMOTE_HOSTThe fully qualified name of the host making the request. If this information is not available then REMOTE_ADDR can be used to get IR address.
REQUEST_METHODThe method used to make the request. The most common methods are GET and POST.
SCRIPT_FILENAME The full path to the CGI script.
SCRIPT_NAME The name of the CGI script.
SERVER_NAME The server's hostname or IP Address
SERVER_SOFTWARE The name and version of the software the server is running.