Anda di halaman 1dari 3

7/4/2017 HTTPIntroduction|HttpWatch

(/)

HTTP Gallery

Jump to ...

1. Introduction
The Hyper Text Transfer Protocol (HTTP) isthe client-server network protocol that has been in use by the World-Wide Web since 1990. Whenever
you surf the web, your browser will be sending HTTP request messages for HTML pages, images, scripts and styles sheets. Web servers handle
these requests by returning response messages that contain the requested resource.

1.1 HTTP Request Message


The HTTP request message has a simple text based structure. For example, here is the the request message sent by Internet Explorer (IE) for this
web page:

GET/httpgallery/introduction/HTTP/1.1
Accept:*/*
AcceptLanguage:engb
AcceptEncoding:gzip,deflate
UserAgent:Mozilla/5.0(WindowsNT6.3;WOW64;Trident/7.0;rv:11.0)likeGecko
Host:www.httpwatch.com
Connection:KeepAlive

The rst line of the message, known as the request line, contains:

The HTTP method. (See 6. HTTP Methods (../methods/) for more information)

The relative URL of the resource or a full URL if you are using an HTTP proxy

The version of HTTP that is being used. Most modern HTTP clients and servers will use HTTP version 1.1 as dened in RFC 2616
(http://www.w3.org/Protocols/rfc2616/rfc2616.html).

The rest of the message consists of a set of name/value pairs, known as headers (See 2. HTTP Headers (../headers/)). HTTP clients use header
values to control how the request is processed by the server. For example, the Accept-Encoding header indicates that the browser can handle
content compressed using the gzip or deate algorithms (see 8. HTTP Compression (../compression/)).

1.2 HTTP Response Message


The web server's response message has a similar structure, but is followed by the contents of the HTML page:

HTTP/1.1200OK
Server:MicrosoftIIS/8.0
Date:Mon,04Jan201512:04:43GMT
XPoweredBy:ASP.NET
XAspNetVersion:4.0.30319
CacheControl:nocache,nostore
Expires:1
ContentType:text/html;charset=utf8
ContentLength:14990

<!DOCTYPEhtml><html>...

The rst line, or status line, returns a status code from the server that indicates whether the request was successful (see 3. Status codes and
errors (../errors/)). The value 200 is returned if the request was processed correctly and content is being returned to the client.

https://www.httpwatch.com/httpgallery/introduction/ 1/3
7/4/2017 HTTPIntroduction|HttpWatch
The next eight lines of text contain header values that describe the data and the way in which it is being returned to the client. For example,
Content-Type has the value text/html because the page is in HTML format. The response headers are terminated with a double CRLF (carriage
return, line feed) and are followed by the contents of the requested resource.

Images are not directly embedded into web pages. Instead, they are specied as separate resources using HTML <img> tags:

<imgsrc="images/logo.gif"width="50"height="50">

Whenever the browser encounters an <img> tag, it checks to see if it has a valid copy of the image either loaded in memory or saved in its
cache. If no suitable match is found, it sends out another HTTP request to retrieve it. This means that a web page will usually generate multiple
HTTP requests; one for the HTML page and one for each of the images.

Example 1
Clicking the Refresh button will redisplay this web page by sending HTTP requests to download the HTML of the page and its associated
styles sheets and images.

REFRESH

Using HttpWatch with Example 1

1. Open HttpWatch by right clicking on the web page and selecting HttpWatch from the context menu

2. Click on Record to start logging requests in HttpWatch

3. Click on the Refresh HTTP request button above

The HttpWatch window will display about 8 entries. The rst is for the page itself; the others are for the style sheets and images used
by this page. Select the rst entry and then click on the Stream tab to see the HTTP request and response messages described above.

<HTTP GALLERY (../) 2. HTTP HEADERS> (../HEADERS/)

Ready to get started?

TRY FOR FREE

(/DOWNLOAD/)
BUY NOW (/BUY/)

HttpWatch
Features (/features/httpdebugger.aspx)
Compare Editions (/editions.aspx)
New in Version 10.x (/newin10x.aspx)
Download (/download/)
Pricing (/buy/)

Our Customers
Who is using it? (/#customers)
What are they saying? (/#quotes)

Learning & Documentation


HttpWatch Blog (http://blog.httpwatch.com)
HTTP Gallery (/httpgallery/)
https://www.httpwatch.com/httpgallery/introduction/ 2/3
7/4/2017 HTTPIntroduction|HttpWatch
HTTP Gallery (/httpgallery/)
HttpWatch Help (http://help.httpwatch.com)
HttpWatch Automation Reference (http://apihelp.httpwatch.com)

Support
Technical Support (/support/)
About Us (/company/)
Contact Us (/company/)
Blog (http://blog.httpwatch.com)
Twitter (https://twitter.com/httpwatch)

Search (/search/) Terms & Conditions (/company/terms.aspx) Privacy Policy (/company/privacy_policy.aspx) Copyright (/company/copyright.aspx)

Copyright 2017 Neumetrix Limited (/)

https://www.httpwatch.com/httpgallery/introduction/ 3/3

Anda mungkin juga menyukai