Вы находитесь на странице: 1из 3

We are hiring

HTTPParameters
Advertisements

PreviousPage

NextPage

This chapter is going to list down few of the important HTTP Protocol Parameters and their syntax the way they are used in the
communication. For example, format for date, format of URL, etc. This will help you in constructing your request and response messages
whilewritingHTTPclientorserverprograms.Youwillseethecompleteusageoftheseparametersinsubsequentchapterswhilelearningthe
messagestructureforHTTPrequestsandresponses.

HTTPVersion
HTTPusesa<major>.<minor>numberingschemetoindicateversionsoftheprotocol.TheversionofanHTTPmessageisindicatedbyan
HTTPVersionfieldinthefirstline.HereisthegeneralsyntaxofspecifyingHTTPversionnumber:
HTTPVersion="HTTP""/"1*DIGIT"."1*DIGIT

Example
HTTP/1.0
or
HTTP/1.1

UniformResourceIdentifiers
Uniform Resource Identifiers (URI) are simply formatted, caseinsensitive string containing name, location, etc. to identify a resource, for
example,awebsite,awebservice,etc.AgeneralsyntaxofURIusedforHTTPisasfollows:
URI="http:""//"host[":"port][abs_path["?"query]]

Here if the port is empty or not given, port 80 is assumed for HTTP and an empty abs_path is equivalent to an abs_path of "/". The
charactersotherthanthoseinthereservedandunsafesetsareequivalenttotheir""%"HEXHEX"encoding.

Example
ThefollowingthreeURIsareequivalent:
http://abc.com:80/~smith/home.html
http://ABC.com/%7Esmith/home.html
http://ABC.com:/%7esmith/home.html

Date/TimeFormats
AllHTTPdate/timestampsMUSTberepresentedinGreenwichMeanTime(GMT),withoutexception.HTTPapplicationsareallowedtouse
anyofthefollowingthreerepresentationsofdate/timestamps:
Sun,06Nov199408:49:37GMT;RFC822,updatedbyRFC1123
Sunday,06Nov9408:49:37GMT;RFC850,obsoletedbyRFC1036
SunNov608:49:371994;ANSIC'sasctime()format

CharacterSets
Weusecharactersetstospecifythecharactersetsthattheclientprefers.Multiplecharactersetscanbelistedseparatedbycommas.Ifa
valueisnotspecified,thedefaultistheUSASCII.

Example
Followingarethevalidcharactersets:

USASCII
or
ISO88591
or
ISO88597

ContentEncodings
A content encoding value indicates that an encoding algorithm has been used to encode the content before passing it over the network.
Contentcodingareprimarilyusedtoallowadocumenttobecompressedorotherwiseusefullytransformedwithoutlosingtheidentity.
All contentcoding values are caseinsensitive. HTTP/1.1 uses contentcoding values in the AcceptEncoding and ContentEncoding header
fieldswhichwewillseeinthesubsequentchapters.

Example
Followingarethevalidencodingschemes:
Acceptencoding:gzip
or

Acceptencoding:compress
or
Acceptencoding:deflate

MediaTypes
HTTPusesInternetMediaTypesintheContentTypeandAcceptheaderfieldsinordertoprovideopenandextensibledatatypingandtype
negotiation. All the Mediatype values are registered with the Internet Assigned Number Authority (IANA). The general syntax to specify
mediatypeisasfollows:
mediatype=type"/"subtype*(";"parameter)

Thetype,subtype,andparameterattributenamesarecaseinsensitive.

Example
Accept:image/gif

LanguageTags
HTTPuseslanguagetagswithintheAcceptLanguageandContentLanguagefields.Alanguagetagiscomposedofoneormoreparts:a
primarylanguagetagandapossiblyemptyseriesofsubtags:
languagetag=primarytag*(""subtag)

Whitespacesarenotallowedwithinthetagandalltagsarecaseinsensitive.

Example
Exampletagsinclude:
en,enUS,encockney,icherokee,xpiglatin

whereanytwoletterprimarytagisanISO639languageabbreviationandanytwoletterinitialsubtagisanISO3166countrycode.

PreviousPage

NextPage
Advertisements

CiscoDisasterRecovery

AreyoupreparedforanITdisaster?
Learnmore

Write for us

FAQ's

Helping

Contact

Copyright 2016. All Rights Reserved.


Enter email for newsletter

go

Вам также может понравиться