Traileracceptencoding

acceptencoding  时间:2021-05-22  阅读:()
HTTPiAbouttheTutorialTheHypertextTransferProtocol(HTTP)isanapplication-levelprotocolfordistributed,collaborative,hypermediainformationsystems.
ThisisthefoundationfordatacommunicationfortheWorldWideWeb(i.
e.
internet)since1990.
HTTPisagenericandstatelessprotocolwhichcanbeusedforotherpurposesaswellusingextensionsofitsrequestmethods,errorcodes,andheaders.
ThistutorialisbasedonRFC-2616specification,whichdefinestheprotocolreferredtoasHTTP/1.
1.
HTTP/1.
1isarevisionoftheoriginalHTTP(HTTP/1.
0).
AmajordifferencebetweenHTTP/1.
0andHTTP/1.
1isthatHTTP/1.
0usesanewconnectionforeachrequest/responseexchange,whereasHTTP/1.
1connectionmaybeusedforoneormorerequest/responseexchanges.
AudienceThistutorialhasbeenpreparedforcomputersciencegraduatesandwebdeveloperstohelpthemunderstandthebasic-to-advancedlevelconceptsrelatedtoHypertextTransferProtocol(HTTP).
PrerequisitesBeforeproceedingwiththistutorial,itisgoodtohaveabasicunderstandingofwebconcepts,webbrowsers,webservers,clientandserverarchitecturebasedsoftwares.
Copyright&DisclaimerCopyright2014byTutorialsPoint(I)Pvt.
Ltd.
Allthecontentandgraphicspublishedinthise-bookarethepropertyofTutorialsPoint(I)Pvt.
Ltd.
Theuserofthise-bookisprohibitedtoreuse,retain,copy,distributeorrepublishanycontentsorapartofcontentsofthise-bookinanymannerwithoutwrittenconsentofthepublisher.
Westrivetoupdatethecontentsofourwebsiteandtutorialsastimelyandaspreciselyaspossible,however,thecontentsmaycontaininaccuraciesorerrors.
TutorialsPoint(I)Pvt.
Ltd.
providesnoguaranteeregardingtheaccuracy,timelinessorcompletenessofourwebsiteoritscontentsincludingthistutorial.
Ifyoudiscoveranyerrorsonourwebsiteorinthistutorial,pleasenotifyusatcontact@tutorialspoint.
comHTTPiiTableofContentsAbouttheTutorialiAudience·iPrerequisites·iCopyright&DisclaimeriTableofContents·ii1.
OVERVIEW·1BasicFeatures·1BasicArchitecture·1Client2Server22.
PARAMETERS3HTTPVersion3UniformResourceIdentifiers3Date/TimeFormats·4CharacterSets·4ContentEncodings4MediaTypes5LanguageTags·53.
MESSAGES·7MessageStart-Line8HeaderFields8MessageBody·94.
REQUESTS10Request-Line·10RequestMethod10HTTPiiiRequest-URI·11RequestHeaderFields12ExamplesofRequestMessage135.
RESPONSES·15MessageStatus-Line15HTTPVersion15StatusCode·16ResponseHeaderFields16ExamplesofResponseMessage·176.
METHODS·19GETMethod·20HEADMethod·20POSTMethod·21PUTMethod·22DELETEMethod·23CONNECTMethod·24OPTIONSMethod·24TRACEMethod·257.
STATUSCODES261xx:Information262xx:Successful·273xx:Redirection·274xx:ClientError285xx:ServerError298.
HEADERFIELDS·31HTTPivGeneralHeaders31Cache-Control·31Connection33Date·34Pragma34Trailer34Transfer-Encoding35Upgrade·35Via·35Warning·35ClientRequestHeaders·36Accept·36Accept-Charset·36Accept-Encoding·36Accept-Language·37Authorization·37Cookie·37Expect·38From38Host38If-Match·38If-Modified-Since·39If-None-Match·39If-Range40If-Unmodified-Since40Max-Forwards40Proxy-Authorization41Range·41Referer·42TE·42User-Agent42ServerResponseHeaders·43Accept-Ranges·43Age·43ETag·43Location·44Proxy-Authenticate44Retry-After·44Server45Set-Cookie45Vary46WWW-Authenticate·46EntityHeaders47Allow·47Content-Encoding·47Content-Language47Content-Length48HTTPvContent-Location·48Content-MD5·48Content-Range49Content-Type·49Expires50Last-Modified509.
CACHING·5110.
URLENCODING·5411.
SECURITY·60PersonalInformationLeakage60FileandPathNamesBasedAttack·60DNSSpoofing61LocationHeadersandSpoofing·61AuthenticationCredentials61ProxiesandCaching·6112.
MESSAGEEXAMPLES·62Example162Clientrequest62Serverresponse·62Example263Clientrequest63Serverresponse·63Example364Clientrequest64Serverresponse·64Example465Clientrequest65Serverresponse·65HTTP1TheHypertextTransferProtocol(HTTP)isanapplication-levelprotocolfordistributed,collaborative,hypermediainformationsystems.
ThisisthefoundationfordatacommunicationfortheWorldWideWeb(i.
e.
internet)since1990.
HTTPisagenericandstatelessprotocolwhichcanbeusedforotherpurposesaswellusingextensionsofitsrequestmethods,errorcodes,andheaders.
Basically,HTTPisaTCP/IPbasedcommunicationprotocolthatisusedtodeliverdata(HTMLfiles,imagefiles,queryresults,etc.
)ontheWorldWideWeb.
ThedefaultportisTCP80,butotherportscanbeusedaswell.
Itprovidesastandardizedwayforcomputerstocommunicatewitheachother.
HTTPspecificationspecifieshowclients'requestdatawillbeconstructedandsenttotheserver,andhowtheserversrespondtotheserequests.
BasicFeaturesTherearethreebasicfeaturesthatmakeHTTPasimplebutpowerfulprotocol:HTTPisconnectionless:TheHTTPclient,i.
e.
,abrowserinitiatesanHTTPrequestandafterarequestismade,theclientdisconnectsfromtheserverandwaitsforaresponse.
Theserverprocessestherequestandre-establishestheconnectionwiththeclienttosendaresponseback.
HTTPismediaindependent:Itmeans,anytypeofdatacanbesentbyHTTPaslongasboththeclientandtheserverknowhowtohandlethedatacontent.
ItisrequiredfortheclientaswellastheservertospecifythecontenttypeusingappropriateMIME-type.
HTTPisstateless:Asmentionedabove,HTTPisconnectionlessanditisadirectresultofHTTPbeingastatelessprotocol.
Theserverandclientareawareofeachotheronlyduringacurrentrequest.
Afterwards,bothofthemforgetabouteachother.
Duetothisnatureoftheprotocol,neithertheclientnorthebrowsercanretaininformationbetweendifferentrequestsacrossthewebpages.
HTTP/1.
0usesanewconnectionforeachrequest/responseexchange,whereasHTTP/1.
1connectionmaybeusedforoneormorerequest/responseexchanges.
BasicArchitectureThefollowingdiagramshowsaverybasicarchitectureofawebapplicationanddepictswhereHTTPsits:1.
OVERVIEWHTTP2TheHTTPprotocolisarequest/responseprotocolbasedontheclient/serverbasedarchitecturewherewebbrowsers,robotsandsearchengines,etc.
actlikeHTTPclients,andtheWebserveractsasaserver.
ClientTheHTTPclientsendsarequesttotheserverintheformofarequestmethod,URI,andprotocolversion,followedbyaMIME-likemessagecontainingrequestmodifiers,clientinformation,andpossiblebodycontentoveraTCP/IPconnection.
ServerTheHTTPserverrespondswithastatusline,includingthemessage'sprotocolversionandasuccessorerrorcode,followedbyaMIME-likemessagecontainingserverinformation,entitymeta-information,andpossibleentity-bodycontent.
HTTP3ThischapterisgoingtolistdownfewoftheimportantHTTPProtocolParametersandtheirsyntaxthewaytheyareusedinthecommunication.
Forexample,formatfordate,formatofURL,etc.
ThiswillhelpyouinconstructingyourrequestandresponsemessageswhilewritingHTTPclientorserverprograms.
YouwillseethecompleteusageoftheseparametersinsubsequentchapterswhilelearningthemessagestructureforHTTPrequestsandresponses.
HTTPVersionHTTPusesa.
numberingschemetoindicateversionsoftheprotocol.
TheversionofanHTTPmessageisindicatedbyanHTTP-Versionfieldinthefirstline.
HereisthegeneralsyntaxofspecifyingHTTPversionnumber:HTTP-Version="HTTP""/"1*DIGIT".
"1*DIGITExampleHTTP/1.
0orHTTP/1.
1UniformResourceIdentifiersUniformResourceIdentifiers(URI)aresimplyformatted,case-insensitivestringcontainingname,location,etc.
toidentifyaresource,forexample,awebsite,awebservice,etc.
AgeneralsyntaxofURIusedforHTTPisasfollows:URI="http:""//"host[":"port][abs_path[""query]]Hereiftheportisemptyornotgiven,port80isassumedforHTTPandanemptyabs_pathisequivalenttoanabs_pathof"/".
Thecharactersotherthanthoseinthereservedandunsafesetsareequivalenttotheir""%"HEXHEX"encoding.
2.
PARAMETERSHTTP4ExampleThefollowingthreeURIsareequivalent:http://abc.
com:80/~smith/home.
htmlhttp://ABC.
com/%7Esmith/home.
htmlhttp://ABC.
com:/%7esmith/home.
htmlDate/TimeFormatsAllHTTPdate/timestampsMUSTberepresentedinGreenwichMeanTime(GMT),withoutexception.
HTTPapplicationsareallowedtouseanyofthefollowingthreerepresentationsofdate/timestamps:Sun,06Nov199408:49:37GMT;RFC822,updatedbyRFC1123Sunday,06-Nov-9408:49:37GMT;RFC850,obsoletedbyRFC1036SunNov608:49:371994;ANSIC'sasctime()formatCharacterSetsWeusecharactersetstospecifythecharactersetsthattheclientprefers.
Multiplecharactersetscanbelistedseparatedbycommas.
Ifavalueisnotspecified,thedefaultistheUS-ASCII.
ExampleFollowingarethevalidcharactersets:US-ASCIIorISO-8859-1orHTTP5ISO-8859-7ContentEncodingsAcontentencodingvalueindicatesthatanencodingalgorithmhasbeenusedtoencodethecontentbeforepassingitoverthenetwork.
Contentcodingareprimarilyusedtoallowadocumenttobecompressedorotherwiseusefullytransformedwithoutlosingtheidentity.
Allcontent-codingvaluesarecase-insensitive.
HTTP/1.
1usescontent-codingvaluesintheAccept-EncodingandContent-Encodingheaderfieldswhichwewillseeinthesubsequentchapters.
ExampleFollowingarethevalidencodingschemes:Accept-encoding:gziporAccept-encoding:compressorAccept-encoding:deflateMediaTypesHTTPusesInternetMediaTypesintheContent-TypeandAcceptheaderfieldsinordertoprovideopenandextensibledatatypingandtypenegotiation.
AlltheMedia-typevaluesareregisteredwiththeInternetAssignedNumberAuthority(IANA).
Thegeneralsyntaxtospecifymediatypeisasfollows:media-type=type"/"subtype*(";"parameter)Thetype,subtype,andparameterattributenamesarecase-insensitive.
HTTP6ExampleAccept:image/gifLanguageTagsHTTPuseslanguagetagswithintheAccept-LanguageandContent-Languagefields.
Alanguagetagiscomposedofoneormoreparts:aprimarylanguagetagandapossiblyemptyseriesofsubtags:language-tag=primary-tag*("-"subtag)Whitespacesarenotallowedwithinthetagsandalltagsarecase-insensitive.
ExampleExampletagsinclude:en,en-US,en-cockney,i-cherokee,x-pig-latinwhereanytwo-letterprimary-tagisanISO-639languageabbreviationandanytwo-letterinitialsubtagisanISO-3166countrycode.
HTTP7HTTPisbasedontheclient-serverarchitecturemodelandastatelessrequest/responseprotocolthatoperatesbyexchangingmessagesacrossareliableTCP/IPconnection.
AnHTTP"client"isaprogram(Webbrowseroranyotherclient)thatestablishesaconnectiontoaserverforthepurposeofsendingoneormoreHTTPrequestmessages.
AnHTTP"server"isaprogram(generallyawebserverlikeApacheWebServerorInternetInformationServicesIIS,etc.
)thatacceptsconnectionsinordertoserveHTTPrequestsbysendingHTTPresponsemessages.
HTTPmakesuseoftheUniformResourceIdentifier(URI)toidentifyagivenresourceandtoestablishaconnection.
Oncetheconnectionisestablished,HTTPmessagesarepassedinaformatsimilartothatusedbytheInternetmail[RFC5322]andtheMultipurposeInternetMailExtensions(MIME)[RFC2045].
Thesemessagesincluderequestsfromclienttoserverandresponsesfromservertoclientwhichwillhavethefollowingformat:HTTP-message=|;HTTP/1.
1messagesHTTPrequestsandHTTPresponsesuseagenericmessageformatofRFC822fortransferringtherequireddata.
Thisgenericmessageformatconsistsofthefollowingfouritems.
AStart-lineZeroormoreheaderfieldsfollowedbyCRLFAnemptyline(i.
e.
,alinewithnothingprecedingtheCRLF)indicatingtheendoftheheaderfieldsOptionallyamessage-bodyInthefollowingsections,wewillexplaineachoftheentitiesusedinanHTTPmessage.
3.
MESSAGESHTTP8MessageStart-LineAstart-linewillhavethefollowinggenericsyntax:start-line=Request-Line|Status-LineWewilldiscussRequest-LineandStatus-LinewhilediscussingHTTPRequestandHTTPResponsemessagesrespectively.
Fornow,let'sseetheexamplesofstartlineincaseofrequestandresponse:GET/hello.
htmHTTP/1.
1(ThisisRequest-Linesentbytheclient)HTTP/1.
1200OK(ThisisStatus-Linesentbytheserver)HeaderFieldsHTTPheaderfieldsproviderequiredinformationabouttherequestorresponse,orabouttheobjectsentinthemessagebody.
TherearefourtypesofHTTPmessageheaders:General-header:Theseheaderfieldshavegeneralapplicabilityforbothrequestandresponsemessages.
Request-header:Theseheaderfieldshaveapplicabilityonlyforrequestmessages.
Response-header:Theseheaderfieldshaveapplicabilityonlyforresponsemessages.
Entity-header:Theseheaderfieldsdefinemeta-informationabouttheentity-bodyor,ifnobodyispresent,abouttheresourceidentifiedbytherequest.
Alltheabove-mentionedheadersfollowthesamegenericformatandeachoftheheaderfieldconsistsofanamefollowedbyacolon(:)andthefieldvalueasfollows:message-header=field-name":"[field-value]Followingaretheexamplesofvariousheaderfields:User-Agent:curl/7.
16.
3libcurl/7.
16.
3OpenSSL/0.
9.
7lzlib/1.
2.
3Host:www.
example.
comAccept-Language:en,miDate:Mon,27Jul200912:28:53GMTHTTP9Server:ApacheLast-Modified:Wed,22Jul200919:15:56GMTETag:"34aa387-d-1568eb00"Accept-Ranges:bytesContent-Length:51Vary:Accept-EncodingContent-Type:text/plainMessageBodyThemessagebodypartisoptionalforanHTTPmessagebutifitisavailable,thenitisusedtocarrytheentity-bodyassociatedwiththerequestorresponse.
Ifentitybodyisassociated,thenusuallyContent-TypeandContent-Lengthheaderslinesspecifythenatureofthebodyassociated.
AmessagebodyistheonewhichcarriestheactualHTTPrequestdata(includingformdataanduploaded,etc.
)andHTTPresponsedatafromtheserver(includingfiles,images,etc.
).
Shownbelowisthesimplecontentofamessagebody:Hello,World!
HTTP10AnHTTPclientsendsanHTTPrequesttoaserverintheformofarequestmessagewhichincludesthefollowingformat:ARequest-lineZeroormoreheader(General|Request|Entity)fieldsfollowedbyCRLFAnemptyline(i.
e.
,alinewithnothingprecedingtheCRLF)indicatingtheendoftheheaderfieldsOptionallyamessage-bodyThefollowingsectionsexplaineachoftheentitiesusedinanHTTPrequestmessage.
Request-LineTheRequest-Linebeginswithamethodtoken,followedbytheRequest-URIandtheprotocolversion,andendingwithCRLF.
TheelementsareseparatedbyspaceSPcharacters.
Request-Line=MethodSPRequest-URISPHTTP-VersionCRLFLet'sdiscusseachofthepartsmentionedintheRequest-Line.
RequestMethodTherequestmethodindicatesthemethodtobeperformedontheresourceidentifiedbythegivenRequest-URI.
Themethodiscase-sensitiveandshouldalwaysbementionedinuppercase.
ThefollowingtablelistsallthesupportedmethodsinHTTP/1.
1.
4.
REQUESTSHTTP11EndofebookpreviewIfyoulikedwhatyousaw…Buyitfromourstore@https://store.
tutorialspoint.
com

享有云:美国BGP云服务器低至20元/月起,首月打折;香港2核2G2M仅50元/月起

享有云怎么样?享有云是一家新的国内云服务器商家,目前提供国内、香港及海外地区的云服务器,拥有多线路如:BGP线路、CN2线路、高防等云服务器,并且提供稳定、安全、弹性、高性能的云端计算服务,实时满足您的多样性业务需求。目前,美国bgp云服务器,5M带宽,低至20元/月起,270元/年起,首月打折;香港2核2G2M仅50元/月起,450元/年起!点击进入:享有云官方网站地址享有云优惠活动:一、美国B...

御云(RoyalYun):香港CN2 GIA VPS仅7.9元每月起,美国vps仅8.9/月,续费同价,可叠加优惠

御云怎么样?炎炎暑期即将来临,御云(royalyun)香港、美国服务器开启大特惠模式。御云是新成立的云服务提供商,主要提供香港、美国的云服务器,不久将开启虚拟主机业务。我们的香港和美国主机采用CN2 GIA线路。目前,香港cn2 gia vps仅7.9元每月起,美国vps仅8.9/月,续费同价,可叠加优惠,香港云服务器国内延迟一般在50ms左右,是搭建网站的最佳选择,但是请不要用于违法用途。点击进...

georgedatacenter:美国VPS可选洛杉矶/芝加哥/纽约/达拉斯机房,$20/年;洛杉矶独立服务器39美元/月

georgedatacenter怎么样?georgedatacenter这次其实是两个促销,一是促销一款特价洛杉矶E3-1220 V5独服,性价比其实最高;另外还促销三款特价vps,大家可以根据自己的需要入手。georgedatacenter是一家成立于2019年的美国vps商家,主营美国洛杉矶、芝加哥、达拉斯、新泽西、西雅图机房的VPS、邮件服务器和托管独立服务器业务。georgedatacen...

acceptencoding为你推荐
合肥morphvox程序微信5支持ipad支持ipad支持ipad支持ipad国家标准苹果5windows键是哪个windows 快捷键 大全win10445端口win7系统不能被telnet端口号,端口、服务什么全都开了x-routerx-arcsinx的等价无穷小是什么?
中国互联网域名注册 免费com域名注册 域名估价 linuxvps 132邮箱 企业主机 漂亮qq空间 国外空间服务商 sockscap 免费名片模板 godaddy me空间社区 183是联通还是移动 免费网页空间 流媒体加速 服务器是干什么用的 www789 新加坡空间 日本代理ip 数据湾 更多