| Browser To Server | Sample Code |
| Server To Browser | Learning More |
| Language & Charset | Links |
| HTTP Headers that Browsers Send Servers | ||
|---|---|---|
| Field | Typical Value | Meaning |
| User-Agent: | Opera ⇒ Opera/9.22 (Windows NT 6.0; U; en)
Firefox ⇒ Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6 Sea Monkey ⇒ Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 Netscape ⇒ Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.5pre) Gecko/20070710 firefox/2.0.0.4 Navigator/9.0b2 IE ⇒ Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506) |
Which browser being used. |
| Host: | localhost:8081 | destination url, server:port. |
| Accept: | application/xhtml+voice+xml;version=1.2, application/x-xhtml+voice+xml;version=1.2,
application/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
or text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 |
MIME types the browser is willing to accept. The encoding of this field, is described in RFC 2616 section 14. and in the more friendly w3.org version . Roughly the q numbers define your preference. The higher the number the higher the preference. Default is 1. The q applys to the preceding MIME. You set this with URLConnection.setRequestProperty( "Accept", …); not "accept" as the Sun docs erroneously suggest. |
| Accept-Language: | en | Language the browser in willing to accept. |
| Accept-Charset: | windows-1252, utf-8, utf-16, iso-8859-1;q=0.6, *;q=0.1 | Character set encodings the browser is willing to accept. |
| Accept-Encoding: | deflate, gzip, x-gzip, identity, *;q=0 | compression schemes the browser is willing to accept. |
| Referer: | http://mindprod.com/jgloss/http.html | the web page that contained the link that triggered this requenst. |
| If-Modified-Since: | Mon, 06 Feb 2006 01:24:23 GMT | Only bother with the request if the file has changed since this date, otherwise the browser already has a copy in cache. |
| Connection: | Keep-Alive | requests server keep the socket open for further messages. |
| Content-Type: | application/x-www-form-urlencoded | MIME type of the payload to the server. |
| Content-Length: | 114 | length in encoded bytes of the payload to the server. |
Beware using HttpURLConnection.setFollowRedirects( false); This reportedly causes trouble in recent JDKs.
| HTTP Headers that Servers Send Browsers | ||
|---|---|---|
| Field | Typical Value | Meaning |
| Server: | Apache/2.0.55 (NETWARE) mod_perl/1.99_12 Perl/v5.8.4 | Which server software being used. |
| Accept-Ranges: | bytes | Inform the browser that the server supports downloading just parts of files, as small as a byte granularity. |
| Keep-Alive: | timeout=15, max=99 | how long to keep this socket open for more messages. |
| Connection: | Keep-Alive | requests browser keep the socket open for further messages. |
| Content-Type: | image/png | MIME type of the payload from the server. |
| Content-disposition: | attachment;filename="smile.png" | Server suggests a filename to save this download under. |
| Content-Length: | 842 | length in encoded bytes of the payload from the server. |
<!-- embedding language and charset inside an HTML document --> <meta http-equiv="Content-Language" content="en"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">Embedding this information makes it easier for web page authors to control, even if it makes finding the information slightly more difficult for the browser.
RFC 1522 (obsolete) MIME part 2, non ASCII.
RFC 1945 HTTP 1.0 specification.
RFC 2045 MIME Part One: Format of Internet Message Bodies, specifies the various headers used to describe the structure of MIME messages.
RFC 2046 MIME Part Two: Media Types, describes the general structure of the MIME media typing system and defines an initial set of media types.
RFC 2047 MIME Part Three: Message Header Extensions for non-ASCII text
RFC 2048 MIME Part Four: Registration Procedures
RFC 2049 MIME Part Five: Conformance Criteria and Examples, Provides some illustrative examples of MIME message formats
RFC 2183 MIME Part Five: Conformance Criteria and HTTP Content-Disposition
RFC 2068 (obsolete) HTTP/1.1 protocol, obsolete.
RFC 2616 updates the HTTP protocol
RFC 2617: for details on how to send username and password in http headers to restrict access
RFC 2183 MIME Part Five: Conformance Criteria and HTTP Content-Disposition
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.16] | The information on this page is for non-military use only. | ||
| You are visitor number 13,495. | Military use includes use by defence contractors. | ||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/Mindprod website mirror) | ||
| http://mindprod.com/jgloss/http.html | J:\mindprod\jgloss\http.html | ||