http1.1-rfc2616.txt 412 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859
  1. Network Working Group R. Fielding
  2. Request for Comments: 2616 UC Irvine
  3. Obsoletes: 2068 J. Gettys
  4. Category: Standards Track Compaq/W3C
  5. J. Mogul
  6. Compaq
  7. H. Frystyk
  8. W3C/MIT
  9. L. Masinter
  10. Xerox
  11. P. Leach
  12. Microsoft
  13. T. Berners-Lee
  14. W3C/MIT
  15. June 1999
  16. Hypertext Transfer Protocol -- HTTP/1.1
  17. Status of this Memo
  18. This document specifies an Internet standards track protocol for the
  19. Internet community, and requests discussion and suggestions for
  20. improvements. Please refer to the current edition of the "Internet
  21. Official Protocol Standards" (STD 1) for the standardization state
  22. and status of this protocol. Distribution of this memo is unlimited.
  23. Copyright Notice
  24. Copyright (C) The Internet Society (1999). All Rights Reserved.
  25. Abstract
  26. The Hypertext Transfer Protocol (HTTP) is an application-level
  27. protocol for distributed, collaborative, hypermedia information
  28. systems. It is a generic, stateless, protocol which can be used for
  29. many tasks beyond its use for hypertext, such as name servers and
  30. distributed object management systems, through extension of its
  31. request methods, error codes and headers [47]. A feature of HTTP is
  32. the typing and negotiation of data representation, allowing systems
  33. to be built independently of the data being transferred.
  34. HTTP has been in use by the World-Wide Web global information
  35. initiative since 1990. This specification defines the protocol
  36. referred to as "HTTP/1.1", and is an update to RFC 2068 [33].
  37. Fielding, et al. Standards Track [Page 1]
  38. RFC 2616 HTTP/1.1 June 1999
  39. Table of Contents
  40. 1 Introduction ...................................................7
  41. 1.1 Purpose......................................................7
  42. 1.2 Requirements .................................................8
  43. 1.3 Terminology ..................................................8
  44. 1.4 Overall Operation ...........................................12
  45. 2 Notational Conventions and Generic Grammar ....................14
  46. 2.1 Augmented BNF ...............................................14
  47. 2.2 Basic Rules .................................................15
  48. 3 Protocol Parameters ...........................................17
  49. 3.1 HTTP Version ................................................17
  50. 3.2 Uniform Resource Identifiers ................................18
  51. 3.2.1 General Syntax ...........................................19
  52. 3.2.2 http URL .................................................19
  53. 3.2.3 URI Comparison ...........................................20
  54. 3.3 Date/Time Formats ...........................................20
  55. 3.3.1 Full Date ................................................20
  56. 3.3.2 Delta Seconds ............................................21
  57. 3.4 Character Sets ..............................................21
  58. 3.4.1 Missing Charset ..........................................22
  59. 3.5 Content Codings .............................................23
  60. 3.6 Transfer Codings ............................................24
  61. 3.6.1 Chunked Transfer Coding ..................................25
  62. 3.7 Media Types .................................................26
  63. 3.7.1 Canonicalization and Text Defaults .......................27
  64. 3.7.2 Multipart Types ..........................................27
  65. 3.8 Product Tokens ..............................................28
  66. 3.9 Quality Values ..............................................29
  67. 3.10 Language Tags ...............................................29
  68. 3.11 Entity Tags .................................................30
  69. 3.12 Range Units .................................................30
  70. 4 HTTP Message ..................................................31
  71. 4.1 Message Types ...............................................31
  72. 4.2 Message Headers .............................................31
  73. 4.3 Message Body ................................................32
  74. 4.4 Message Length ..............................................33
  75. 4.5 General Header Fields .......................................34
  76. 5 Request .......................................................35
  77. 5.1 Request-Line ................................................35
  78. 5.1.1 Method ...................................................36
  79. 5.1.2 Request-URI ..............................................36
  80. 5.2 The Resource Identified by a Request ........................38
  81. 5.3 Request Header Fields .......................................38
  82. 6 Response ......................................................39
  83. 6.1 Status-Line .................................................39
  84. 6.1.1 Status Code and Reason Phrase ............................39
  85. 6.2 Response Header Fields ......................................41
  86. Fielding, et al. Standards Track [Page 2]
  87. RFC 2616 HTTP/1.1 June 1999
  88. 7 Entity ........................................................42
  89. 7.1 Entity Header Fields ........................................42
  90. 7.2 Entity Body .................................................43
  91. 7.2.1 Type .....................................................43
  92. 7.2.2 Entity Length ............................................43
  93. 8 Connections ...................................................44
  94. 8.1 Persistent Connections ......................................44
  95. 8.1.1 Purpose ..................................................44
  96. 8.1.2 Overall Operation ........................................45
  97. 8.1.3 Proxy Servers ............................................46
  98. 8.1.4 Practical Considerations .................................46
  99. 8.2 Message Transmission Requirements ...........................47
  100. 8.2.1 Persistent Connections and Flow Control ..................47
  101. 8.2.2 Monitoring Connections for Error Status Messages .........48
  102. 8.2.3 Use of the 100 (Continue) Status .........................48
  103. 8.2.4 Client Behavior if Server Prematurely Closes Connection ..50
  104. 9 Method Definitions ............................................51
  105. 9.1 Safe and Idempotent Methods .................................51
  106. 9.1.1 Safe Methods .............................................51
  107. 9.1.2 Idempotent Methods .......................................51
  108. 9.2 OPTIONS .....................................................52
  109. 9.3 GET .........................................................53
  110. 9.4 HEAD ........................................................54
  111. 9.5 POST ........................................................54
  112. 9.6 PUT .........................................................55
  113. 9.7 DELETE ......................................................56
  114. 9.8 TRACE .......................................................56
  115. 9.9 CONNECT .....................................................57
  116. 10 Status Code Definitions ......................................57
  117. 10.1 Informational 1xx ...........................................57
  118. 10.1.1 100 Continue .............................................58
  119. 10.1.2 101 Switching Protocols ..................................58
  120. 10.2 Successful 2xx ..............................................58
  121. 10.2.1 200 OK ...................................................58
  122. 10.2.2 201 Created ..............................................59
  123. 10.2.3 202 Accepted .............................................59
  124. 10.2.4 203 Non-Authoritative Information ........................59
  125. 10.2.5 204 No Content ...........................................60
  126. 10.2.6 205 Reset Content ........................................60
  127. 10.2.7 206 Partial Content ......................................60
  128. 10.3 Redirection 3xx .............................................61
  129. 10.3.1 300 Multiple Choices .....................................61
  130. 10.3.2 301 Moved Permanently ....................................62
  131. 10.3.3 302 Found ................................................62
  132. 10.3.4 303 See Other ............................................63
  133. 10.3.5 304 Not Modified .........................................63
  134. 10.3.6 305 Use Proxy ............................................64
  135. 10.3.7 306 (Unused) .............................................64
  136. Fielding, et al. Standards Track [Page 3]
  137. RFC 2616 HTTP/1.1 June 1999
  138. 10.3.8 307 Temporary Redirect ...................................65
  139. 10.4 Client Error 4xx ............................................65
  140. 10.4.1 400 Bad Request .........................................65
  141. 10.4.2 401 Unauthorized ........................................66
  142. 10.4.3 402 Payment Required ....................................66
  143. 10.4.4 403 Forbidden ...........................................66
  144. 10.4.5 404 Not Found ...........................................66
  145. 10.4.6 405 Method Not Allowed ..................................66
  146. 10.4.7 406 Not Acceptable ......................................67
  147. 10.4.8 407 Proxy Authentication Required .......................67
  148. 10.4.9 408 Request Timeout .....................................67
  149. 10.4.10 409 Conflict ............................................67
  150. 10.4.11 410 Gone ................................................68
  151. 10.4.12 411 Length Required .....................................68
  152. 10.4.13 412 Precondition Failed .................................68
  153. 10.4.14 413 Request Entity Too Large ............................69
  154. 10.4.15 414 Request-URI Too Long ................................69
  155. 10.4.16 415 Unsupported Media Type ..............................69
  156. 10.4.17 416 Requested Range Not Satisfiable .....................69
  157. 10.4.18 417 Expectation Failed ..................................70
  158. 10.5 Server Error 5xx ............................................70
  159. 10.5.1 500 Internal Server Error ................................70
  160. 10.5.2 501 Not Implemented ......................................70
  161. 10.5.3 502 Bad Gateway ..........................................70
  162. 10.5.4 503 Service Unavailable ..................................70
  163. 10.5.5 504 Gateway Timeout ......................................71
  164. 10.5.6 505 HTTP Version Not Supported ...........................71
  165. 11 Access Authentication ........................................71
  166. 12 Content Negotiation ..........................................71
  167. 12.1 Server-driven Negotiation ...................................72
  168. 12.2 Agent-driven Negotiation ....................................73
  169. 12.3 Transparent Negotiation .....................................74
  170. 13 Caching in HTTP ..............................................74
  171. 13.1.1 Cache Correctness ........................................75
  172. 13.1.2 Warnings .................................................76
  173. 13.1.3 Cache-control Mechanisms .................................77
  174. 13.1.4 Explicit User Agent Warnings .............................78
  175. 13.1.5 Exceptions to the Rules and Warnings .....................78
  176. 13.1.6 Client-controlled Behavior ...............................79
  177. 13.2 Expiration Model ............................................79
  178. 13.2.1 Server-Specified Expiration ..............................79
  179. 13.2.2 Heuristic Expiration .....................................80
  180. 13.2.3 Age Calculations .........................................80
  181. 13.2.4 Expiration Calculations ..................................83
  182. 13.2.5 Disambiguating Expiration Values .........................84
  183. 13.2.6 Disambiguating Multiple Responses ........................84
  184. 13.3 Validation Model ............................................85
  185. 13.3.1 Last-Modified Dates ......................................86
  186. Fielding, et al. Standards Track [Page 4]
  187. RFC 2616 HTTP/1.1 June 1999
  188. 13.3.2 Entity Tag Cache Validators ..............................86
  189. 13.3.3 Weak and Strong Validators ...............................86
  190. 13.3.4 Rules for When to Use Entity Tags and Last-Modified Dates.89
  191. 13.3.5 Non-validating Conditionals ..............................90
  192. 13.4 Response Cacheability .......................................91
  193. 13.5 Constructing Responses From Caches ..........................92
  194. 13.5.1 End-to-end and Hop-by-hop Headers ........................92
  195. 13.5.2 Non-modifiable Headers ...................................92
  196. 13.5.3 Combining Headers ........................................94
  197. 13.5.4 Combining Byte Ranges ....................................95
  198. 13.6 Caching Negotiated Responses ................................95
  199. 13.7 Shared and Non-Shared Caches ................................96
  200. 13.8 Errors or Incomplete Response Cache Behavior ................97
  201. 13.9 Side Effects of GET and HEAD ................................97
  202. 13.10 Invalidation After Updates or Deletions ...................97
  203. 13.11 Write-Through Mandatory ...................................98
  204. 13.12 Cache Replacement .........................................99
  205. 13.13 History Lists .............................................99
  206. 14 Header Field Definitions ....................................100
  207. 14.1 Accept .....................................................100
  208. 14.2 Accept-Charset .............................................102
  209. 14.3 Accept-Encoding ............................................102
  210. 14.4 Accept-Language ............................................104
  211. 14.5 Accept-Ranges ..............................................105
  212. 14.6 Age ........................................................106
  213. 14.7 Allow ......................................................106
  214. 14.8 Authorization ..............................................107
  215. 14.9 Cache-Control ..............................................108
  216. 14.9.1 What is Cacheable .......................................109
  217. 14.9.2 What May be Stored by Caches ............................110
  218. 14.9.3 Modifications of the Basic Expiration Mechanism .........111
  219. 14.9.4 Cache Revalidation and Reload Controls ..................113
  220. 14.9.5 No-Transform Directive ..................................115
  221. 14.9.6 Cache Control Extensions ................................116
  222. 14.10 Connection ...............................................117
  223. 14.11 Content-Encoding .........................................118
  224. 14.12 Content-Language .........................................118
  225. 14.13 Content-Length ...........................................119
  226. 14.14 Content-Location .........................................120
  227. 14.15 Content-MD5 ..............................................121
  228. 14.16 Content-Range ............................................122
  229. 14.17 Content-Type .............................................124
  230. 14.18 Date .....................................................124
  231. 14.18.1 Clockless Origin Server Operation ......................125
  232. 14.19 ETag .....................................................126
  233. 14.20 Expect ...................................................126
  234. 14.21 Expires ..................................................127
  235. 14.22 From .....................................................128
  236. Fielding, et al. Standards Track [Page 5]
  237. RFC 2616 HTTP/1.1 June 1999
  238. 14.23 Host .....................................................128
  239. 14.24 If-Match .................................................129
  240. 14.25 If-Modified-Since ........................................130
  241. 14.26 If-None-Match ............................................132
  242. 14.27 If-Range .................................................133
  243. 14.28 If-Unmodified-Since ......................................134
  244. 14.29 Last-Modified ............................................134
  245. 14.30 Location .................................................135
  246. 14.31 Max-Forwards .............................................136
  247. 14.32 Pragma ...................................................136
  248. 14.33 Proxy-Authenticate .......................................137
  249. 14.34 Proxy-Authorization ......................................137
  250. 14.35 Range ....................................................138
  251. 14.35.1 Byte Ranges ...........................................138
  252. 14.35.2 Range Retrieval Requests ..............................139
  253. 14.36 Referer ..................................................140
  254. 14.37 Retry-After ..............................................141
  255. 14.38 Server ...................................................141
  256. 14.39 TE .......................................................142
  257. 14.40 Trailer ..................................................143
  258. 14.41 Transfer-Encoding..........................................143
  259. 14.42 Upgrade ..................................................144
  260. 14.43 User-Agent ...............................................145
  261. 14.44 Vary .....................................................145
  262. 14.45 Via ......................................................146
  263. 14.46 Warning ..................................................148
  264. 14.47 WWW-Authenticate .........................................150
  265. 15 Security Considerations .......................................150
  266. 15.1 Personal Information....................................151
  267. 15.1.1 Abuse of Server Log Information .........................151
  268. 15.1.2 Transfer of Sensitive Information .......................151
  269. 15.1.3 Encoding Sensitive Information in URI's .................152
  270. 15.1.4 Privacy Issues Connected to Accept Headers ..............152
  271. 15.2 Attacks Based On File and Path Names .......................153
  272. 15.3 DNS Spoofing ...............................................154
  273. 15.4 Location Headers and Spoofing ..............................154
  274. 15.5 Content-Disposition Issues .................................154
  275. 15.6 Authentication Credentials and Idle Clients ................155
  276. 15.7 Proxies and Caching ........................................155
  277. 15.7.1 Denial of Service Attacks on Proxies....................156
  278. 16 Acknowledgments .............................................156
  279. 17 References ..................................................158
  280. 18 Authors' Addresses ..........................................162
  281. 19 Appendices ..................................................164
  282. 19.1 Internet Media Type message/http and application/http ......164
  283. 19.2 Internet Media Type multipart/byteranges ...................165
  284. 19.3 Tolerant Applications ......................................166
  285. 19.4 Differences Between HTTP Entities and RFC 2045 Entities ....167
  286. Fielding, et al. Standards Track [Page 6]
  287. RFC 2616 HTTP/1.1 June 1999
  288. 19.4.1 MIME-Version ............................................167
  289. 19.4.2 Conversion to Canonical Form ............................167
  290. 19.4.3 Conversion of Date Formats ..............................168
  291. 19.4.4 Introduction of Content-Encoding ........................168
  292. 19.4.5 No Content-Transfer-Encoding ............................168
  293. 19.4.6 Introduction of Transfer-Encoding .......................169
  294. 19.4.7 MHTML and Line Length Limitations .......................169
  295. 19.5 Additional Features ........................................169
  296. 19.5.1 Content-Disposition .....................................170
  297. 19.6 Compatibility with Previous Versions .......................170
  298. 19.6.1 Changes from HTTP/1.0 ...................................171
  299. 19.6.2 Compatibility with HTTP/1.0 Persistent Connections ......172
  300. 19.6.3 Changes from RFC 2068 ...................................172
  301. 20 Index .......................................................175
  302. 21 Full Copyright Statement ....................................176
  303. 1 Introduction
  304. 1.1 Purpose
  305. The Hypertext Transfer Protocol (HTTP) is an application-level
  306. protocol for distributed, collaborative, hypermedia information
  307. systems. HTTP has been in use by the World-Wide Web global
  308. information initiative since 1990. The first version of HTTP,
  309. referred to as HTTP/0.9, was a simple protocol for raw data transfer
  310. across the Internet. HTTP/1.0, as defined by RFC 1945 [6], improved
  311. the protocol by allowing messages to be in the format of MIME-like
  312. messages, containing metainformation about the data transferred and
  313. modifiers on the request/response semantics. However, HTTP/1.0 does
  314. not sufficiently take into consideration the effects of hierarchical
  315. proxies, caching, the need for persistent connections, or virtual
  316. hosts. In addition, the proliferation of incompletely-implemented
  317. applications calling themselves "HTTP/1.0" has necessitated a
  318. protocol version change in order for two communicating applications
  319. to determine each other's true capabilities.
  320. This specification defines the protocol referred to as "HTTP/1.1".
  321. This protocol includes more stringent requirements than HTTP/1.0 in
  322. order to ensure reliable implementation of its features.
  323. Practical information systems require more functionality than simple
  324. retrieval, including search, front-end update, and annotation. HTTP
  325. allows an open-ended set of methods and headers that indicate the
  326. purpose of a request [47]. It builds on the discipline of reference
  327. provided by the Uniform Resource Identifier (URI) [3], as a location
  328. (URL) [4] or name (URN) [20], for indicating the resource to which a
  329. Fielding, et al. Standards Track [Page 7]
  330. RFC 2616 HTTP/1.1 June 1999
  331. method is to be applied. Messages are passed in a format similar to
  332. that used by Internet mail [9] as defined by the Multipurpose
  333. Internet Mail Extensions (MIME) [7].
  334. HTTP is also used as a generic protocol for communication between
  335. user agents and proxies/gateways to other Internet systems, including
  336. those supported by the SMTP [16], NNTP [13], FTP [18], Gopher [2],
  337. and WAIS [10] protocols. In this way, HTTP allows basic hypermedia
  338. access to resources available from diverse applications.
  339. 1.2 Requirements
  340. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  341. "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
  342. document are to be interpreted as described in RFC 2119 [34].
  343. An implementation is not compliant if it fails to satisfy one or more
  344. of the MUST or REQUIRED level requirements for the protocols it
  345. implements. An implementation that satisfies all the MUST or REQUIRED
  346. level and all the SHOULD level requirements for its protocols is said
  347. to be "unconditionally compliant"; one that satisfies all the MUST
  348. level requirements but not all the SHOULD level requirements for its
  349. protocols is said to be "conditionally compliant."
  350. 1.3 Terminology
  351. This specification uses a number of terms to refer to the roles
  352. played by participants in, and objects of, the HTTP communication.
  353. connection
  354. A transport layer virtual circuit established between two programs
  355. for the purpose of communication.
  356. message
  357. The basic unit of HTTP communication, consisting of a structured
  358. sequence of octets matching the syntax defined in section 4 and
  359. transmitted via the connection.
  360. request
  361. An HTTP request message, as defined in section 5.
  362. response
  363. An HTTP response message, as defined in section 6.
  364. Fielding, et al. Standards Track [Page 8]
  365. RFC 2616 HTTP/1.1 June 1999
  366. resource
  367. A network data object or service that can be identified by a URI,
  368. as defined in section 3.2. Resources may be available in multiple
  369. representations (e.g. multiple languages, data formats, size, and
  370. resolutions) or vary in other ways.
  371. entity
  372. The information transferred as the payload of a request or
  373. response. An entity consists of metainformation in the form of
  374. entity-header fields and content in the form of an entity-body, as
  375. described in section 7.
  376. representation
  377. An entity included with a response that is subject to content
  378. negotiation, as described in section 12. There may exist multiple
  379. representations associated with a particular response status.
  380. content negotiation
  381. The mechanism for selecting the appropriate representation when
  382. servicing a request, as described in section 12. The
  383. representation of entities in any response can be negotiated
  384. (including error responses).
  385. variant
  386. A resource may have one, or more than one, representation(s)
  387. associated with it at any given instant. Each of these
  388. representations is termed a `varriant'. Use of the term `variant'
  389. does not necessarily imply that the resource is subject to content
  390. negotiation.
  391. client
  392. A program that establishes connections for the purpose of sending
  393. requests.
  394. user agent
  395. The client which initiates a request. These are often browsers,
  396. editors, spiders (web-traversing robots), or other end user tools.
  397. server
  398. An application program that accepts connections in order to
  399. service requests by sending back responses. Any given program may
  400. be capable of being both a client and a server; our use of these
  401. terms refers only to the role being performed by the program for a
  402. particular connection, rather than to the program's capabilities
  403. in general. Likewise, any server may act as an origin server,
  404. proxy, gateway, or tunnel, switching behavior based on the nature
  405. of each request.
  406. Fielding, et al. Standards Track [Page 9]
  407. RFC 2616 HTTP/1.1 June 1999
  408. origin server
  409. The server on which a given resource resides or is to be created.
  410. proxy
  411. An intermediary program which acts as both a server and a client
  412. for the purpose of making requests on behalf of other clients.
  413. Requests are serviced internally or by passing them on, with
  414. possible translation, to other servers. A proxy MUST implement
  415. both the client and server requirements of this specification. A
  416. "transparent proxy" is a proxy that does not modify the request or
  417. response beyond what is required for proxy authentication and
  418. identification. A "non-transparent proxy" is a proxy that modifies
  419. the request or response in order to provide some added service to
  420. the user agent, such as group annotation services, media type
  421. transformation, protocol reduction, or anonymity filtering. Except
  422. where either transparent or non-transparent behavior is explicitly
  423. stated, the HTTP proxy requirements apply to both types of
  424. proxies.
  425. gateway
  426. A server which acts as an intermediary for some other server.
  427. Unlike a proxy, a gateway receives requests as if it were the
  428. origin server for the requested resource; the requesting client
  429. may not be aware that it is communicating with a gateway.
  430. tunnel
  431. An intermediary program which is acting as a blind relay between
  432. two connections. Once active, a tunnel is not considered a party
  433. to the HTTP communication, though the tunnel may have been
  434. initiated by an HTTP request. The tunnel ceases to exist when both
  435. ends of the relayed connections are closed.
  436. cache
  437. A program's local store of response messages and the subsystem
  438. that controls its message storage, retrieval, and deletion. A
  439. cache stores cacheable responses in order to reduce the response
  440. time and network bandwidth consumption on future, equivalent
  441. requests. Any client or server may include a cache, though a cache
  442. cannot be used by a server that is acting as a tunnel.
  443. cacheable
  444. A response is cacheable if a cache is allowed to store a copy of
  445. the response message for use in answering subsequent requests. The
  446. rules for determining the cacheability of HTTP responses are
  447. defined in section 13. Even if a resource is cacheable, there may
  448. be additional constraints on whether a cache can use the cached
  449. copy for a particular request.
  450. Fielding, et al. Standards Track [Page 10]
  451. RFC 2616 HTTP/1.1 June 1999
  452. first-hand
  453. A response is first-hand if it comes directly and without
  454. unnecessary delay from the origin server, perhaps via one or more
  455. proxies. A response is also first-hand if its validity has just
  456. been checked directly with the origin server.
  457. explicit expiration time
  458. The time at which the origin server intends that an entity should
  459. no longer be returned by a cache without further validation.
  460. heuristic expiration time
  461. An expiration time assigned by a cache when no explicit expiration
  462. time is available.
  463. age
  464. The age of a response is the time since it was sent by, or
  465. successfully validated with, the origin server.
  466. freshness lifetime
  467. The length of time between the generation of a response and its
  468. expiration time.
  469. fresh
  470. A response is fresh if its age has not yet exceeded its freshness
  471. lifetime.
  472. stale
  473. A response is stale if its age has passed its freshness lifetime.
  474. semantically transparent
  475. A cache behaves in a "semantically transparent" manner, with
  476. respect to a particular response, when its use affects neither the
  477. requesting client nor the origin server, except to improve
  478. performance. When a cache is semantically transparent, the client
  479. receives exactly the same response (except for hop-by-hop headers)
  480. that it would have received had its request been handled directly
  481. by the origin server.
  482. validator
  483. A protocol element (e.g., an entity tag or a Last-Modified time)
  484. that is used to find out whether a cache entry is an equivalent
  485. copy of an entity.
  486. upstream/downstream
  487. Upstream and downstream describe the flow of a message: all
  488. messages flow from upstream to downstream.
  489. Fielding, et al. Standards Track [Page 11]
  490. RFC 2616 HTTP/1.1 June 1999
  491. inbound/outbound
  492. Inbound and outbound refer to the request and response paths for
  493. messages: "inbound" means "traveling toward the origin server",
  494. and "outbound" means "traveling toward the user agent"
  495. 1.4 Overall Operation
  496. The HTTP protocol is a request/response protocol. A client sends a
  497. request to the server in the form of a request method, URI, and
  498. protocol version, followed by a MIME-like message containing request
  499. modifiers, client information, and possible body content over a
  500. connection with a server. The server responds with a status line,
  501. including the message's protocol version and a success or error code,
  502. followed by a MIME-like message containing server information, entity
  503. metainformation, and possible entity-body content. The relationship
  504. between HTTP and MIME is described in appendix 19.4.
  505. Most HTTP communication is initiated by a user agent and consists of
  506. a request to be applied to a resource on some origin server. In the
  507. simplest case, this may be accomplished via a single connection (v)
  508. between the user agent (UA) and the origin server (O).
  509. request chain ------------------------>
  510. UA -------------------v------------------- O
  511. <----------------------- response chain
  512. A more complicated situation occurs when one or more intermediaries
  513. are present in the request/response chain. There are three common
  514. forms of intermediary: proxy, gateway, and tunnel. A proxy is a
  515. forwarding agent, receiving requests for a URI in its absolute form,
  516. rewriting all or part of the message, and forwarding the reformatted
  517. request toward the server identified by the URI. A gateway is a
  518. receiving agent, acting as a layer above some other server(s) and, if
  519. necessary, translating the requests to the underlying server's
  520. protocol. A tunnel acts as a relay point between two connections
  521. without changing the messages; tunnels are used when the
  522. communication needs to pass through an intermediary (such as a
  523. firewall) even when the intermediary cannot understand the contents
  524. of the messages.
  525. request chain -------------------------------------->
  526. UA -----v----- A -----v----- B -----v----- C -----v----- O
  527. <------------------------------------- response chain
  528. The figure above shows three intermediaries (A, B, and C) between the
  529. user agent and origin server. A request or response message that
  530. travels the whole chain will pass through four separate connections.
  531. This distinction is important because some HTTP communication options
  532. Fielding, et al. Standards Track [Page 12]
  533. RFC 2616 HTTP/1.1 June 1999
  534. may apply only to the connection with the nearest, non-tunnel
  535. neighbor, only to the end-points of the chain, or to all connections
  536. along the chain. Although the diagram is linear, each participant may
  537. be engaged in multiple, simultaneous communications. For example, B
  538. may be receiving requests from many clients other than A, and/or
  539. forwarding requests to servers other than C, at the same time that it
  540. is handling A's request.
  541. Any party to the communication which is not acting as a tunnel may
  542. employ an internal cache for handling requests. The effect of a cache
  543. is that the request/response chain is shortened if one of the
  544. participants along the chain has a cached response applicable to that
  545. request. The following illustrates the resulting chain if B has a
  546. cached copy of an earlier response from O (via C) for a request which
  547. has not been cached by UA or A.
  548. request chain ---------->
  549. UA -----v----- A -----v----- B - - - - - - C - - - - - - O
  550. <--------- response chain
  551. Not all responses are usefully cacheable, and some requests may
  552. contain modifiers which place special requirements on cache behavior.
  553. HTTP requirements for cache behavior and cacheable responses are
  554. defined in section 13.
  555. In fact, there are a wide variety of architectures and configurations
  556. of caches and proxies currently being experimented with or deployed
  557. across the World Wide Web. These systems include national hierarchies
  558. of proxy caches to save transoceanic bandwidth, systems that
  559. broadcast or multicast cache entries, organizations that distribute
  560. subsets of cached data via CD-ROM, and so on. HTTP systems are used
  561. in corporate intranets over high-bandwidth links, and for access via
  562. PDAs with low-power radio links and intermittent connectivity. The
  563. goal of HTTP/1.1 is to support the wide diversity of configurations
  564. already deployed while introducing protocol constructs that meet the
  565. needs of those who build web applications that require high
  566. reliability and, failing that, at least reliable indications of
  567. failure.
  568. HTTP communication usually takes place over TCP/IP connections. The
  569. default port is TCP 80 [19], but other ports can be used. This does
  570. not preclude HTTP from being implemented on top of any other protocol
  571. on the Internet, or on other networks. HTTP only presumes a reliable
  572. transport; any protocol that provides such guarantees can be used;
  573. the mapping of the HTTP/1.1 request and response structures onto the
  574. transport data units of the protocol in question is outside the scope
  575. of this specification.
  576. Fielding, et al. Standards Track [Page 13]
  577. RFC 2616 HTTP/1.1 June 1999
  578. In HTTP/1.0, most implementations used a new connection for each
  579. request/response exchange. In HTTP/1.1, a connection may be used for
  580. one or more request/response exchanges, although connections may be
  581. closed for a variety of reasons (see section 8.1).
  582. 2 Notational Conventions and Generic Grammar
  583. 2.1 Augmented BNF
  584. All of the mechanisms specified in this document are described in
  585. both prose and an augmented Backus-Naur Form (BNF) similar to that
  586. used by RFC 822 [9]. Implementors will need to be familiar with the
  587. notation in order to understand this specification. The augmented BNF
  588. includes the following constructs:
  589. name = definition
  590. The name of a rule is simply the name itself (without any
  591. enclosing "<" and ">") and is separated from its definition by the
  592. equal "=" character. White space is only significant in that
  593. indentation of continuation lines is used to indicate a rule
  594. definition that spans more than one line. Certain basic rules are
  595. in uppercase, such as SP, LWS, HT, CRLF, DIGIT, ALPHA, etc. Angle
  596. brackets are used within definitions whenever their presence will
  597. facilitate discerning the use of rule names.
  598. "literal"
  599. Quotation marks surround literal text. Unless stated otherwise,
  600. the text is case-insensitive.
  601. rule1 | rule2
  602. Elements separated by a bar ("|") are alternatives, e.g., "yes |
  603. no" will accept yes or no.
  604. (rule1 rule2)
  605. Elements enclosed in parentheses are treated as a single element.
  606. Thus, "(elem (foo | bar) elem)" allows the token sequences "elem
  607. foo elem" and "elem bar elem".
  608. *rule
  609. The character "*" preceding an element indicates repetition. The
  610. full form is "<n>*<m>element" indicating at least <n> and at most
  611. <m> occurrences of element. Default values are 0 and infinity so
  612. that "*(element)" allows any number, including zero; "1*element"
  613. requires at least one; and "1*2element" allows one or two.
  614. [rule]
  615. Square brackets enclose optional elements; "[foo bar]" is
  616. equivalent to "*1(foo bar)".
  617. Fielding, et al. Standards Track [Page 14]
  618. RFC 2616 HTTP/1.1 June 1999
  619. N rule
  620. Specific repetition: "<n>(element)" is equivalent to
  621. "<n>*<n>(element)"; that is, exactly <n> occurrences of (element).
  622. Thus 2DIGIT is a 2-digit number, and 3ALPHA is a string of three
  623. alphabetic characters.
  624. #rule
  625. A construct "#" is defined, similar to "*", for defining lists of
  626. elements. The full form is "<n>#<m>element" indicating at least
  627. <n> and at most <m> elements, each separated by one or more commas
  628. (",") and OPTIONAL linear white space (LWS). This makes the usual
  629. form of lists very easy; a rule such as
  630. ( *LWS element *( *LWS "," *LWS element ))
  631. can be shown as
  632. 1#element
  633. Wherever this construct is used, null elements are allowed, but do
  634. not contribute to the count of elements present. That is,
  635. "(element), , (element) " is permitted, but counts as only two
  636. elements. Therefore, where at least one element is required, at
  637. least one non-null element MUST be present. Default values are 0
  638. and infinity so that "#element" allows any number, including zero;
  639. "1#element" requires at least one; and "1#2element" allows one or
  640. two.
  641. ; comment
  642. A semi-colon, set off some distance to the right of rule text,
  643. starts a comment that continues to the end of line. This is a
  644. simple way of including useful notes in parallel with the
  645. specifications.
  646. implied *LWS
  647. The grammar described by this specification is word-based. Except
  648. where noted otherwise, linear white space (LWS) can be included
  649. between any two adjacent words (token or quoted-string), and
  650. between adjacent words and separators, without changing the
  651. interpretation of a field. At least one delimiter (LWS and/or
  652. separators) MUST exist between any two tokens (for the definition
  653. of "token" below), since they would otherwise be interpreted as a
  654. single token.
  655. 2.2 Basic Rules
  656. The following rules are used throughout this specification to
  657. describe basic parsing constructs. The US-ASCII coded character set
  658. is defined by ANSI X3.4-1986 [21].
  659. Fielding, et al. Standards Track [Page 15]
  660. RFC 2616 HTTP/1.1 June 1999
  661. OCTET = <any 8-bit sequence of data>
  662. CHAR = <any US-ASCII character (octets 0 - 127)>
  663. UPALPHA = <any US-ASCII uppercase letter "A".."Z">
  664. LOALPHA = <any US-ASCII lowercase letter "a".."z">
  665. ALPHA = UPALPHA | LOALPHA
  666. DIGIT = <any US-ASCII digit "0".."9">
  667. CTL = <any US-ASCII control character
  668. (octets 0 - 31) and DEL (127)>
  669. CR = <US-ASCII CR, carriage return (13)>
  670. LF = <US-ASCII LF, linefeed (10)>
  671. SP = <US-ASCII SP, space (32)>
  672. HT = <US-ASCII HT, horizontal-tab (9)>
  673. <"> = <US-ASCII double-quote mark (34)>
  674. HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all
  675. protocol elements except the entity-body (see appendix 19.3 for
  676. tolerant applications). The end-of-line marker within an entity-body
  677. is defined by its associated media type, as described in section 3.7.
  678. CRLF = CR LF
  679. HTTP/1.1 header field values can be folded onto multiple lines if the
  680. continuation line begins with a space or horizontal tab. All linear
  681. white space, including folding, has the same semantics as SP. A
  682. recipient MAY replace any linear white space with a single SP before
  683. interpreting the field value or forwarding the message downstream.
  684. LWS = [CRLF] 1*( SP | HT )
  685. The TEXT rule is only used for descriptive field contents and values
  686. that are not intended to be interpreted by the message parser. Words
  687. of *TEXT MAY contain characters from character sets other than ISO-
  688. 8859-1 [22] only when encoded according to the rules of RFC 2047
  689. [14].
  690. TEXT = <any OCTET except CTLs,
  691. but including LWS>
  692. A CRLF is allowed in the definition of TEXT only as part of a header
  693. field continuation. It is expected that the folding LWS will be
  694. replaced with a single SP before interpretation of the TEXT value.
  695. Hexadecimal numeric characters are used in several protocol elements.
  696. HEX = "A" | "B" | "C" | "D" | "E" | "F"
  697. | "a" | "b" | "c" | "d" | "e" | "f" | DIGIT
  698. Fielding, et al. Standards Track [Page 16]
  699. RFC 2616 HTTP/1.1 June 1999
  700. Many HTTP/1.1 header field values consist of words separated by LWS
  701. or special characters. These special characters MUST be in a quoted
  702. string to be used within a parameter value (as defined in section
  703. 3.6).
  704. token = 1*<any CHAR except CTLs or separators>
  705. separators = "(" | ")" | "<" | ">" | "@"
  706. | "," | ";" | ":" | "\" | <">
  707. | "/" | "[" | "]" | "?" | "="
  708. | "{" | "}" | SP | HT
  709. Comments can be included in some HTTP header fields by surrounding
  710. the comment text with parentheses. Comments are only allowed in
  711. fields containing "comment" as part of their field value definition.
  712. In all other fields, parentheses are considered part of the field
  713. value.
  714. comment = "(" *( ctext | quoted-pair | comment ) ")"
  715. ctext = <any TEXT excluding "(" and ")">
  716. A string of text is parsed as a single word if it is quoted using
  717. double-quote marks.
  718. quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
  719. qdtext = <any TEXT except <">>
  720. The backslash character ("\") MAY be used as a single-character
  721. quoting mechanism only within quoted-string and comment constructs.
  722. quoted-pair = "\" CHAR
  723. 3 Protocol Parameters
  724. 3.1 HTTP Version
  725. HTTP uses a "<major>.<minor>" numbering scheme to indicate versions
  726. of the protocol. The protocol versioning policy is intended to allow
  727. the sender to indicate the format of a message and its capacity for
  728. understanding further HTTP communication, rather than the features
  729. obtained via that communication. No change is made to the version
  730. number for the addition of message components which do not affect
  731. communication behavior or which only add to extensible field values.
  732. The <minor> number is incremented when the changes made to the
  733. protocol add features which do not change the general message parsing
  734. algorithm, but which may add to the message semantics and imply
  735. additional capabilities of the sender. The <major> number is
  736. incremented when the format of a message within the protocol is
  737. changed. See RFC 2145 [36] for a fuller explanation.
  738. Fielding, et al. Standards Track [Page 17]
  739. RFC 2616 HTTP/1.1 June 1999
  740. The version of an HTTP message is indicated by an HTTP-Version field
  741. in the first line of the message.
  742. HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT
  743. Note that the major and minor numbers MUST be treated as separate
  744. integers and that each MAY be incremented higher than a single digit.
  745. Thus, HTTP/2.4 is a lower version than HTTP/2.13, which in turn is
  746. lower than HTTP/12.3. Leading zeros MUST be ignored by recipients and
  747. MUST NOT be sent.
  748. An application that sends a request or response message that includes
  749. HTTP-Version of "HTTP/1.1" MUST be at least conditionally compliant
  750. with this specification. Applications that are at least conditionally
  751. compliant with this specification SHOULD use an HTTP-Version of
  752. "HTTP/1.1" in their messages, and MUST do so for any message that is
  753. not compatible with HTTP/1.0. For more details on when to send
  754. specific HTTP-Version values, see RFC 2145 [36].
  755. The HTTP version of an application is the highest HTTP version for
  756. which the application is at least conditionally compliant.
  757. Proxy and gateway applications need to be careful when forwarding
  758. messages in protocol versions different from that of the application.
  759. Since the protocol version indicates the protocol capability of the
  760. sender, a proxy/gateway MUST NOT send a message with a version
  761. indicator which is greater than its actual version. If a higher
  762. version request is received, the proxy/gateway MUST either downgrade
  763. the request version, or respond with an error, or switch to tunnel
  764. behavior.
  765. Due to interoperability problems with HTTP/1.0 proxies discovered
  766. since the publication of RFC 2068[33], caching proxies MUST, gateways
  767. MAY, and tunnels MUST NOT upgrade the request to the highest version
  768. they support. The proxy/gateway's response to that request MUST be in
  769. the same major version as the request.
  770. Note: Converting between versions of HTTP may involve modification
  771. of header fields required or forbidden by the versions involved.
  772. 3.2 Uniform Resource Identifiers
  773. URIs have been known by many names: WWW addresses, Universal Document
  774. Identifiers, Universal Resource Identifiers [3], and finally the
  775. combination of Uniform Resource Locators (URL) [4] and Names (URN)
  776. [20]. As far as HTTP is concerned, Uniform Resource Identifiers are
  777. simply formatted strings which identify--via name, location, or any
  778. other characteristic--a resource.
  779. Fielding, et al. Standards Track [Page 18]
  780. RFC 2616 HTTP/1.1 June 1999
  781. 3.2.1 General Syntax
  782. URIs in HTTP can be represented in absolute form or relative to some
  783. known base URI [11], depending upon the context of their use. The two
  784. forms are differentiated by the fact that absolute URIs always begin
  785. with a scheme name followed by a colon. For definitive information on
  786. URL syntax and semantics, see "Uniform Resource Identifiers (URI):
  787. Generic Syntax and Semantics," RFC 2396 [42] (which replaces RFCs
  788. 1738 [4] and RFC 1808 [11]). This specification adopts the
  789. definitions of "URI-reference", "absoluteURI", "relativeURI", "port",
  790. "host","abs_path", "rel_path", and "authority" from that
  791. specification.
  792. The HTTP protocol does not place any a priori limit on the length of
  793. a URI. Servers MUST be able to handle the URI of any resource they
  794. serve, and SHOULD be able to handle URIs of unbounded length if they
  795. provide GET-based forms that could generate such URIs. A server
  796. SHOULD return 414 (Request-URI Too Long) status if a URI is longer
  797. than the server can handle (see section 10.4.15).
  798. Note: Servers ought to be cautious about depending on URI lengths
  799. above 255 bytes, because some older client or proxy
  800. implementations might not properly support these lengths.
  801. 3.2.2 http URL
  802. The "http" scheme is used to locate network resources via the HTTP
  803. protocol. This section defines the scheme-specific syntax and
  804. semantics for http URLs.
  805. http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]
  806. If the port is empty or not given, port 80 is assumed. The semantics
  807. are that the identified resource is located at the server listening
  808. for TCP connections on that port of that host, and the Request-URI
  809. for the resource is abs_path (section 5.1.2). The use of IP addresses
  810. in URLs SHOULD be avoided whenever possible (see RFC 1900 [24]). If
  811. the abs_path is not present in the URL, it MUST be given as "/" when
  812. used as a Request-URI for a resource (section 5.1.2). If a proxy
  813. receives a host name which is not a fully qualified domain name, it
  814. MAY add its domain to the host name it received. If a proxy receives
  815. a fully qualified domain name, the proxy MUST NOT change the host
  816. name.
  817. Fielding, et al. Standards Track [Page 19]
  818. RFC 2616 HTTP/1.1 June 1999
  819. 3.2.3 URI Comparison
  820. When comparing two URIs to decide if they match or not, a client
  821. SHOULD use a case-sensitive octet-by-octet comparison of the entire
  822. URIs, with these exceptions:
  823. - A port that is empty or not given is equivalent to the default
  824. port for that URI-reference;
  825. - Comparisons of host names MUST be case-insensitive;
  826. - Comparisons of scheme names MUST be case-insensitive;
  827. - An empty abs_path is equivalent to an abs_path of "/".
  828. Characters other than those in the "reserved" and "unsafe" sets (see
  829. RFC 2396 [42]) are equivalent to their ""%" HEX HEX" encoding.
  830. For example, the following three URIs are equivalent:
  831. http://abc.com:80/~smith/home.html
  832. http://ABC.com/%7Esmith/home.html
  833. http://ABC.com:/%7esmith/home.html
  834. 3.3 Date/Time Formats
  835. 3.3.1 Full Date
  836. HTTP applications have historically allowed three different formats
  837. for the representation of date/time stamps:
  838. Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
  839. Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
  840. Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
  841. The first format is preferred as an Internet standard and represents
  842. a fixed-length subset of that defined by RFC 1123 [8] (an update to
  843. RFC 822 [9]). The second format is in common use, but is based on the
  844. obsolete RFC 850 [12] date format and lacks a four-digit year.
  845. HTTP/1.1 clients and servers that parse the date value MUST accept
  846. all three formats (for compatibility with HTTP/1.0), though they MUST
  847. only generate the RFC 1123 format for representing HTTP-date values
  848. in header fields. See section 19.3 for further information.
  849. Note: Recipients of date values are encouraged to be robust in
  850. accepting date values that may have been sent by non-HTTP
  851. applications, as is sometimes the case when retrieving or posting
  852. messages via proxies/gateways to SMTP or NNTP.
  853. Fielding, et al. Standards Track [Page 20]
  854. RFC 2616 HTTP/1.1 June 1999
  855. All HTTP date/time stamps MUST be represented in Greenwich Mean Time
  856. (GMT), without exception. For the purposes of HTTP, GMT is exactly
  857. equal to UTC (Coordinated Universal Time). This is indicated in the
  858. first two formats by the inclusion of "GMT" as the three-letter
  859. abbreviation for time zone, and MUST be assumed when reading the
  860. asctime format. HTTP-date is case sensitive and MUST NOT include
  861. additional LWS beyond that specifically included as SP in the
  862. grammar.
  863. HTTP-date = rfc1123-date | rfc850-date | asctime-date
  864. rfc1123-date = wkday "," SP date1 SP time SP "GMT"
  865. rfc850-date = weekday "," SP date2 SP time SP "GMT"
  866. asctime-date = wkday SP date3 SP time SP 4DIGIT
  867. date1 = 2DIGIT SP month SP 4DIGIT
  868. ; day month year (e.g., 02 Jun 1982)
  869. date2 = 2DIGIT "-" month "-" 2DIGIT
  870. ; day-month-year (e.g., 02-Jun-82)
  871. date3 = month SP ( 2DIGIT | ( SP 1DIGIT ))
  872. ; month day (e.g., Jun 2)
  873. time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
  874. ; 00:00:00 - 23:59:59
  875. wkday = "Mon" | "Tue" | "Wed"
  876. | "Thu" | "Fri" | "Sat" | "Sun"
  877. weekday = "Monday" | "Tuesday" | "Wednesday"
  878. | "Thursday" | "Friday" | "Saturday" | "Sunday"
  879. month = "Jan" | "Feb" | "Mar" | "Apr"
  880. | "May" | "Jun" | "Jul" | "Aug"
  881. | "Sep" | "Oct" | "Nov" | "Dec"
  882. Note: HTTP requirements for the date/time stamp format apply only
  883. to their usage within the protocol stream. Clients and servers are
  884. not required to use these formats for user presentation, request
  885. logging, etc.
  886. 3.3.2 Delta Seconds
  887. Some HTTP header fields allow a time value to be specified as an
  888. integer number of seconds, represented in decimal, after the time
  889. that the message was received.
  890. delta-seconds = 1*DIGIT
  891. 3.4 Character Sets
  892. HTTP uses the same definition of the term "character set" as that
  893. described for MIME:
  894. Fielding, et al. Standards Track [Page 21]
  895. RFC 2616 HTTP/1.1 June 1999
  896. The term "character set" is used in this document to refer to a
  897. method used with one or more tables to convert a sequence of octets
  898. into a sequence of characters. Note that unconditional conversion in
  899. the other direction is not required, in that not all characters may
  900. be available in a given character set and a character set may provide
  901. more than one sequence of octets to represent a particular character.
  902. This definition is intended to allow various kinds of character
  903. encoding, from simple single-table mappings such as US-ASCII to
  904. complex table switching methods such as those that use ISO-2022's
  905. techniques. However, the definition associated with a MIME character
  906. set name MUST fully specify the mapping to be performed from octets
  907. to characters. In particular, use of external profiling information
  908. to determine the exact mapping is not permitted.
  909. Note: This use of the term "character set" is more commonly
  910. referred to as a "character encoding." However, since HTTP and
  911. MIME share the same registry, it is important that the terminology
  912. also be shared.
  913. HTTP character sets are identified by case-insensitive tokens. The
  914. complete set of tokens is defined by the IANA Character Set registry
  915. [19].
  916. charset = token
  917. Although HTTP allows an arbitrary token to be used as a charset
  918. value, any token that has a predefined value within the IANA
  919. Character Set registry [19] MUST represent the character set defined
  920. by that registry. Applications SHOULD limit their use of character
  921. sets to those defined by the IANA registry.
  922. Implementors should be aware of IETF character set requirements [38]
  923. [41].
  924. 3.4.1 Missing Charset
  925. Some HTTP/1.0 software has interpreted a Content-Type header without
  926. charset parameter incorrectly to mean "recipient should guess."
  927. Senders wishing to defeat this behavior MAY include a charset
  928. parameter even when the charset is ISO-8859-1 and SHOULD do so when
  929. it is known that it will not confuse the recipient.
  930. Unfortunately, some older HTTP/1.0 clients did not deal properly with
  931. an explicit charset parameter. HTTP/1.1 recipients MUST respect the
  932. charset label provided by the sender; and those user agents that have
  933. a provision to "guess" a charset MUST use the charset from the
  934. Fielding, et al. Standards Track [Page 22]
  935. RFC 2616 HTTP/1.1 June 1999
  936. content-type field if they support that charset, rather than the
  937. recipient's preference, when initially displaying a document. See
  938. section 3.7.1.
  939. 3.5 Content Codings
  940. Content coding values indicate an encoding transformation that has
  941. been or can be applied to an entity. Content codings are primarily
  942. used to allow a document to be compressed or otherwise usefully
  943. transformed without losing the identity of its underlying media type
  944. and without loss of information. Frequently, the entity is stored in
  945. coded form, transmitted directly, and only decoded by the recipient.
  946. content-coding = token
  947. All content-coding values are case-insensitive. HTTP/1.1 uses
  948. content-coding values in the Accept-Encoding (section 14.3) and
  949. Content-Encoding (section 14.11) header fields. Although the value
  950. describes the content-coding, what is more important is that it
  951. indicates what decoding mechanism will be required to remove the
  952. encoding.
  953. The Internet Assigned Numbers Authority (IANA) acts as a registry for
  954. content-coding value tokens. Initially, the registry contains the
  955. following tokens:
  956. gzip An encoding format produced by the file compression program
  957. "gzip" (GNU zip) as described in RFC 1952 [25]. This format is a
  958. Lempel-Ziv coding (LZ77) with a 32 bit CRC.
  959. compress
  960. The encoding format produced by the common UNIX file compression
  961. program "compress". This format is an adaptive Lempel-Ziv-Welch
  962. coding (LZW).
  963. Use of program names for the identification of encoding formats
  964. is not desirable and is discouraged for future encodings. Their
  965. use here is representative of historical practice, not good
  966. design. For compatibility with previous implementations of HTTP,
  967. applications SHOULD consider "x-gzip" and "x-compress" to be
  968. equivalent to "gzip" and "compress" respectively.
  969. deflate
  970. The "zlib" format defined in RFC 1950 [31] in combination with
  971. the "deflate" compression mechanism described in RFC 1951 [29].
  972. Fielding, et al. Standards Track [Page 23]
  973. RFC 2616 HTTP/1.1 June 1999
  974. identity
  975. The default (identity) encoding; the use of no transformation
  976. whatsoever. This content-coding is used only in the Accept-
  977. Encoding header, and SHOULD NOT be used in the Content-Encoding
  978. header.
  979. New content-coding value tokens SHOULD be registered; to allow
  980. interoperability between clients and servers, specifications of the
  981. content coding algorithms needed to implement a new value SHOULD be
  982. publicly available and adequate for independent implementation, and
  983. conform to the purpose of content coding defined in this section.
  984. 3.6 Transfer Codings
  985. Transfer-coding values are used to indicate an encoding
  986. transformation that has been, can be, or may need to be applied to an
  987. entity-body in order to ensure "safe transport" through the network.
  988. This differs from a content coding in that the transfer-coding is a
  989. property of the message, not of the original entity.
  990. transfer-coding = "chunked" | transfer-extension
  991. transfer-extension = token *( ";" parameter )
  992. Parameters are in the form of attribute/value pairs.
  993. parameter = attribute "=" value
  994. attribute = token
  995. value = token | quoted-string
  996. All transfer-coding values are case-insensitive. HTTP/1.1 uses
  997. transfer-coding values in the TE header field (section 14.39) and in
  998. the Transfer-Encoding header field (section 14.41).
  999. Whenever a transfer-coding is applied to a message-body, the set of
  1000. transfer-codings MUST include "chunked", unless the message is
  1001. terminated by closing the connection. When the "chunked" transfer-
  1002. coding is used, it MUST be the last transfer-coding applied to the
  1003. message-body. The "chunked" transfer-coding MUST NOT be applied more
  1004. than once to a message-body. These rules allow the recipient to
  1005. determine the transfer-length of the message (section 4.4).
  1006. Transfer-codings are analogous to the Content-Transfer-Encoding
  1007. values of MIME [7], which were designed to enable safe transport of
  1008. binary data over a 7-bit transport service. However, safe transport
  1009. has a different focus for an 8bit-clean transfer protocol. In HTTP,
  1010. the only unsafe characteristic of message-bodies is the difficulty in
  1011. determining the exact body length (section 7.2.2), or the desire to
  1012. encrypt data over a shared transport.
  1013. Fielding, et al. Standards Track [Page 24]
  1014. RFC 2616 HTTP/1.1 June 1999
  1015. The Internet Assigned Numbers Authority (IANA) acts as a registry for
  1016. transfer-coding value tokens. Initially, the registry contains the
  1017. following tokens: "chunked" (section 3.6.1), "identity" (section
  1018. 3.6.2), "gzip" (section 3.5), "compress" (section 3.5), and "deflate"
  1019. (section 3.5).
  1020. New transfer-coding value tokens SHOULD be registered in the same way
  1021. as new content-coding value tokens (section 3.5).
  1022. A server which receives an entity-body with a transfer-coding it does
  1023. not understand SHOULD return 501 (Unimplemented), and close the
  1024. connection. A server MUST NOT send transfer-codings to an HTTP/1.0
  1025. client.
  1026. 3.6.1 Chunked Transfer Coding
  1027. The chunked encoding modifies the body of a message in order to
  1028. transfer it as a series of chunks, each with its own size indicator,
  1029. followed by an OPTIONAL trailer containing entity-header fields. This
  1030. allows dynamically produced content to be transferred along with the
  1031. information necessary for the recipient to verify that it has
  1032. received the full message.
  1033. Chunked-Body = *chunk
  1034. last-chunk
  1035. trailer
  1036. CRLF
  1037. chunk = chunk-size [ chunk-extension ] CRLF
  1038. chunk-data CRLF
  1039. chunk-size = 1*HEX
  1040. last-chunk = 1*("0") [ chunk-extension ] CRLF
  1041. chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
  1042. chunk-ext-name = token
  1043. chunk-ext-val = token | quoted-string
  1044. chunk-data = chunk-size(OCTET)
  1045. trailer = *(entity-header CRLF)
  1046. The chunk-size field is a string of hex digits indicating the size of
  1047. the chunk. The chunked encoding is ended by any chunk whose size is
  1048. zero, followed by the trailer, which is terminated by an empty line.
  1049. The trailer allows the sender to include additional HTTP header
  1050. fields at the end of the message. The Trailer header field can be
  1051. used to indicate which header fields are included in a trailer (see
  1052. section 14.40).
  1053. Fielding, et al. Standards Track [Page 25]
  1054. RFC 2616 HTTP/1.1 June 1999
  1055. A server using chunked transfer-coding in a response MUST NOT use the
  1056. trailer for any header fields unless at least one of the following is
  1057. true:
  1058. a)the request included a TE header field that indicates "trailers" is
  1059. acceptable in the transfer-coding of the response, as described in
  1060. section 14.39; or,
  1061. b)the server is the origin server for the response, the trailer
  1062. fields consist entirely of optional metadata, and the recipient
  1063. could use the message (in a manner acceptable to the origin server)
  1064. without receiving this metadata. In other words, the origin server
  1065. is willing to accept the possibility that the trailer fields might
  1066. be silently discarded along the path to the client.
  1067. This requirement prevents an interoperability failure when the
  1068. message is being received by an HTTP/1.1 (or later) proxy and
  1069. forwarded to an HTTP/1.0 recipient. It avoids a situation where
  1070. compliance with the protocol would have necessitated a possibly
  1071. infinite buffer on the proxy.
  1072. An example process for decoding a Chunked-Body is presented in
  1073. appendix 19.4.6.
  1074. All HTTP/1.1 applications MUST be able to receive and decode the
  1075. "chunked" transfer-coding, and MUST ignore chunk-extension extensions
  1076. they do not understand.
  1077. 3.7 Media Types
  1078. HTTP uses Internet Media Types [17] in the Content-Type (section
  1079. 14.17) and Accept (section 14.1) header fields in order to provide
  1080. open and extensible data typing and type negotiation.
  1081. media-type = type "/" subtype *( ";" parameter )
  1082. type = token
  1083. subtype = token
  1084. Parameters MAY follow the type/subtype in the form of attribute/value
  1085. pairs (as defined in section 3.6).
  1086. The type, subtype, and parameter attribute names are case-
  1087. insensitive. Parameter values might or might not be case-sensitive,
  1088. depending on the semantics of the parameter name. Linear white space
  1089. (LWS) MUST NOT be used between the type and subtype, nor between an
  1090. attribute and its value. The presence or absence of a parameter might
  1091. be significant to the processing of a media-type, depending on its
  1092. definition within the media type registry.
  1093. Fielding, et al. Standards Track [Page 26]
  1094. RFC 2616 HTTP/1.1 June 1999
  1095. Note that some older HTTP applications do not recognize media type
  1096. parameters. When sending data to older HTTP applications,
  1097. implementations SHOULD only use media type parameters when they are
  1098. required by that type/subtype definition.
  1099. Media-type values are registered with the Internet Assigned Number
  1100. Authority (IANA [19]). The media type registration process is
  1101. outlined in RFC 1590 [17]. Use of non-registered media types is
  1102. discouraged.
  1103. 3.7.1 Canonicalization and Text Defaults
  1104. Internet media types are registered with a canonical form. An
  1105. entity-body transferred via HTTP messages MUST be represented in the
  1106. appropriate canonical form prior to its transmission except for
  1107. "text" types, as defined in the next paragraph.
  1108. When in canonical form, media subtypes of the "text" type use CRLF as
  1109. the text line break. HTTP relaxes this requirement and allows the
  1110. transport of text media with plain CR or LF alone representing a line
  1111. break when it is done consistently for an entire entity-body. HTTP
  1112. applications MUST accept CRLF, bare CR, and bare LF as being
  1113. representative of a line break in text media received via HTTP. In
  1114. addition, if the text is represented in a character set that does not
  1115. use octets 13 and 10 for CR and LF respectively, as is the case for
  1116. some multi-byte character sets, HTTP allows the use of whatever octet
  1117. sequences are defined by that character set to represent the
  1118. equivalent of CR and LF for line breaks. This flexibility regarding
  1119. line breaks applies only to text media in the entity-body; a bare CR
  1120. or LF MUST NOT be substituted for CRLF within any of the HTTP control
  1121. structures (such as header fields and multipart boundaries).
  1122. If an entity-body is encoded with a content-coding, the underlying
  1123. data MUST be in a form defined above prior to being encoded.
  1124. The "charset" parameter is used with some media types to define the
  1125. character set (section 3.4) of the data. When no explicit charset
  1126. parameter is provided by the sender, media subtypes of the "text"
  1127. type are defined to have a default charset value of "ISO-8859-1" when
  1128. received via HTTP. Data in character sets other than "ISO-8859-1" or
  1129. its subsets MUST be labeled with an appropriate charset value. See
  1130. section 3.4.1 for compatibility problems.
  1131. 3.7.2 Multipart Types
  1132. MIME provides for a number of "multipart" types -- encapsulations of
  1133. one or more entities within a single message-body. All multipart
  1134. types share a common syntax, as defined in section 5.1.1 of RFC 2046
  1135. Fielding, et al. Standards Track [Page 27]
  1136. RFC 2616 HTTP/1.1 June 1999
  1137. [40], and MUST include a boundary parameter as part of the media type
  1138. value. The message body is itself a protocol element and MUST
  1139. therefore use only CRLF to represent line breaks between body-parts.
  1140. Unlike in RFC 2046, the epilogue of any multipart message MUST be
  1141. empty; HTTP applications MUST NOT transmit the epilogue (even if the
  1142. original multipart contains an epilogue). These restrictions exist in
  1143. order to preserve the self-delimiting nature of a multipart message-
  1144. body, wherein the "end" of the message-body is indicated by the
  1145. ending multipart boundary.
  1146. In general, HTTP treats a multipart message-body no differently than
  1147. any other media type: strictly as payload. The one exception is the
  1148. "multipart/byteranges" type (appendix 19.2) when it appears in a 206
  1149. (Partial Content) response, which will be interpreted by some HTTP
  1150. caching mechanisms as described in sections 13.5.4 and 14.16. In all
  1151. other cases, an HTTP user agent SHOULD follow the same or similar
  1152. behavior as a MIME user agent would upon receipt of a multipart type.
  1153. The MIME header fields within each body-part of a multipart message-
  1154. body do not have any significance to HTTP beyond that defined by
  1155. their MIME semantics.
  1156. In general, an HTTP user agent SHOULD follow the same or similar
  1157. behavior as a MIME user agent would upon receipt of a multipart type.
  1158. If an application receives an unrecognized multipart subtype, the
  1159. application MUST treat it as being equivalent to "multipart/mixed".
  1160. Note: The "multipart/form-data" type has been specifically defined
  1161. for carrying form data suitable for processing via the POST
  1162. request method, as described in RFC 1867 [15].
  1163. 3.8 Product Tokens
  1164. Product tokens are used to allow communicating applications to
  1165. identify themselves by software name and version. Most fields using
  1166. product tokens also allow sub-products which form a significant part
  1167. of the application to be listed, separated by white space. By
  1168. convention, the products are listed in order of their significance
  1169. for identifying the application.
  1170. product = token ["/" product-version]
  1171. product-version = token
  1172. Examples:
  1173. User-Agent: CERN-LineMode/2.15 libwww/2.17b3
  1174. Server: Apache/0.8.4
  1175. Fielding, et al. Standards Track [Page 28]
  1176. RFC 2616 HTTP/1.1 June 1999
  1177. Product tokens SHOULD be short and to the point. They MUST NOT be
  1178. used for advertising or other non-essential information. Although any
  1179. token character MAY appear in a product-version, this token SHOULD
  1180. only be used for a version identifier (i.e., successive versions of
  1181. the same product SHOULD only differ in the product-version portion of
  1182. the product value).
  1183. 3.9 Quality Values
  1184. HTTP content negotiation (section 12) uses short "floating point"
  1185. numbers to indicate the relative importance ("weight") of various
  1186. negotiable parameters. A weight is normalized to a real number in
  1187. the range 0 through 1, where 0 is the minimum and 1 the maximum
  1188. value. If a parameter has a quality value of 0, then content with
  1189. this parameter is `not acceptable' for the client. HTTP/1.1
  1190. applications MUST NOT generate more than three digits after the
  1191. decimal point. User configuration of these values SHOULD also be
  1192. limited in this fashion.
  1193. qvalue = ( "0" [ "." 0*3DIGIT ] )
  1194. | ( "1" [ "." 0*3("0") ] )
  1195. "Quality values" is a misnomer, since these values merely represent
  1196. relative degradation in desired quality.
  1197. 3.10 Language Tags
  1198. A language tag identifies a natural language spoken, written, or
  1199. otherwise conveyed by human beings for communication of information
  1200. to other human beings. Computer languages are explicitly excluded.
  1201. HTTP uses language tags within the Accept-Language and Content-
  1202. Language fields.
  1203. The syntax and registry of HTTP language tags is the same as that
  1204. defined by RFC 1766 [1]. In summary, a language tag is composed of 1
  1205. or more parts: A primary language tag and a possibly empty series of
  1206. subtags:
  1207. language-tag = primary-tag *( "-" subtag )
  1208. primary-tag = 1*8ALPHA
  1209. subtag = 1*8ALPHA
  1210. White space is not allowed within the tag and all tags are case-
  1211. insensitive. The name space of language tags is administered by the
  1212. IANA. Example tags include:
  1213. en, en-US, en-cockney, i-cherokee, x-pig-latin
  1214. Fielding, et al. Standards Track [Page 29]
  1215. RFC 2616 HTTP/1.1 June 1999
  1216. where any two-letter primary-tag is an ISO-639 language abbreviation
  1217. and any two-letter initial subtag is an ISO-3166 country code. (The
  1218. last three tags above are not registered tags; all but the last are
  1219. examples of tags which could be registered in future.)
  1220. 3.11 Entity Tags
  1221. Entity tags are used for comparing two or more entities from the same
  1222. requested resource. HTTP/1.1 uses entity tags in the ETag (section
  1223. 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and
  1224. If-Range (section 14.27) header fields. The definition of how they
  1225. are used and compared as cache validators is in section 13.3.3. An
  1226. entity tag consists of an opaque quoted string, possibly prefixed by
  1227. a weakness indicator.
  1228. entity-tag = [ weak ] opaque-tag
  1229. weak = "W/"
  1230. opaque-tag = quoted-string
  1231. A "strong entity tag" MAY be shared by two entities of a resource
  1232. only if they are equivalent by octet equality.
  1233. A "weak entity tag," indicated by the "W/" prefix, MAY be shared by
  1234. two entities of a resource only if the entities are equivalent and
  1235. could be substituted for each other with no significant change in
  1236. semantics. A weak entity tag can only be used for weak comparison.
  1237. An entity tag MUST be unique across all versions of all entities
  1238. associated with a particular resource. A given entity tag value MAY
  1239. be used for entities obtained by requests on different URIs. The use
  1240. of the same entity tag value in conjunction with entities obtained by
  1241. requests on different URIs does not imply the equivalence of those
  1242. entities.
  1243. 3.12 Range Units
  1244. HTTP/1.1 allows a client to request that only part (a range of) the
  1245. response entity be included within the response. HTTP/1.1 uses range
  1246. units in the Range (section 14.35) and Content-Range (section 14.16)
  1247. header fields. An entity can be broken down into subranges according
  1248. to various structural units.
  1249. range-unit = bytes-unit | other-range-unit
  1250. bytes-unit = "bytes"
  1251. other-range-unit = token
  1252. The only range unit defined by HTTP/1.1 is "bytes". HTTP/1.1
  1253. implementations MAY ignore ranges specified using other units.
  1254. Fielding, et al. Standards Track [Page 30]
  1255. RFC 2616 HTTP/1.1 June 1999
  1256. HTTP/1.1 has been designed to allow implementations of applications
  1257. that do not depend on knowledge of ranges.
  1258. 4 HTTP Message
  1259. 4.1 Message Types
  1260. HTTP messages consist of requests from client to server and responses
  1261. from server to client.
  1262. HTTP-message = Request | Response ; HTTP/1.1 messages
  1263. Request (section 5) and Response (section 6) messages use the generic
  1264. message format of RFC 822 [9] for transferring entities (the payload
  1265. of the message). Both types of message consist of a start-line, zero
  1266. or more header fields (also known as "headers"), an empty line (i.e.,
  1267. a line with nothing preceding the CRLF) indicating the end of the
  1268. header fields, and possibly a message-body.
  1269. generic-message = start-line
  1270. *(message-header CRLF)
  1271. CRLF
  1272. [ message-body ]
  1273. start-line = Request-Line | Status-Line
  1274. In the interest of robustness, servers SHOULD ignore any empty
  1275. line(s) received where a Request-Line is expected. In other words, if
  1276. the server is reading the protocol stream at the beginning of a
  1277. message and receives a CRLF first, it should ignore the CRLF.
  1278. Certain buggy HTTP/1.0 client implementations generate extra CRLF's
  1279. after a POST request. To restate what is explicitly forbidden by the
  1280. BNF, an HTTP/1.1 client MUST NOT preface or follow a request with an
  1281. extra CRLF.
  1282. 4.2 Message Headers
  1283. HTTP header fields, which include general-header (section 4.5),
  1284. request-header (section 5.3), response-header (section 6.2), and
  1285. entity-header (section 7.1) fields, follow the same generic format as
  1286. that given in Section 3.1 of RFC 822 [9]. Each header field consists
  1287. of a name followed by a colon (":") and the field value. Field names
  1288. are case-insensitive. The field value MAY be preceded by any amount
  1289. of LWS, though a single SP is preferred. Header fields can be
  1290. extended over multiple lines by preceding each extra line with at
  1291. least one SP or HT. Applications ought to follow "common form", where
  1292. one is known or indicated, when generating HTTP constructs, since
  1293. there might exist some implementations that fail to accept anything
  1294. Fielding, et al. Standards Track [Page 31]
  1295. RFC 2616 HTTP/1.1 June 1999
  1296. beyond the common forms.
  1297. message-header = field-name ":" [ field-value ]
  1298. field-name = token
  1299. field-value = *( field-content | LWS )
  1300. field-content = <the OCTETs making up the field-value
  1301. and consisting of either *TEXT or combinations
  1302. of token, separators, and quoted-string>
  1303. The field-content does not include any leading or trailing LWS:
  1304. linear white space occurring before the first non-whitespace
  1305. character of the field-value or after the last non-whitespace
  1306. character of the field-value. Such leading or trailing LWS MAY be
  1307. removed without changing the semantics of the field value. Any LWS
  1308. that occurs between field-content MAY be replaced with a single SP
  1309. before interpreting the field value or forwarding the message
  1310. downstream.
  1311. The order in which header fields with differing field names are
  1312. received is not significant. However, it is "good practice" to send
  1313. general-header fields first, followed by request-header or response-
  1314. header fields, and ending with the entity-header fields.
  1315. Multiple message-header fields with the same field-name MAY be
  1316. present in a message if and only if the entire field-value for that
  1317. header field is defined as a comma-separated list [i.e., #(values)].
  1318. It MUST be possible to combine the multiple header fields into one
  1319. "field-name: field-value" pair, without changing the semantics of the
  1320. message, by appending each subsequent field-value to the first, each
  1321. separated by a comma. The order in which header fields with the same
  1322. field-name are received is therefore significant to the
  1323. interpretation of the combined field value, and thus a proxy MUST NOT
  1324. change the order of these field values when a message is forwarded.
  1325. 4.3 Message Body
  1326. The message-body (if any) of an HTTP message is used to carry the
  1327. entity-body associated with the request or response. The message-body
  1328. differs from the entity-body only when a transfer-coding has been
  1329. applied, as indicated by the Transfer-Encoding header field (section
  1330. 14.41).
  1331. message-body = entity-body
  1332. | <entity-body encoded as per Transfer-Encoding>
  1333. Transfer-Encoding MUST be used to indicate any transfer-codings
  1334. applied by an application to ensure safe and proper transfer of the
  1335. message. Transfer-Encoding is a property of the message, not of the
  1336. Fielding, et al. Standards Track [Page 32]
  1337. RFC 2616 HTTP/1.1 June 1999
  1338. entity, and thus MAY be added or removed by any application along the
  1339. request/response chain. (However, section 3.6 places restrictions on
  1340. when certain transfer-codings may be used.)
  1341. The rules for when a message-body is allowed in a message differ for
  1342. requests and responses.
  1343. The presence of a message-body in a request is signaled by the
  1344. inclusion of a Content-Length or Transfer-Encoding header field in
  1345. the request's message-headers. A message-body MUST NOT be included in
  1346. a request if the specification of the request method (section 5.1.1)
  1347. does not allow sending an entity-body in requests. A server SHOULD
  1348. read and forward a message-body on any request; if the request method
  1349. does not include defined semantics for an entity-body, then the
  1350. message-body SHOULD be ignored when handling the request.
  1351. For response messages, whether or not a message-body is included with
  1352. a message is dependent on both the request method and the response
  1353. status code (section 6.1.1). All responses to the HEAD request method
  1354. MUST NOT include a message-body, even though the presence of entity-
  1355. header fields might lead one to believe they do. All 1xx
  1356. (informational), 204 (no content), and 304 (not modified) responses
  1357. MUST NOT include a message-body. All other responses do include a
  1358. message-body, although it MAY be of zero length.
  1359. 4.4 Message Length
  1360. The transfer-length of a message is the length of the message-body as
  1361. it appears in the message; that is, after any transfer-codings have
  1362. been applied. When a message-body is included with a message, the
  1363. transfer-length of that body is determined by one of the following
  1364. (in order of precedence):
  1365. 1.Any response message which "MUST NOT" include a message-body (such
  1366. as the 1xx, 204, and 304 responses and any response to a HEAD
  1367. request) is always terminated by the first empty line after the
  1368. header fields, regardless of the entity-header fields present in
  1369. the message.
  1370. 2.If a Transfer-Encoding header field (section 14.41) is present and
  1371. has any value other than "identity", then the transfer-length is
  1372. defined by use of the "chunked" transfer-coding (section 3.6),
  1373. unless the message is terminated by closing the connection.
  1374. 3.If a Content-Length header field (section 14.13) is present, its
  1375. decimal value in OCTETs represents both the entity-length and the
  1376. transfer-length. The Content-Length header field MUST NOT be sent
  1377. if these two lengths are different (i.e., if a Transfer-Encoding
  1378. Fielding, et al. Standards Track [Page 33]
  1379. RFC 2616 HTTP/1.1 June 1999
  1380. header field is present). If a message is received with both a
  1381. Transfer-Encoding header field and a Content-Length header field,
  1382. the latter MUST be ignored.
  1383. 4.If the message uses the media type "multipart/byteranges", and the
  1384. ransfer-length is not otherwise specified, then this self-
  1385. elimiting media type defines the transfer-length. This media type
  1386. UST NOT be used unless the sender knows that the recipient can arse
  1387. it; the presence in a request of a Range header with ultiple byte-
  1388. range specifiers from a 1.1 client implies that the lient can parse
  1389. multipart/byteranges responses.
  1390. A range header might be forwarded by a 1.0 proxy that does not
  1391. understand multipart/byteranges; in this case the server MUST
  1392. delimit the message using methods defined in items 1,3 or 5 of
  1393. this section.
  1394. 5.By the server closing the connection. (Closing the connection
  1395. cannot be used to indicate the end of a request body, since that
  1396. would leave no possibility for the server to send back a response.)
  1397. For compatibility with HTTP/1.0 applications, HTTP/1.1 requests
  1398. containing a message-body MUST include a valid Content-Length header
  1399. field unless the server is known to be HTTP/1.1 compliant. If a
  1400. request contains a message-body and a Content-Length is not given,
  1401. the server SHOULD respond with 400 (bad request) if it cannot
  1402. determine the length of the message, or with 411 (length required) if
  1403. it wishes to insist on receiving a valid Content-Length.
  1404. All HTTP/1.1 applications that receive entities MUST accept the
  1405. "chunked" transfer-coding (section 3.6), thus allowing this mechanism
  1406. to be used for messages when the message length cannot be determined
  1407. in advance.
  1408. Messages MUST NOT include both a Content-Length header field and a
  1409. non-identity transfer-coding. If the message does include a non-
  1410. identity transfer-coding, the Content-Length MUST be ignored.
  1411. When a Content-Length is given in a message where a message-body is
  1412. allowed, its field value MUST exactly match the number of OCTETs in
  1413. the message-body. HTTP/1.1 user agents MUST notify the user when an
  1414. invalid length is received and detected.
  1415. 4.5 General Header Fields
  1416. There are a few header fields which have general applicability for
  1417. both request and response messages, but which do not apply to the
  1418. entity being transferred. These header fields apply only to the
  1419. Fielding, et al. Standards Track [Page 34]
  1420. RFC 2616 HTTP/1.1 June 1999
  1421. message being transmitted.
  1422. general-header = Cache-Control ; Section 14.9
  1423. | Connection ; Section 14.10
  1424. | Date ; Section 14.18
  1425. | Pragma ; Section 14.32
  1426. | Trailer ; Section 14.40
  1427. | Transfer-Encoding ; Section 14.41
  1428. | Upgrade ; Section 14.42
  1429. | Via ; Section 14.45
  1430. | Warning ; Section 14.46
  1431. General-header field names can be extended reliably only in
  1432. combination with a change in the protocol version. However, new or
  1433. experimental header fields may be given the semantics of general
  1434. header fields if all parties in the communication recognize them to
  1435. be general-header fields. Unrecognized header fields are treated as
  1436. entity-header fields.
  1437. 5 Request
  1438. A request message from a client to a server includes, within the
  1439. first line of that message, the method to be applied to the resource,
  1440. the identifier of the resource, and the protocol version in use.
  1441. Request = Request-Line ; Section 5.1
  1442. *(( general-header ; Section 4.5
  1443. | request-header ; Section 5.3
  1444. | entity-header ) CRLF) ; Section 7.1
  1445. CRLF
  1446. [ message-body ] ; Section 4.3
  1447. 5.1 Request-Line
  1448. The Request-Line begins with a method token, followed by the
  1449. Request-URI and the protocol version, and ending with CRLF. The
  1450. elements are separated by SP characters. No CR or LF is allowed
  1451. except in the final CRLF sequence.
  1452. Request-Line = Method SP Request-URI SP HTTP-Version CRLF
  1453. Fielding, et al. Standards Track [Page 35]
  1454. RFC 2616 HTTP/1.1 June 1999
  1455. 5.1.1 Method
  1456. The Method token indicates the method to be performed on the
  1457. resource identified by the Request-URI. The method is case-sensitive.
  1458. Method = "OPTIONS" ; Section 9.2
  1459. | "GET" ; Section 9.3
  1460. | "HEAD" ; Section 9.4
  1461. | "POST" ; Section 9.5
  1462. | "PUT" ; Section 9.6
  1463. | "DELETE" ; Section 9.7
  1464. | "TRACE" ; Section 9.8
  1465. | "CONNECT" ; Section 9.9
  1466. | extension-method
  1467. extension-method = token
  1468. The list of methods allowed by a resource can be specified in an
  1469. Allow header field (section 14.7). The return code of the response
  1470. always notifies the client whether a method is currently allowed on a
  1471. resource, since the set of allowed methods can change dynamically. An
  1472. origin server SHOULD return the status code 405 (Method Not Allowed)
  1473. if the method is known by the origin server but not allowed for the
  1474. requested resource, and 501 (Not Implemented) if the method is
  1475. unrecognized or not implemented by the origin server. The methods GET
  1476. and HEAD MUST be supported by all general-purpose servers. All other
  1477. methods are OPTIONAL; however, if the above methods are implemented,
  1478. they MUST be implemented with the same semantics as those specified
  1479. in section 9.
  1480. 5.1.2 Request-URI
  1481. The Request-URI is a Uniform Resource Identifier (section 3.2) and
  1482. identifies the resource upon which to apply the request.
  1483. Request-URI = "*" | absoluteURI | abs_path | authority
  1484. The four options for Request-URI are dependent on the nature of the
  1485. request. The asterisk "*" means that the request does not apply to a
  1486. particular resource, but to the server itself, and is only allowed
  1487. when the method used does not necessarily apply to a resource. One
  1488. example would be
  1489. OPTIONS * HTTP/1.1
  1490. The absoluteURI form is REQUIRED when the request is being made to a
  1491. proxy. The proxy is requested to forward the request or service it
  1492. from a valid cache, and return the response. Note that the proxy MAY
  1493. forward the request on to another proxy or directly to the server
  1494. Fielding, et al. Standards Track [Page 36]
  1495. RFC 2616 HTTP/1.1 June 1999
  1496. specified by the absoluteURI. In order to avoid request loops, a
  1497. proxy MUST be able to recognize all of its server names, including
  1498. any aliases, local variations, and the numeric IP address. An example
  1499. Request-Line would be:
  1500. GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1
  1501. To allow for transition to absoluteURIs in all requests in future
  1502. versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI
  1503. form in requests, even though HTTP/1.1 clients will only generate
  1504. them in requests to proxies.
  1505. The authority form is only used by the CONNECT method (section 9.9).
  1506. The most common form of Request-URI is that used to identify a
  1507. resource on an origin server or gateway. In this case the absolute
  1508. path of the URI MUST be transmitted (see section 3.2.1, abs_path) as
  1509. the Request-URI, and the network location of the URI (authority) MUST
  1510. be transmitted in a Host header field. For example, a client wishing
  1511. to retrieve the resource above directly from the origin server would
  1512. create a TCP connection to port 80 of the host "www.w3.org" and send
  1513. the lines:
  1514. GET /pub/WWW/TheProject.html HTTP/1.1
  1515. Host: www.w3.org
  1516. followed by the remainder of the Request. Note that the absolute path
  1517. cannot be empty; if none is present in the original URI, it MUST be
  1518. given as "/" (the server root).
  1519. The Request-URI is transmitted in the format specified in section
  1520. 3.2.1. If the Request-URI is encoded using the "% HEX HEX" encoding
  1521. [42], the origin server MUST decode the Request-URI in order to
  1522. properly interpret the request. Servers SHOULD respond to invalid
  1523. Request-URIs with an appropriate status code.
  1524. A transparent proxy MUST NOT rewrite the "abs_path" part of the
  1525. received Request-URI when forwarding it to the next inbound server,
  1526. except as noted above to replace a null abs_path with "/".
  1527. Note: The "no rewrite" rule prevents the proxy from changing the
  1528. meaning of the request when the origin server is improperly using
  1529. a non-reserved URI character for a reserved purpose. Implementors
  1530. should be aware that some pre-HTTP/1.1 proxies have been known to
  1531. rewrite the Request-URI.
  1532. Fielding, et al. Standards Track [Page 37]
  1533. RFC 2616 HTTP/1.1 June 1999
  1534. 5.2 The Resource Identified by a Request
  1535. The exact resource identified by an Internet request is determined by
  1536. examining both the Request-URI and the Host header field.
  1537. An origin server that does not allow resources to differ by the
  1538. requested host MAY ignore the Host header field value when
  1539. determining the resource identified by an HTTP/1.1 request. (But see
  1540. section 19.6.1.1 for other requirements on Host support in HTTP/1.1.)
  1541. An origin server that does differentiate resources based on the host
  1542. requested (sometimes referred to as virtual hosts or vanity host
  1543. names) MUST use the following rules for determining the requested
  1544. resource on an HTTP/1.1 request:
  1545. 1. If Request-URI is an absoluteURI, the host is part of the
  1546. Request-URI. Any Host header field value in the request MUST be
  1547. ignored.
  1548. 2. If the Request-URI is not an absoluteURI, and the request includes
  1549. a Host header field, the host is determined by the Host header
  1550. field value.
  1551. 3. If the host as determined by rule 1 or 2 is not a valid host on
  1552. the server, the response MUST be a 400 (Bad Request) error message.
  1553. Recipients of an HTTP/1.0 request that lacks a Host header field MAY
  1554. attempt to use heuristics (e.g., examination of the URI path for
  1555. something unique to a particular host) in order to determine what
  1556. exact resource is being requested.
  1557. 5.3 Request Header Fields
  1558. The request-header fields allow the client to pass additional
  1559. information about the request, and about the client itself, to the
  1560. server. These fields act as request modifiers, with semantics
  1561. equivalent to the parameters on a programming language method
  1562. invocation.
  1563. request-header = Accept ; Section 14.1
  1564. | Accept-Charset ; Section 14.2
  1565. | Accept-Encoding ; Section 14.3
  1566. | Accept-Language ; Section 14.4
  1567. | Authorization ; Section 14.8
  1568. | Expect ; Section 14.20
  1569. | From ; Section 14.22
  1570. | Host ; Section 14.23
  1571. | If-Match ; Section 14.24
  1572. Fielding, et al. Standards Track [Page 38]
  1573. RFC 2616 HTTP/1.1 June 1999
  1574. | If-Modified-Since ; Section 14.25
  1575. | If-None-Match ; Section 14.26
  1576. | If-Range ; Section 14.27
  1577. | If-Unmodified-Since ; Section 14.28
  1578. | Max-Forwards ; Section 14.31
  1579. | Proxy-Authorization ; Section 14.34
  1580. | Range ; Section 14.35
  1581. | Referer ; Section 14.36
  1582. | TE ; Section 14.39
  1583. | User-Agent ; Section 14.43
  1584. Request-header field names can be extended reliably only in
  1585. combination with a change in the protocol version. However, new or
  1586. experimental header fields MAY be given the semantics of request-
  1587. header fields if all parties in the communication recognize them to
  1588. be request-header fields. Unrecognized header fields are treated as
  1589. entity-header fields.
  1590. 6 Response
  1591. After receiving and interpreting a request message, a server responds
  1592. with an HTTP response message.
  1593. Response = Status-Line ; Section 6.1
  1594. *(( general-header ; Section 4.5
  1595. | response-header ; Section 6.2
  1596. | entity-header ) CRLF) ; Section 7.1
  1597. CRLF
  1598. [ message-body ] ; Section 7.2
  1599. 6.1 Status-Line
  1600. The first line of a Response message is the Status-Line, consisting
  1601. of the protocol version followed by a numeric status code and its
  1602. associated textual phrase, with each element separated by SP
  1603. characters. No CR or LF is allowed except in the final CRLF sequence.
  1604. Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
  1605. 6.1.1 Status Code and Reason Phrase
  1606. The Status-Code element is a 3-digit integer result code of the
  1607. attempt to understand and satisfy the request. These codes are fully
  1608. defined in section 10. The Reason-Phrase is intended to give a short
  1609. textual description of the Status-Code. The Status-Code is intended
  1610. for use by automata and the Reason-Phrase is intended for the human
  1611. user. The client is not required to examine or display the Reason-
  1612. Phrase.
  1613. Fielding, et al. Standards Track [Page 39]
  1614. RFC 2616 HTTP/1.1 June 1999
  1615. The first digit of the Status-Code defines the class of response. The
  1616. last two digits do not have any categorization role. There are 5
  1617. values for the first digit:
  1618. - 1xx: Informational - Request received, continuing process
  1619. - 2xx: Success - The action was successfully received,
  1620. understood, and accepted
  1621. - 3xx: Redirection - Further action must be taken in order to
  1622. complete the request
  1623. - 4xx: Client Error - The request contains bad syntax or cannot
  1624. be fulfilled
  1625. - 5xx: Server Error - The server failed to fulfill an apparently
  1626. valid request
  1627. The individual values of the numeric status codes defined for
  1628. HTTP/1.1, and an example set of corresponding Reason-Phrase's, are
  1629. presented below. The reason phrases listed here are only
  1630. recommendations -- they MAY be replaced by local equivalents without
  1631. affecting the protocol.
  1632. Status-Code =
  1633. "100" ; Section 10.1.1: Continue
  1634. | "101" ; Section 10.1.2: Switching Protocols
  1635. | "200" ; Section 10.2.1: OK
  1636. | "201" ; Section 10.2.2: Created
  1637. | "202" ; Section 10.2.3: Accepted
  1638. | "203" ; Section 10.2.4: Non-Authoritative Information
  1639. | "204" ; Section 10.2.5: No Content
  1640. | "205" ; Section 10.2.6: Reset Content
  1641. | "206" ; Section 10.2.7: Partial Content
  1642. | "300" ; Section 10.3.1: Multiple Choices
  1643. | "301" ; Section 10.3.2: Moved Permanently
  1644. | "302" ; Section 10.3.3: Found
  1645. | "303" ; Section 10.3.4: See Other
  1646. | "304" ; Section 10.3.5: Not Modified
  1647. | "305" ; Section 10.3.6: Use Proxy
  1648. | "307" ; Section 10.3.8: Temporary Redirect
  1649. | "400" ; Section 10.4.1: Bad Request
  1650. | "401" ; Section 10.4.2: Unauthorized
  1651. | "402" ; Section 10.4.3: Payment Required
  1652. | "403" ; Section 10.4.4: Forbidden
  1653. | "404" ; Section 10.4.5: Not Found
  1654. | "405" ; Section 10.4.6: Method Not Allowed
  1655. | "406" ; Section 10.4.7: Not Acceptable
  1656. Fielding, et al. Standards Track [Page 40]
  1657. RFC 2616 HTTP/1.1 June 1999
  1658. | "407" ; Section 10.4.8: Proxy Authentication Required
  1659. | "408" ; Section 10.4.9: Request Time-out
  1660. | "409" ; Section 10.4.10: Conflict
  1661. | "410" ; Section 10.4.11: Gone
  1662. | "411" ; Section 10.4.12: Length Required
  1663. | "412" ; Section 10.4.13: Precondition Failed
  1664. | "413" ; Section 10.4.14: Request Entity Too Large
  1665. | "414" ; Section 10.4.15: Request-URI Too Large
  1666. | "415" ; Section 10.4.16: Unsupported Media Type
  1667. | "416" ; Section 10.4.17: Requested range not satisfiable
  1668. | "417" ; Section 10.4.18: Expectation Failed
  1669. | "500" ; Section 10.5.1: Internal Server Error
  1670. | "501" ; Section 10.5.2: Not Implemented
  1671. | "502" ; Section 10.5.3: Bad Gateway
  1672. | "503" ; Section 10.5.4: Service Unavailable
  1673. | "504" ; Section 10.5.5: Gateway Time-out
  1674. | "505" ; Section 10.5.6: HTTP Version not supported
  1675. | extension-code
  1676. extension-code = 3DIGIT
  1677. Reason-Phrase = *<TEXT, excluding CR, LF>
  1678. HTTP status codes are extensible. HTTP applications are not required
  1679. to understand the meaning of all registered status codes, though such
  1680. understanding is obviously desirable. However, applications MUST
  1681. understand the class of any status code, as indicated by the first
  1682. digit, and treat any unrecognized response as being equivalent to the
  1683. x00 status code of that class, with the exception that an
  1684. unrecognized response MUST NOT be cached. For example, if an
  1685. unrecognized status code of 431 is received by the client, it can
  1686. safely assume that there was something wrong with its request and
  1687. treat the response as if it had received a 400 status code. In such
  1688. cases, user agents SHOULD present to the user the entity returned
  1689. with the response, since that entity is likely to include human-
  1690. readable information which will explain the unusual status.
  1691. 6.2 Response Header Fields
  1692. The response-header fields allow the server to pass additional
  1693. information about the response which cannot be placed in the Status-
  1694. Line. These header fields give information about the server and about
  1695. further access to the resource identified by the Request-URI.
  1696. response-header = Accept-Ranges ; Section 14.5
  1697. | Age ; Section 14.6
  1698. | ETag ; Section 14.19
  1699. | Location ; Section 14.30
  1700. | Proxy-Authenticate ; Section 14.33
  1701. Fielding, et al. Standards Track [Page 41]
  1702. RFC 2616 HTTP/1.1 June 1999
  1703. | Retry-After ; Section 14.37
  1704. | Server ; Section 14.38
  1705. | Vary ; Section 14.44
  1706. | WWW-Authenticate ; Section 14.47
  1707. Response-header field names can be extended reliably only in
  1708. combination with a change in the protocol version. However, new or
  1709. experimental header fields MAY be given the semantics of response-
  1710. header fields if all parties in the communication recognize them to
  1711. be response-header fields. Unrecognized header fields are treated as
  1712. entity-header fields.
  1713. 7 Entity
  1714. Request and Response messages MAY transfer an entity if not otherwise
  1715. restricted by the request method or response status code. An entity
  1716. consists of entity-header fields and an entity-body, although some
  1717. responses will only include the entity-headers.
  1718. In this section, both sender and recipient refer to either the client
  1719. or the server, depending on who sends and who receives the entity.
  1720. 7.1 Entity Header Fields
  1721. Entity-header fields define metainformation about the entity-body or,
  1722. if no body is present, about the resource identified by the request.
  1723. Some of this metainformation is OPTIONAL; some might be REQUIRED by
  1724. portions of this specification.
  1725. entity-header = Allow ; Section 14.7
  1726. | Content-Encoding ; Section 14.11
  1727. | Content-Language ; Section 14.12
  1728. | Content-Length ; Section 14.13
  1729. | Content-Location ; Section 14.14
  1730. | Content-MD5 ; Section 14.15
  1731. | Content-Range ; Section 14.16
  1732. | Content-Type ; Section 14.17
  1733. | Expires ; Section 14.21
  1734. | Last-Modified ; Section 14.29
  1735. | extension-header
  1736. extension-header = message-header
  1737. The extension-header mechanism allows additional entity-header fields
  1738. to be defined without changing the protocol, but these fields cannot
  1739. be assumed to be recognizable by the recipient. Unrecognized header
  1740. fields SHOULD be ignored by the recipient and MUST be forwarded by
  1741. transparent proxies.
  1742. Fielding, et al. Standards Track [Page 42]
  1743. RFC 2616 HTTP/1.1 June 1999
  1744. 7.2 Entity Body
  1745. The entity-body (if any) sent with an HTTP request or response is in
  1746. a format and encoding defined by the entity-header fields.
  1747. entity-body = *OCTET
  1748. An entity-body is only present in a message when a message-body is
  1749. present, as described in section 4.3. The entity-body is obtained
  1750. from the message-body by decoding any Transfer-Encoding that might
  1751. have been applied to ensure safe and proper transfer of the message.
  1752. 7.2.1 Type
  1753. When an entity-body is included with a message, the data type of that
  1754. body is determined via the header fields Content-Type and Content-
  1755. Encoding. These define a two-layer, ordered encoding model:
  1756. entity-body := Content-Encoding( Content-Type( data ) )
  1757. Content-Type specifies the media type of the underlying data.
  1758. Content-Encoding may be used to indicate any additional content
  1759. codings applied to the data, usually for the purpose of data
  1760. compression, that are a property of the requested resource. There is
  1761. no default encoding.
  1762. Any HTTP/1.1 message containing an entity-body SHOULD include a
  1763. Content-Type header field defining the media type of that body. If
  1764. and only if the media type is not given by a Content-Type field, the
  1765. recipient MAY attempt to guess the media type via inspection of its
  1766. content and/or the name extension(s) of the URI used to identify the
  1767. resource. If the media type remains unknown, the recipient SHOULD
  1768. treat it as type "application/octet-stream".
  1769. 7.2.2 Entity Length
  1770. The entity-length of a message is the length of the message-body
  1771. before any transfer-codings have been applied. Section 4.4 defines
  1772. how the transfer-length of a message-body is determined.
  1773. Fielding, et al. Standards Track [Page 43]
  1774. RFC 2616 HTTP/1.1 June 1999
  1775. 8 Connections
  1776. 8.1 Persistent Connections
  1777. 8.1.1 Purpose
  1778. Prior to persistent connections, a separate TCP connection was
  1779. established to fetch each URL, increasing the load on HTTP servers
  1780. and causing congestion on the Internet. The use of inline images and
  1781. other associated data often require a client to make multiple
  1782. requests of the same server in a short amount of time. Analysis of
  1783. these performance problems and results from a prototype
  1784. implementation are available [26] [30]. Implementation experience and
  1785. measurements of actual HTTP/1.1 (RFC 2068) implementations show good
  1786. results [39]. Alternatives have also been explored, for example,
  1787. T/TCP [27].
  1788. Persistent HTTP connections have a number of advantages:
  1789. - By opening and closing fewer TCP connections, CPU time is saved
  1790. in routers and hosts (clients, servers, proxies, gateways,
  1791. tunnels, or caches), and memory used for TCP protocol control
  1792. blocks can be saved in hosts.
  1793. - HTTP requests and responses can be pipelined on a connection.
  1794. Pipelining allows a client to make multiple requests without
  1795. waiting for each response, allowing a single TCP connection to
  1796. be used much more efficiently, with much lower elapsed time.
  1797. - Network congestion is reduced by reducing the number of packets
  1798. caused by TCP opens, and by allowing TCP sufficient time to
  1799. determine the congestion state of the network.
  1800. - Latency on subsequent requests is reduced since there is no time
  1801. spent in TCP's connection opening handshake.
  1802. - HTTP can evolve more gracefully, since errors can be reported
  1803. without the penalty of closing the TCP connection. Clients using
  1804. future versions of HTTP might optimistically try a new feature,
  1805. but if communicating with an older server, retry with old
  1806. semantics after an error is reported.
  1807. HTTP implementations SHOULD implement persistent connections.
  1808. Fielding, et al. Standards Track [Page 44]
  1809. RFC 2616 HTTP/1.1 June 1999
  1810. 8.1.2 Overall Operation
  1811. A significant difference between HTTP/1.1 and earlier versions of
  1812. HTTP is that persistent connections are the default behavior of any
  1813. HTTP connection. That is, unless otherwise indicated, the client
  1814. SHOULD assume that the server will maintain a persistent connection,
  1815. even after error responses from the server.
  1816. Persistent connections provide a mechanism by which a client and a
  1817. server can signal the close of a TCP connection. This signaling takes
  1818. place using the Connection header field (section 14.10). Once a close
  1819. has been signaled, the client MUST NOT send any more requests on that
  1820. connection.
  1821. 8.1.2.1 Negotiation
  1822. An HTTP/1.1 server MAY assume that a HTTP/1.1 client intends to
  1823. maintain a persistent connection unless a Connection header including
  1824. the connection-token "close" was sent in the request. If the server
  1825. chooses to close the connection immediately after sending the
  1826. response, it SHOULD send a Connection header including the
  1827. connection-token close.
  1828. An HTTP/1.1 client MAY expect a connection to remain open, but would
  1829. decide to keep it open based on whether the response from a server
  1830. contains a Connection header with the connection-token close. In case
  1831. the client does not want to maintain a connection for more than that
  1832. request, it SHOULD send a Connection header including the
  1833. connection-token close.
  1834. If either the client or the server sends the close token in the
  1835. Connection header, that request becomes the last one for the
  1836. connection.
  1837. Clients and servers SHOULD NOT assume that a persistent connection is
  1838. maintained for HTTP versions less than 1.1 unless it is explicitly
  1839. signaled. See section 19.6.2 for more information on backward
  1840. compatibility with HTTP/1.0 clients.
  1841. In order to remain persistent, all messages on the connection MUST
  1842. have a self-defined message length (i.e., one not defined by closure
  1843. of the connection), as described in section 4.4.
  1844. Fielding, et al. Standards Track [Page 45]
  1845. RFC 2616 HTTP/1.1 June 1999
  1846. 8.1.2.2 Pipelining
  1847. A client that supports persistent connections MAY "pipeline" its
  1848. requests (i.e., send multiple requests without waiting for each
  1849. response). A server MUST send its responses to those requests in the
  1850. same order that the requests were received.
  1851. Clients which assume persistent connections and pipeline immediately
  1852. after connection establishment SHOULD be prepared to retry their
  1853. connection if the first pipelined attempt fails. If a client does
  1854. such a retry, it MUST NOT pipeline before it knows the connection is
  1855. persistent. Clients MUST also be prepared to resend their requests if
  1856. the server closes the connection before sending all of the
  1857. corresponding responses.
  1858. Clients SHOULD NOT pipeline requests using non-idempotent methods or
  1859. non-idempotent sequences of methods (see section 9.1.2). Otherwise, a
  1860. premature termination of the transport connection could lead to
  1861. indeterminate results. A client wishing to send a non-idempotent
  1862. request SHOULD wait to send that request until it has received the
  1863. response status for the previous request.
  1864. 8.1.3 Proxy Servers
  1865. It is especially important that proxies correctly implement the
  1866. properties of the Connection header field as specified in section
  1867. 14.10.
  1868. The proxy server MUST signal persistent connections separately with
  1869. its clients and the origin servers (or other proxy servers) that it
  1870. connects to. Each persistent connection applies to only one transport
  1871. link.
  1872. A proxy server MUST NOT establish a HTTP/1.1 persistent connection
  1873. with an HTTP/1.0 client (but see RFC 2068 [33] for information and
  1874. discussion of the problems with the Keep-Alive header implemented by
  1875. many HTTP/1.0 clients).
  1876. 8.1.4 Practical Considerations
  1877. Servers will usually have some time-out value beyond which they will
  1878. no longer maintain an inactive connection. Proxy servers might make
  1879. this a higher value since it is likely that the client will be making
  1880. more connections through the same server. The use of persistent
  1881. connections places no requirements on the length (or existence) of
  1882. this time-out for either the client or the server.
  1883. Fielding, et al. Standards Track [Page 46]
  1884. RFC 2616 HTTP/1.1 June 1999
  1885. When a client or server wishes to time-out it SHOULD issue a graceful
  1886. close on the transport connection. Clients and servers SHOULD both
  1887. constantly watch for the other side of the transport close, and
  1888. respond to it as appropriate. If a client or server does not detect
  1889. the other side's close promptly it could cause unnecessary resource
  1890. drain on the network.
  1891. A client, server, or proxy MAY close the transport connection at any
  1892. time. For example, a client might have started to send a new request
  1893. at the same time that the server has decided to close the "idle"
  1894. connection. From the server's point of view, the connection is being
  1895. closed while it was idle, but from the client's point of view, a
  1896. request is in progress.
  1897. This means that clients, servers, and proxies MUST be able to recover
  1898. from asynchronous close events. Client software SHOULD reopen the
  1899. transport connection and retransmit the aborted sequence of requests
  1900. without user interaction so long as the request sequence is
  1901. idempotent (see section 9.1.2). Non-idempotent methods or sequences
  1902. MUST NOT be automatically retried, although user agents MAY offer a
  1903. human operator the choice of retrying the request(s). Confirmation by
  1904. user-agent software with semantic understanding of the application
  1905. MAY substitute for user confirmation. The automatic retry SHOULD NOT
  1906. be repeated if the second sequence of requests fails.
  1907. Servers SHOULD always respond to at least one request per connection,
  1908. if at all possible. Servers SHOULD NOT close a connection in the
  1909. middle of transmitting a response, unless a network or client failure
  1910. is suspected.
  1911. Clients that use persistent connections SHOULD limit the number of
  1912. simultaneous connections that they maintain to a given server. A
  1913. single-user client SHOULD NOT maintain more than 2 connections with
  1914. any server or proxy. A proxy SHOULD use up to 2*N connections to
  1915. another server or proxy, where N is the number of simultaneously
  1916. active users. These guidelines are intended to improve HTTP response
  1917. times and avoid congestion.
  1918. 8.2 Message Transmission Requirements
  1919. 8.2.1 Persistent Connections and Flow Control
  1920. HTTP/1.1 servers SHOULD maintain persistent connections and use TCP's
  1921. flow control mechanisms to resolve temporary overloads, rather than
  1922. terminating connections with the expectation that clients will retry.
  1923. The latter technique can exacerbate network congestion.
  1924. Fielding, et al. Standards Track [Page 47]
  1925. RFC 2616 HTTP/1.1 June 1999
  1926. 8.2.2 Monitoring Connections for Error Status Messages
  1927. An HTTP/1.1 (or later) client sending a message-body SHOULD monitor
  1928. the network connection for an error status while it is transmitting
  1929. the request. If the client sees an error status, it SHOULD
  1930. immediately cease transmitting the body. If the body is being sent
  1931. using a "chunked" encoding (section 3.6), a zero length chunk and
  1932. empty trailer MAY be used to prematurely mark the end of the message.
  1933. If the body was preceded by a Content-Length header, the client MUST
  1934. close the connection.
  1935. 8.2.3 Use of the 100 (Continue) Status
  1936. The purpose of the 100 (Continue) status (see section 10.1.1) is to
  1937. allow a client that is sending a request message with a request body
  1938. to determine if the origin server is willing to accept the request
  1939. (based on the request headers) before the client sends the request
  1940. body. In some cases, it might either be inappropriate or highly
  1941. inefficient for the client to send the body if the server will reject
  1942. the message without looking at the body.
  1943. Requirements for HTTP/1.1 clients:
  1944. - If a client will wait for a 100 (Continue) response before
  1945. sending the request body, it MUST send an Expect request-header
  1946. field (section 14.20) with the "100-continue" expectation.
  1947. - A client MUST NOT send an Expect request-header field (section
  1948. 14.20) with the "100-continue" expectation if it does not intend
  1949. to send a request body.
  1950. Because of the presence of older implementations, the protocol allows
  1951. ambiguous situations in which a client may send "Expect: 100-
  1952. continue" without receiving either a 417 (Expectation Failed) status
  1953. or a 100 (Continue) status. Therefore, when a client sends this
  1954. header field to an origin server (possibly via a proxy) from which it
  1955. has never seen a 100 (Continue) status, the client SHOULD NOT wait
  1956. for an indefinite period before sending the request body.
  1957. Requirements for HTTP/1.1 origin servers:
  1958. - Upon receiving a request which includes an Expect request-header
  1959. field with the "100-continue" expectation, an origin server MUST
  1960. either respond with 100 (Continue) status and continue to read
  1961. from the input stream, or respond with a final status code. The
  1962. origin server MUST NOT wait for the request body before sending
  1963. the 100 (Continue) response. If it responds with a final status
  1964. code, it MAY close the transport connection or it MAY continue
  1965. Fielding, et al. Standards Track [Page 48]
  1966. RFC 2616 HTTP/1.1 June 1999
  1967. to read and discard the rest of the request. It MUST NOT
  1968. perform the requested method if it returns a final status code.
  1969. - An origin server SHOULD NOT send a 100 (Continue) response if
  1970. the request message does not include an Expect request-header
  1971. field with the "100-continue" expectation, and MUST NOT send a
  1972. 100 (Continue) response if such a request comes from an HTTP/1.0
  1973. (or earlier) client. There is an exception to this rule: for
  1974. compatibility with RFC 2068, a server MAY send a 100 (Continue)
  1975. status in response to an HTTP/1.1 PUT or POST request that does
  1976. not include an Expect request-header field with the "100-
  1977. continue" expectation. This exception, the purpose of which is
  1978. to minimize any client processing delays associated with an
  1979. undeclared wait for 100 (Continue) status, applies only to
  1980. HTTP/1.1 requests, and not to requests with any other HTTP-
  1981. version value.
  1982. - An origin server MAY omit a 100 (Continue) response if it has
  1983. already received some or all of the request body for the
  1984. corresponding request.
  1985. - An origin server that sends a 100 (Continue) response MUST
  1986. ultimately send a final status code, once the request body is
  1987. received and processed, unless it terminates the transport
  1988. connection prematurely.
  1989. - If an origin server receives a request that does not include an
  1990. Expect request-header field with the "100-continue" expectation,
  1991. the request includes a request body, and the server responds
  1992. with a final status code before reading the entire request body
  1993. from the transport connection, then the server SHOULD NOT close
  1994. the transport connection until it has read the entire request,
  1995. or until the client closes the connection. Otherwise, the client
  1996. might not reliably receive the response message. However, this
  1997. requirement is not be construed as preventing a server from
  1998. defending itself against denial-of-service attacks, or from
  1999. badly broken client implementations.
  2000. Requirements for HTTP/1.1 proxies:
  2001. - If a proxy receives a request that includes an Expect request-
  2002. header field with the "100-continue" expectation, and the proxy
  2003. either knows that the next-hop server complies with HTTP/1.1 or
  2004. higher, or does not know the HTTP version of the next-hop
  2005. server, it MUST forward the request, including the Expect header
  2006. field.
  2007. Fielding, et al. Standards Track [Page 49]
  2008. RFC 2616 HTTP/1.1 June 1999
  2009. - If the proxy knows that the version of the next-hop server is
  2010. HTTP/1.0 or lower, it MUST NOT forward the request, and it MUST
  2011. respond with a 417 (Expectation Failed) status.
  2012. - Proxies SHOULD maintain a cache recording the HTTP version
  2013. numbers received from recently-referenced next-hop servers.
  2014. - A proxy MUST NOT forward a 100 (Continue) response if the
  2015. request message was received from an HTTP/1.0 (or earlier)
  2016. client and did not include an Expect request-header field with
  2017. the "100-continue" expectation. This requirement overrides the
  2018. general rule for forwarding of 1xx responses (see section 10.1).
  2019. 8.2.4 Client Behavior if Server Prematurely Closes Connection
  2020. If an HTTP/1.1 client sends a request which includes a request body,
  2021. but which does not include an Expect request-header field with the
  2022. "100-continue" expectation, and if the client is not directly
  2023. connected to an HTTP/1.1 origin server, and if the client sees the
  2024. connection close before receiving any status from the server, the
  2025. client SHOULD retry the request. If the client does retry this
  2026. request, it MAY use the following "binary exponential backoff"
  2027. algorithm to be assured of obtaining a reliable response:
  2028. 1. Initiate a new connection to the server
  2029. 2. Transmit the request-headers
  2030. 3. Initialize a variable R to the estimated round-trip time to the
  2031. server (e.g., based on the time it took to establish the
  2032. connection), or to a constant value of 5 seconds if the round-
  2033. trip time is not available.
  2034. 4. Compute T = R * (2**N), where N is the number of previous
  2035. retries of this request.
  2036. 5. Wait either for an error response from the server, or for T
  2037. seconds (whichever comes first)
  2038. 6. If no error response is received, after T seconds transmit the
  2039. body of the request.
  2040. 7. If client sees that the connection is closed prematurely,
  2041. repeat from step 1 until the request is accepted, an error
  2042. response is received, or the user becomes impatient and
  2043. terminates the retry process.
  2044. Fielding, et al. Standards Track [Page 50]
  2045. RFC 2616 HTTP/1.1 June 1999
  2046. If at any point an error status is received, the client
  2047. - SHOULD NOT continue and
  2048. - SHOULD close the connection if it has not completed sending the
  2049. request message.
  2050. 9 Method Definitions
  2051. The set of common methods for HTTP/1.1 is defined below. Although
  2052. this set can be expanded, additional methods cannot be assumed to
  2053. share the same semantics for separately extended clients and servers.
  2054. The Host request-header field (section 14.23) MUST accompany all
  2055. HTTP/1.1 requests.
  2056. 9.1 Safe and Idempotent Methods
  2057. 9.1.1 Safe Methods
  2058. Implementors should be aware that the software represents the user in
  2059. their interactions over the Internet, and should be careful to allow
  2060. the user to be aware of any actions they might take which may have an
  2061. unexpected significance to themselves or others.
  2062. In particular, the convention has been established that the GET and
  2063. HEAD methods SHOULD NOT have the significance of taking an action
  2064. other than retrieval. These methods ought to be considered "safe".
  2065. This allows user agents to represent other methods, such as POST, PUT
  2066. and DELETE, in a special way, so that the user is made aware of the
  2067. fact that a possibly unsafe action is being requested.
  2068. Naturally, it is not possible to ensure that the server does not
  2069. generate side-effects as a result of performing a GET request; in
  2070. fact, some dynamic resources consider that a feature. The important
  2071. distinction here is that the user did not request the side-effects,
  2072. so therefore cannot be held accountable for them.
  2073. 9.1.2 Idempotent Methods
  2074. Methods can also have the property of "idempotence" in that (aside
  2075. from error or expiration issues) the side-effects of N > 0 identical
  2076. requests is the same as for a single request. The methods GET, HEAD,
  2077. PUT and DELETE share this property. Also, the methods OPTIONS and
  2078. TRACE SHOULD NOT have side effects, and so are inherently idempotent.
  2079. Fielding, et al. Standards Track [Page 51]
  2080. RFC 2616 HTTP/1.1 June 1999
  2081. However, it is possible that a sequence of several requests is non-
  2082. idempotent, even if all of the methods executed in that sequence are
  2083. idempotent. (A sequence is idempotent if a single execution of the
  2084. entire sequence always yields a result that is not changed by a
  2085. reexecution of all, or part, of that sequence.) For example, a
  2086. sequence is non-idempotent if its result depends on a value that is
  2087. later modified in the same sequence.
  2088. A sequence that never has side effects is idempotent, by definition
  2089. (provided that no concurrent operations are being executed on the
  2090. same set of resources).
  2091. 9.2 OPTIONS
  2092. The OPTIONS method represents a request for information about the
  2093. communication options available on the request/response chain
  2094. identified by the Request-URI. This method allows the client to
  2095. determine the options and/or requirements associated with a resource,
  2096. or the capabilities of a server, without implying a resource action
  2097. or initiating a resource retrieval.
  2098. Responses to this method are not cacheable.
  2099. If the OPTIONS request includes an entity-body (as indicated by the
  2100. presence of Content-Length or Transfer-Encoding), then the media type
  2101. MUST be indicated by a Content-Type field. Although this
  2102. specification does not define any use for such a body, future
  2103. extensions to HTTP might use the OPTIONS body to make more detailed
  2104. queries on the server. A server that does not support such an
  2105. extension MAY discard the request body.
  2106. If the Request-URI is an asterisk ("*"), the OPTIONS request is
  2107. intended to apply to the server in general rather than to a specific
  2108. resource. Since a server's communication options typically depend on
  2109. the resource, the "*" request is only useful as a "ping" or "no-op"
  2110. type of method; it does nothing beyond allowing the client to test
  2111. the capabilities of the server. For example, this can be used to test
  2112. a proxy for HTTP/1.1 compliance (or lack thereof).
  2113. If the Request-URI is not an asterisk, the OPTIONS request applies
  2114. only to the options that are available when communicating with that
  2115. resource.
  2116. A 200 response SHOULD include any header fields that indicate
  2117. optional features implemented by the server and applicable to that
  2118. resource (e.g., Allow), possibly including extensions not defined by
  2119. this specification. The response body, if any, SHOULD also include
  2120. information about the communication options. The format for such a
  2121. Fielding, et al. Standards Track [Page 52]
  2122. RFC 2616 HTTP/1.1 June 1999
  2123. body is not defined by this specification, but might be defined by
  2124. future extensions to HTTP. Content negotiation MAY be used to select
  2125. the appropriate response format. If no response body is included, the
  2126. response MUST include a Content-Length field with a field-value of
  2127. "0".
  2128. The Max-Forwards request-header field MAY be used to target a
  2129. specific proxy in the request chain. When a proxy receives an OPTIONS
  2130. request on an absoluteURI for which request forwarding is permitted,
  2131. the proxy MUST check for a Max-Forwards field. If the Max-Forwards
  2132. field-value is zero ("0"), the proxy MUST NOT forward the message;
  2133. instead, the proxy SHOULD respond with its own communication options.
  2134. If the Max-Forwards field-value is an integer greater than zero, the
  2135. proxy MUST decrement the field-value when it forwards the request. If
  2136. no Max-Forwards field is present in the request, then the forwarded
  2137. request MUST NOT include a Max-Forwards field.
  2138. 9.3 GET
  2139. The GET method means retrieve whatever information (in the form of an
  2140. entity) is identified by the Request-URI. If the Request-URI refers
  2141. to a data-producing process, it is the produced data which shall be
  2142. returned as the entity in the response and not the source text of the
  2143. process, unless that text happens to be the output of the process.
  2144. The semantics of the GET method change to a "conditional GET" if the
  2145. request message includes an If-Modified-Since, If-Unmodified-Since,
  2146. If-Match, If-None-Match, or If-Range header field. A conditional GET
  2147. method requests that the entity be transferred only under the
  2148. circumstances described by the conditional header field(s). The
  2149. conditional GET method is intended to reduce unnecessary network
  2150. usage by allowing cached entities to be refreshed without requiring
  2151. multiple requests or transferring data already held by the client.
  2152. The semantics of the GET method change to a "partial GET" if the
  2153. request message includes a Range header field. A partial GET requests
  2154. that only part of the entity be transferred, as described in section
  2155. 14.35. The partial GET method is intended to reduce unnecessary
  2156. network usage by allowing partially-retrieved entities to be
  2157. completed without transferring data already held by the client.
  2158. The response to a GET request is cacheable if and only if it meets
  2159. the requirements for HTTP caching described in section 13.
  2160. See section 15.1.3 for security considerations when used for forms.
  2161. Fielding, et al. Standards Track [Page 53]
  2162. RFC 2616 HTTP/1.1 June 1999
  2163. 9.4 HEAD
  2164. The HEAD method is identical to GET except that the server MUST NOT
  2165. return a message-body in the response. The metainformation contained
  2166. in the HTTP headers in response to a HEAD request SHOULD be identical
  2167. to the information sent in response to a GET request. This method can
  2168. be used for obtaining metainformation about the entity implied by the
  2169. request without transferring the entity-body itself. This method is
  2170. often used for testing hypertext links for validity, accessibility,
  2171. and recent modification.
  2172. The response to a HEAD request MAY be cacheable in the sense that the
  2173. information contained in the response MAY be used to update a
  2174. previously cached entity from that resource. If the new field values
  2175. indicate that the cached entity differs from the current entity (as
  2176. would be indicated by a change in Content-Length, Content-MD5, ETag
  2177. or Last-Modified), then the cache MUST treat the cache entry as
  2178. stale.
  2179. 9.5 POST
  2180. The POST method is used to request that the origin server accept the
  2181. entity enclosed in the request as a new subordinate of the resource
  2182. identified by the Request-URI in the Request-Line. POST is designed
  2183. to allow a uniform method to cover the following functions:
  2184. - Annotation of existing resources;
  2185. - Posting a message to a bulletin board, newsgroup, mailing list,
  2186. or similar group of articles;
  2187. - Providing a block of data, such as the result of submitting a
  2188. form, to a data-handling process;
  2189. - Extending a database through an append operation.
  2190. The actual function performed by the POST method is determined by the
  2191. server and is usually dependent on the Request-URI. The posted entity
  2192. is subordinate to that URI in the same way that a file is subordinate
  2193. to a directory containing it, a news article is subordinate to a
  2194. newsgroup to which it is posted, or a record is subordinate to a
  2195. database.
  2196. The action performed by the POST method might not result in a
  2197. resource that can be identified by a URI. In this case, either 200
  2198. (OK) or 204 (No Content) is the appropriate response status,
  2199. depending on whether or not the response includes an entity that
  2200. describes the result.
  2201. Fielding, et al. Standards Track [Page 54]
  2202. RFC 2616 HTTP/1.1 June 1999
  2203. If a resource has been created on the origin server, the response
  2204. SHOULD be 201 (Created) and contain an entity which describes the
  2205. status of the request and refers to the new resource, and a Location
  2206. header (see section 14.30).
  2207. Responses to this method are not cacheable, unless the response
  2208. includes appropriate Cache-Control or Expires header fields. However,
  2209. the 303 (See Other) response can be used to direct the user agent to
  2210. retrieve a cacheable resource.
  2211. POST requests MUST obey the message transmission requirements set out
  2212. in section 8.2.
  2213. See section 15.1.3 for security considerations.
  2214. 9.6 PUT
  2215. The PUT method requests that the enclosed entity be stored under the
  2216. supplied Request-URI. If the Request-URI refers to an already
  2217. existing resource, the enclosed entity SHOULD be considered as a
  2218. modified version of the one residing on the origin server. If the
  2219. Request-URI does not point to an existing resource, and that URI is
  2220. capable of being defined as a new resource by the requesting user
  2221. agent, the origin server can create the resource with that URI. If a
  2222. new resource is created, the origin server MUST inform the user agent
  2223. via the 201 (Created) response. If an existing resource is modified,
  2224. either the 200 (OK) or 204 (No Content) response codes SHOULD be sent
  2225. to indicate successful completion of the request. If the resource
  2226. could not be created or modified with the Request-URI, an appropriate
  2227. error response SHOULD be given that reflects the nature of the
  2228. problem. The recipient of the entity MUST NOT ignore any Content-*
  2229. (e.g. Content-Range) headers that it does not understand or implement
  2230. and MUST return a 501 (Not Implemented) response in such cases.
  2231. If the request passes through a cache and the Request-URI identifies
  2232. one or more currently cached entities, those entries SHOULD be
  2233. treated as stale. Responses to this method are not cacheable.
  2234. The fundamental difference between the POST and PUT requests is
  2235. reflected in the different meaning of the Request-URI. The URI in a
  2236. POST request identifies the resource that will handle the enclosed
  2237. entity. That resource might be a data-accepting process, a gateway to
  2238. some other protocol, or a separate entity that accepts annotations.
  2239. In contrast, the URI in a PUT request identifies the entity enclosed
  2240. with the request -- the user agent knows what URI is intended and the
  2241. server MUST NOT attempt to apply the request to some other resource.
  2242. If the server desires that the request be applied to a different URI,
  2243. Fielding, et al. Standards Track [Page 55]
  2244. RFC 2616 HTTP/1.1 June 1999
  2245. it MUST send a 301 (Moved Permanently) response; the user agent MAY
  2246. then make its own decision regarding whether or not to redirect the
  2247. request.
  2248. A single resource MAY be identified by many different URIs. For
  2249. example, an article might have a URI for identifying "the current
  2250. version" which is separate from the URI identifying each particular
  2251. version. In this case, a PUT request on a general URI might result in
  2252. several other URIs being defined by the origin server.
  2253. HTTP/1.1 does not define how a PUT method affects the state of an
  2254. origin server.
  2255. PUT requests MUST obey the message transmission requirements set out
  2256. in section 8.2.
  2257. Unless otherwise specified for a particular entity-header, the
  2258. entity-headers in the PUT request SHOULD be applied to the resource
  2259. created or modified by the PUT.
  2260. 9.7 DELETE
  2261. The DELETE method requests that the origin server delete the resource
  2262. identified by the Request-URI. This method MAY be overridden by human
  2263. intervention (or other means) on the origin server. The client cannot
  2264. be guaranteed that the operation has been carried out, even if the
  2265. status code returned from the origin server indicates that the action
  2266. has been completed successfully. However, the server SHOULD NOT
  2267. indicate success unless, at the time the response is given, it
  2268. intends to delete the resource or move it to an inaccessible
  2269. location.
  2270. A successful response SHOULD be 200 (OK) if the response includes an
  2271. entity describing the status, 202 (Accepted) if the action has not
  2272. yet been enacted, or 204 (No Content) if the action has been enacted
  2273. but the response does not include an entity.
  2274. If the request passes through a cache and the Request-URI identifies
  2275. one or more currently cached entities, those entries SHOULD be
  2276. treated as stale. Responses to this method are not cacheable.
  2277. 9.8 TRACE
  2278. The TRACE method is used to invoke a remote, application-layer loop-
  2279. back of the request message. The final recipient of the request
  2280. SHOULD reflect the message received back to the client as the
  2281. entity-body of a 200 (OK) response. The final recipient is either the
  2282. Fielding, et al. Standards Track [Page 56]
  2283. RFC 2616 HTTP/1.1 June 1999
  2284. origin server or the first proxy or gateway to receive a Max-Forwards
  2285. value of zero (0) in the request (see section 14.31). A TRACE request
  2286. MUST NOT include an entity.
  2287. TRACE allows the client to see what is being received at the other
  2288. end of the request chain and use that data for testing or diagnostic
  2289. information. The value of the Via header field (section 14.45) is of
  2290. particular interest, since it acts as a trace of the request chain.
  2291. Use of the Max-Forwards header field allows the client to limit the
  2292. length of the request chain, which is useful for testing a chain of
  2293. proxies forwarding messages in an infinite loop.
  2294. If the request is valid, the response SHOULD contain the entire
  2295. request message in the entity-body, with a Content-Type of
  2296. "message/http". Responses to this method MUST NOT be cached.
  2297. 9.9 CONNECT
  2298. This specification reserves the method name CONNECT for use with a
  2299. proxy that can dynamically switch to being a tunnel (e.g. SSL
  2300. tunneling [44]).
  2301. 10 Status Code Definitions
  2302. Each Status-Code is described below, including a description of which
  2303. method(s) it can follow and any metainformation required in the
  2304. response.
  2305. 10.1 Informational 1xx
  2306. This class of status code indicates a provisional response,
  2307. consisting only of the Status-Line and optional headers, and is
  2308. terminated by an empty line. There are no required headers for this
  2309. class of status code. Since HTTP/1.0 did not define any 1xx status
  2310. codes, servers MUST NOT send a 1xx response to an HTTP/1.0 client
  2311. except under experimental conditions.
  2312. A client MUST be prepared to accept one or more 1xx status responses
  2313. prior to a regular response, even if the client does not expect a 100
  2314. (Continue) status message. Unexpected 1xx status responses MAY be
  2315. ignored by a user agent.
  2316. Proxies MUST forward 1xx responses, unless the connection between the
  2317. proxy and its client has been closed, or unless the proxy itself
  2318. requested the generation of the 1xx response. (For example, if a
  2319. Fielding, et al. Standards Track [Page 57]
  2320. RFC 2616 HTTP/1.1 June 1999
  2321. proxy adds a "Expect: 100-continue" field when it forwards a request,
  2322. then it need not forward the corresponding 100 (Continue)
  2323. response(s).)
  2324. 10.1.1 100 Continue
  2325. The client SHOULD continue with its request. This interim response is
  2326. used to inform the client that the initial part of the request has
  2327. been received and has not yet been rejected by the server. The client
  2328. SHOULD continue by sending the remainder of the request or, if the
  2329. request has already been completed, ignore this response. The server
  2330. MUST send a final response after the request has been completed. See
  2331. section 8.2.3 for detailed discussion of the use and handling of this
  2332. status code.
  2333. 10.1.2 101 Switching Protocols
  2334. The server understands and is willing to comply with the client's
  2335. request, via the Upgrade message header field (section 14.42), for a
  2336. change in the application protocol being used on this connection. The
  2337. server will switch protocols to those defined by the response's
  2338. Upgrade header field immediately after the empty line which
  2339. terminates the 101 response.
  2340. The protocol SHOULD be switched only when it is advantageous to do
  2341. so. For example, switching to a newer version of HTTP is advantageous
  2342. over older versions, and switching to a real-time, synchronous
  2343. protocol might be advantageous when delivering resources that use
  2344. such features.
  2345. 10.2 Successful 2xx
  2346. This class of status code indicates that the client's request was
  2347. successfully received, understood, and accepted.
  2348. 10.2.1 200 OK
  2349. The request has succeeded. The information returned with the response
  2350. is dependent on the method used in the request, for example:
  2351. GET an entity corresponding to the requested resource is sent in
  2352. the response;
  2353. HEAD the entity-header fields corresponding to the requested
  2354. resource are sent in the response without any message-body;
  2355. POST an entity describing or containing the result of the action;
  2356. Fielding, et al. Standards Track [Page 58]
  2357. RFC 2616 HTTP/1.1 June 1999
  2358. TRACE an entity containing the request message as received by the
  2359. end server.
  2360. 10.2.2 201 Created
  2361. The request has been fulfilled and resulted in a new resource being
  2362. created. The newly created resource can be referenced by the URI(s)
  2363. returned in the entity of the response, with the most specific URI
  2364. for the resource given by a Location header field. The response
  2365. SHOULD include an entity containing a list of resource
  2366. characteristics and location(s) from which the user or user agent can
  2367. choose the one most appropriate. The entity format is specified by
  2368. the media type given in the Content-Type header field. The origin
  2369. server MUST create the resource before returning the 201 status code.
  2370. If the action cannot be carried out immediately, the server SHOULD
  2371. respond with 202 (Accepted) response instead.
  2372. A 201 response MAY contain an ETag response header field indicating
  2373. the current value of the entity tag for the requested variant just
  2374. created, see section 14.19.
  2375. 10.2.3 202 Accepted
  2376. The request has been accepted for processing, but the processing has
  2377. not been completed. The request might or might not eventually be
  2378. acted upon, as it might be disallowed when processing actually takes
  2379. place. There is no facility for re-sending a status code from an
  2380. asynchronous operation such as this.
  2381. The 202 response is intentionally non-committal. Its purpose is to
  2382. allow a server to accept a request for some other process (perhaps a
  2383. batch-oriented process that is only run once per day) without
  2384. requiring that the user agent's connection to the server persist
  2385. until the process is completed. The entity returned with this
  2386. response SHOULD include an indication of the request's current status
  2387. and either a pointer to a status monitor or some estimate of when the
  2388. user can expect the request to be fulfilled.
  2389. 10.2.4 203 Non-Authoritative Information
  2390. The returned metainformation in the entity-header is not the
  2391. definitive set as available from the origin server, but is gathered
  2392. from a local or a third-party copy. The set presented MAY be a subset
  2393. or superset of the original version. For example, including local
  2394. annotation information about the resource might result in a superset
  2395. of the metainformation known by the origin server. Use of this
  2396. response code is not required and is only appropriate when the
  2397. response would otherwise be 200 (OK).
  2398. Fielding, et al. Standards Track [Page 59]
  2399. RFC 2616 HTTP/1.1 June 1999
  2400. 10.2.5 204 No Content
  2401. The server has fulfilled the request but does not need to return an
  2402. entity-body, and might want to return updated metainformation. The
  2403. response MAY include new or updated metainformation in the form of
  2404. entity-headers, which if present SHOULD be associated with the
  2405. requested variant.
  2406. If the client is a user agent, it SHOULD NOT change its document view
  2407. from that which caused the request to be sent. This response is
  2408. primarily intended to allow input for actions to take place without
  2409. causing a change to the user agent's active document view, although
  2410. any new or updated metainformation SHOULD be applied to the document
  2411. currently in the user agent's active view.
  2412. The 204 response MUST NOT include a message-body, and thus is always
  2413. terminated by the first empty line after the header fields.
  2414. 10.2.6 205 Reset Content
  2415. The server has fulfilled the request and the user agent SHOULD reset
  2416. the document view which caused the request to be sent. This response
  2417. is primarily intended to allow input for actions to take place via
  2418. user input, followed by a clearing of the form in which the input is
  2419. given so that the user can easily initiate another input action. The
  2420. response MUST NOT include an entity.
  2421. 10.2.7 206 Partial Content
  2422. The server has fulfilled the partial GET request for the resource.
  2423. The request MUST have included a Range header field (section 14.35)
  2424. indicating the desired range, and MAY have included an If-Range
  2425. header field (section 14.27) to make the request conditional.
  2426. The response MUST include the following header fields:
  2427. - Either a Content-Range header field (section 14.16) indicating
  2428. the range included with this response, or a multipart/byteranges
  2429. Content-Type including Content-Range fields for each part. If a
  2430. Content-Length header field is present in the response, its
  2431. value MUST match the actual number of OCTETs transmitted in the
  2432. message-body.
  2433. - Date
  2434. - ETag and/or Content-Location, if the header would have been sent
  2435. in a 200 response to the same request
  2436. Fielding, et al. Standards Track [Page 60]
  2437. RFC 2616 HTTP/1.1 June 1999
  2438. - Expires, Cache-Control, and/or Vary, if the field-value might
  2439. differ from that sent in any previous response for the same
  2440. variant
  2441. If the 206 response is the result of an If-Range request that used a
  2442. strong cache validator (see section 13.3.3), the response SHOULD NOT
  2443. include other entity-headers. If the response is the result of an
  2444. If-Range request that used a weak validator, the response MUST NOT
  2445. include other entity-headers; this prevents inconsistencies between
  2446. cached entity-bodies and updated headers. Otherwise, the response
  2447. MUST include all of the entity-headers that would have been returned
  2448. with a 200 (OK) response to the same request.
  2449. A cache MUST NOT combine a 206 response with other previously cached
  2450. content if the ETag or Last-Modified headers do not match exactly,
  2451. see 13.5.4.
  2452. A cache that does not support the Range and Content-Range headers
  2453. MUST NOT cache 206 (Partial) responses.
  2454. 10.3 Redirection 3xx
  2455. This class of status code indicates that further action needs to be
  2456. taken by the user agent in order to fulfill the request. The action
  2457. required MAY be carried out by the user agent without interaction
  2458. with the user if and only if the method used in the second request is
  2459. GET or HEAD. A client SHOULD detect infinite redirection loops, since
  2460. such loops generate network traffic for each redirection.
  2461. Note: previous versions of this specification recommended a
  2462. maximum of five redirections. Content developers should be aware
  2463. that there might be clients that implement such a fixed
  2464. limitation.
  2465. 10.3.1 300 Multiple Choices
  2466. The requested resource corresponds to any one of a set of
  2467. representations, each with its own specific location, and agent-
  2468. driven negotiation information (section 12) is being provided so that
  2469. the user (or user agent) can select a preferred representation and
  2470. redirect its request to that location.
  2471. Unless it was a HEAD request, the response SHOULD include an entity
  2472. containing a list of resource characteristics and location(s) from
  2473. which the user or user agent can choose the one most appropriate. The
  2474. entity format is specified by the media type given in the Content-
  2475. Type header field. Depending upon the format and the capabilities of
  2476. Fielding, et al. Standards Track [Page 61]
  2477. RFC 2616 HTTP/1.1 June 1999
  2478. the user agent, selection of the most appropriate choice MAY be
  2479. performed automatically. However, this specification does not define
  2480. any standard for such automatic selection.
  2481. If the server has a preferred choice of representation, it SHOULD
  2482. include the specific URI for that representation in the Location
  2483. field; user agents MAY use the Location field value for automatic
  2484. redirection. This response is cacheable unless indicated otherwise.
  2485. 10.3.2 301 Moved Permanently
  2486. The requested resource has been assigned a new permanent URI and any
  2487. future references to this resource SHOULD use one of the returned
  2488. URIs. Clients with link editing capabilities ought to automatically
  2489. re-link references to the Request-URI to one or more of the new
  2490. references returned by the server, where possible. This response is
  2491. cacheable unless indicated otherwise.
  2492. The new permanent URI SHOULD be given by the Location field in the
  2493. response. Unless the request method was HEAD, the entity of the
  2494. response SHOULD contain a short hypertext note with a hyperlink to
  2495. the new URI(s).
  2496. If the 301 status code is received in response to a request other
  2497. than GET or HEAD, the user agent MUST NOT automatically redirect the
  2498. request unless it can be confirmed by the user, since this might
  2499. change the conditions under which the request was issued.
  2500. Note: When automatically redirecting a POST request after
  2501. receiving a 301 status code, some existing HTTP/1.0 user agents
  2502. will erroneously change it into a GET request.
  2503. 10.3.3 302 Found
  2504. The requested resource resides temporarily under a different URI.
  2505. Since the redirection might be altered on occasion, the client SHOULD
  2506. continue to use the Request-URI for future requests. This response
  2507. is only cacheable if indicated by a Cache-Control or Expires header
  2508. field.
  2509. The temporary URI SHOULD be given by the Location field in the
  2510. response. Unless the request method was HEAD, the entity of the
  2511. response SHOULD contain a short hypertext note with a hyperlink to
  2512. the new URI(s).
  2513. Fielding, et al. Standards Track [Page 62]
  2514. RFC 2616 HTTP/1.1 June 1999
  2515. If the 302 status code is received in response to a request other
  2516. than GET or HEAD, the user agent MUST NOT automatically redirect the
  2517. request unless it can be confirmed by the user, since this might
  2518. change the conditions under which the request was issued.
  2519. Note: RFC 1945 and RFC 2068 specify that the client is not allowed
  2520. to change the method on the redirected request. However, most
  2521. existing user agent implementations treat 302 as if it were a 303
  2522. response, performing a GET on the Location field-value regardless
  2523. of the original request method. The status codes 303 and 307 have
  2524. been added for servers that wish to make unambiguously clear which
  2525. kind of reaction is expected of the client.
  2526. 10.3.4 303 See Other
  2527. The response to the request can be found under a different URI and
  2528. SHOULD be retrieved using a GET method on that resource. This method
  2529. exists primarily to allow the output of a POST-activated script to
  2530. redirect the user agent to a selected resource. The new URI is not a
  2531. substitute reference for the originally requested resource. The 303
  2532. response MUST NOT be cached, but the response to the second
  2533. (redirected) request might be cacheable.
  2534. The different URI SHOULD be given by the Location field in the
  2535. response. Unless the request method was HEAD, the entity of the
  2536. response SHOULD contain a short hypertext note with a hyperlink to
  2537. the new URI(s).
  2538. Note: Many pre-HTTP/1.1 user agents do not understand the 303
  2539. status. When interoperability with such clients is a concern, the
  2540. 302 status code may be used instead, since most user agents react
  2541. to a 302 response as described here for 303.
  2542. 10.3.5 304 Not Modified
  2543. If the client has performed a conditional GET request and access is
  2544. allowed, but the document has not been modified, the server SHOULD
  2545. respond with this status code. The 304 response MUST NOT contain a
  2546. message-body, and thus is always terminated by the first empty line
  2547. after the header fields.
  2548. The response MUST include the following header fields:
  2549. - Date, unless its omission is required by section 14.18.1
  2550. Fielding, et al. Standards Track [Page 63]
  2551. RFC 2616 HTTP/1.1 June 1999
  2552. If a clockless origin server obeys these rules, and proxies and
  2553. clients add their own Date to any response received without one (as
  2554. already specified by [RFC 2068], section 14.19), caches will operate
  2555. correctly.
  2556. - ETag and/or Content-Location, if the header would have been sent
  2557. in a 200 response to the same request
  2558. - Expires, Cache-Control, and/or Vary, if the field-value might
  2559. differ from that sent in any previous response for the same
  2560. variant
  2561. If the conditional GET used a strong cache validator (see section
  2562. 13.3.3), the response SHOULD NOT include other entity-headers.
  2563. Otherwise (i.e., the conditional GET used a weak validator), the
  2564. response MUST NOT include other entity-headers; this prevents
  2565. inconsistencies between cached entity-bodies and updated headers.
  2566. If a 304 response indicates an entity not currently cached, then the
  2567. cache MUST disregard the response and repeat the request without the
  2568. conditional.
  2569. If a cache uses a received 304 response to update a cache entry, the
  2570. cache MUST update the entry to reflect any new field values given in
  2571. the response.
  2572. 10.3.6 305 Use Proxy
  2573. The requested resource MUST be accessed through the proxy given by
  2574. the Location field. The Location field gives the URI of the proxy.
  2575. The recipient is expected to repeat this single request via the
  2576. proxy. 305 responses MUST only be generated by origin servers.
  2577. Note: RFC 2068 was not clear that 305 was intended to redirect a
  2578. single request, and to be generated by origin servers only. Not
  2579. observing these limitations has significant security consequences.
  2580. 10.3.7 306 (Unused)
  2581. The 306 status code was used in a previous version of the
  2582. specification, is no longer used, and the code is reserved.
  2583. Fielding, et al. Standards Track [Page 64]
  2584. RFC 2616 HTTP/1.1 June 1999
  2585. 10.3.8 307 Temporary Redirect
  2586. The requested resource resides temporarily under a different URI.
  2587. Since the redirection MAY be altered on occasion, the client SHOULD
  2588. continue to use the Request-URI for future requests. This response
  2589. is only cacheable if indicated by a Cache-Control or Expires header
  2590. field.
  2591. The temporary URI SHOULD be given by the Location field in the
  2592. response. Unless the request method was HEAD, the entity of the
  2593. response SHOULD contain a short hypertext note with a hyperlink to
  2594. the new URI(s) , since many pre-HTTP/1.1 user agents do not
  2595. understand the 307 status. Therefore, the note SHOULD contain the
  2596. information necessary for a user to repeat the original request on
  2597. the new URI.
  2598. If the 307 status code is received in response to a request other
  2599. than GET or HEAD, the user agent MUST NOT automatically redirect the
  2600. request unless it can be confirmed by the user, since this might
  2601. change the conditions under which the request was issued.
  2602. 10.4 Client Error 4xx
  2603. The 4xx class of status code is intended for cases in which the
  2604. client seems to have erred. Except when responding to a HEAD request,
  2605. the server SHOULD include an entity containing an explanation of the
  2606. error situation, and whether it is a temporary or permanent
  2607. condition. These status codes are applicable to any request method.
  2608. User agents SHOULD display any included entity to the user.
  2609. If the client is sending data, a server implementation using TCP
  2610. SHOULD be careful to ensure that the client acknowledges receipt of
  2611. the packet(s) containing the response, before the server closes the
  2612. input connection. If the client continues sending data to the server
  2613. after the close, the server's TCP stack will send a reset packet to
  2614. the client, which may erase the client's unacknowledged input buffers
  2615. before they can be read and interpreted by the HTTP application.
  2616. 10.4.1 400 Bad Request
  2617. The request could not be understood by the server due to malformed
  2618. syntax. The client SHOULD NOT repeat the request without
  2619. modifications.
  2620. Fielding, et al. Standards Track [Page 65]
  2621. RFC 2616 HTTP/1.1 June 1999
  2622. 10.4.2 401 Unauthorized
  2623. The request requires user authentication. The response MUST include a
  2624. WWW-Authenticate header field (section 14.47) containing a challenge
  2625. applicable to the requested resource. The client MAY repeat the
  2626. request with a suitable Authorization header field (section 14.8). If
  2627. the request already included Authorization credentials, then the 401
  2628. response indicates that authorization has been refused for those
  2629. credentials. If the 401 response contains the same challenge as the
  2630. prior response, and the user agent has already attempted
  2631. authentication at least once, then the user SHOULD be presented the
  2632. entity that was given in the response, since that entity might
  2633. include relevant diagnostic information. HTTP access authentication
  2634. is explained in "HTTP Authentication: Basic and Digest Access
  2635. Authentication" [43].
  2636. 10.4.3 402 Payment Required
  2637. This code is reserved for future use.
  2638. 10.4.4 403 Forbidden
  2639. The server understood the request, but is refusing to fulfill it.
  2640. Authorization will not help and the request SHOULD NOT be repeated.
  2641. If the request method was not HEAD and the server wishes to make
  2642. public why the request has not been fulfilled, it SHOULD describe the
  2643. reason for the refusal in the entity. If the server does not wish to
  2644. make this information available to the client, the status code 404
  2645. (Not Found) can be used instead.
  2646. 10.4.5 404 Not Found
  2647. The server has not found anything matching the Request-URI. No
  2648. indication is given of whether the condition is temporary or
  2649. permanent. The 410 (Gone) status code SHOULD be used if the server
  2650. knows, through some internally configurable mechanism, that an old
  2651. resource is permanently unavailable and has no forwarding address.
  2652. This status code is commonly used when the server does not wish to
  2653. reveal exactly why the request has been refused, or when no other
  2654. response is applicable.
  2655. 10.4.6 405 Method Not Allowed
  2656. The method specified in the Request-Line is not allowed for the
  2657. resource identified by the Request-URI. The response MUST include an
  2658. Allow header containing a list of valid methods for the requested
  2659. resource.
  2660. Fielding, et al. Standards Track [Page 66]
  2661. RFC 2616 HTTP/1.1 June 1999
  2662. 10.4.7 406 Not Acceptable
  2663. The resource identified by the request is only capable of generating
  2664. response entities which have content characteristics not acceptable
  2665. according to the accept headers sent in the request.
  2666. Unless it was a HEAD request, the response SHOULD include an entity
  2667. containing a list of available entity characteristics and location(s)
  2668. from which the user or user agent can choose the one most
  2669. appropriate. The entity format is specified by the media type given
  2670. in the Content-Type header field. Depending upon the format and the
  2671. capabilities of the user agent, selection of the most appropriate
  2672. choice MAY be performed automatically. However, this specification
  2673. does not define any standard for such automatic selection.
  2674. Note: HTTP/1.1 servers are allowed to return responses which are
  2675. not acceptable according to the accept headers sent in the
  2676. request. In some cases, this may even be preferable to sending a
  2677. 406 response. User agents are encouraged to inspect the headers of
  2678. an incoming response to determine if it is acceptable.
  2679. If the response could be unacceptable, a user agent SHOULD
  2680. temporarily stop receipt of more data and query the user for a
  2681. decision on further actions.
  2682. 10.4.8 407 Proxy Authentication Required
  2683. This code is similar to 401 (Unauthorized), but indicates that the
  2684. client must first authenticate itself with the proxy. The proxy MUST
  2685. return a Proxy-Authenticate header field (section 14.33) containing a
  2686. challenge applicable to the proxy for the requested resource. The
  2687. client MAY repeat the request with a suitable Proxy-Authorization
  2688. header field (section 14.34). HTTP access authentication is explained
  2689. in "HTTP Authentication: Basic and Digest Access Authentication"
  2690. [43].
  2691. 10.4.9 408 Request Timeout
  2692. The client did not produce a request within the time that the server
  2693. was prepared to wait. The client MAY repeat the request without
  2694. modifications at any later time.
  2695. 10.4.10 409 Conflict
  2696. The request could not be completed due to a conflict with the current
  2697. state of the resource. This code is only allowed in situations where
  2698. it is expected that the user might be able to resolve the conflict
  2699. and resubmit the request. The response body SHOULD include enough
  2700. Fielding, et al. Standards Track [Page 67]
  2701. RFC 2616 HTTP/1.1 June 1999
  2702. information for the user to recognize the source of the conflict.
  2703. Ideally, the response entity would include enough information for the
  2704. user or user agent to fix the problem; however, that might not be
  2705. possible and is not required.
  2706. Conflicts are most likely to occur in response to a PUT request. For
  2707. example, if versioning were being used and the entity being PUT
  2708. included changes to a resource which conflict with those made by an
  2709. earlier (third-party) request, the server might use the 409 response
  2710. to indicate that it can't complete the request. In this case, the
  2711. response entity would likely contain a list of the differences
  2712. between the two versions in a format defined by the response
  2713. Content-Type.
  2714. 10.4.11 410 Gone
  2715. The requested resource is no longer available at the server and no
  2716. forwarding address is known. This condition is expected to be
  2717. considered permanent. Clients with link editing capabilities SHOULD
  2718. delete references to the Request-URI after user approval. If the
  2719. server does not know, or has no facility to determine, whether or not
  2720. the condition is permanent, the status code 404 (Not Found) SHOULD be
  2721. used instead. This response is cacheable unless indicated otherwise.
  2722. The 410 response is primarily intended to assist the task of web
  2723. maintenance by notifying the recipient that the resource is
  2724. intentionally unavailable and that the server owners desire that
  2725. remote links to that resource be removed. Such an event is common for
  2726. limited-time, promotional services and for resources belonging to
  2727. individuals no longer working at the server's site. It is not
  2728. necessary to mark all permanently unavailable resources as "gone" or
  2729. to keep the mark for any length of time -- that is left to the
  2730. discretion of the server owner.
  2731. 10.4.12 411 Length Required
  2732. The server refuses to accept the request without a defined Content-
  2733. Length. The client MAY repeat the request if it adds a valid
  2734. Content-Length header field containing the length of the message-body
  2735. in the request message.
  2736. 10.4.13 412 Precondition Failed
  2737. The precondition given in one or more of the request-header fields
  2738. evaluated to false when it was tested on the server. This response
  2739. code allows the client to place preconditions on the current resource
  2740. metainformation (header field data) and thus prevent the requested
  2741. method from being applied to a resource other than the one intended.
  2742. Fielding, et al. Standards Track [Page 68]
  2743. RFC 2616 HTTP/1.1 June 1999
  2744. 10.4.14 413 Request Entity Too Large
  2745. The server is refusing to process a request because the request
  2746. entity is larger than the server is willing or able to process. The
  2747. server MAY close the connection to prevent the client from continuing
  2748. the request.
  2749. If the condition is temporary, the server SHOULD include a Retry-
  2750. After header field to indicate that it is temporary and after what
  2751. time the client MAY try again.
  2752. 10.4.15 414 Request-URI Too Long
  2753. The server is refusing to service the request because the Request-URI
  2754. is longer than the server is willing to interpret. This rare
  2755. condition is only likely to occur when a client has improperly
  2756. converted a POST request to a GET request with long query
  2757. information, when the client has descended into a URI "black hole" of
  2758. redirection (e.g., a redirected URI prefix that points to a suffix of
  2759. itself), or when the server is under attack by a client attempting to
  2760. exploit security holes present in some servers using fixed-length
  2761. buffers for reading or manipulating the Request-URI.
  2762. 10.4.16 415 Unsupported Media Type
  2763. The server is refusing to service the request because the entity of
  2764. the request is in a format not supported by the requested resource
  2765. for the requested method.
  2766. 10.4.17 416 Requested Range Not Satisfiable
  2767. A server SHOULD return a response with this status code if a request
  2768. included a Range request-header field (section 14.35), and none of
  2769. the range-specifier values in this field overlap the current extent
  2770. of the selected resource, and the request did not include an If-Range
  2771. request-header field. (For byte-ranges, this means that the first-
  2772. byte-pos of all of the byte-range-spec values were greater than the
  2773. current length of the selected resource.)
  2774. When this status code is returned for a byte-range request, the
  2775. response SHOULD include a Content-Range entity-header field
  2776. specifying the current length of the selected resource (see section
  2777. 14.16). This response MUST NOT use the multipart/byteranges content-
  2778. type.
  2779. Fielding, et al. Standards Track [Page 69]
  2780. RFC 2616 HTTP/1.1 June 1999
  2781. 10.4.18 417 Expectation Failed
  2782. The expectation given in an Expect request-header field (see section
  2783. 14.20) could not be met by this server, or, if the server is a proxy,
  2784. the server has unambiguous evidence that the request could not be met
  2785. by the next-hop server.
  2786. 10.5 Server Error 5xx
  2787. Response status codes beginning with the digit "5" indicate cases in
  2788. which the server is aware that it has erred or is incapable of
  2789. performing the request. Except when responding to a HEAD request, the
  2790. server SHOULD include an entity containing an explanation of the
  2791. error situation, and whether it is a temporary or permanent
  2792. condition. User agents SHOULD display any included entity to the
  2793. user. These response codes are applicable to any request method.
  2794. 10.5.1 500 Internal Server Error
  2795. The server encountered an unexpected condition which prevented it
  2796. from fulfilling the request.
  2797. 10.5.2 501 Not Implemented
  2798. The server does not support the functionality required to fulfill the
  2799. request. This is the appropriate response when the server does not
  2800. recognize the request method and is not capable of supporting it for
  2801. any resource.
  2802. 10.5.3 502 Bad Gateway
  2803. The server, while acting as a gateway or proxy, received an invalid
  2804. response from the upstream server it accessed in attempting to
  2805. fulfill the request.
  2806. 10.5.4 503 Service Unavailable
  2807. The server is currently unable to handle the request due to a
  2808. temporary overloading or maintenance of the server. The implication
  2809. is that this is a temporary condition which will be alleviated after
  2810. some delay. If known, the length of the delay MAY be indicated in a
  2811. Retry-After header. If no Retry-After is given, the client SHOULD
  2812. handle the response as it would for a 500 response.
  2813. Note: The existence of the 503 status code does not imply that a
  2814. server must use it when becoming overloaded. Some servers may wish
  2815. to simply refuse the connection.
  2816. Fielding, et al. Standards Track [Page 70]
  2817. RFC 2616 HTTP/1.1 June 1999
  2818. 10.5.5 504 Gateway Timeout
  2819. The server, while acting as a gateway or proxy, did not receive a
  2820. timely response from the upstream server specified by the URI (e.g.
  2821. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed
  2822. to access in attempting to complete the request.
  2823. Note: Note to implementors: some deployed proxies are known to
  2824. return 400 or 500 when DNS lookups time out.
  2825. 10.5.6 505 HTTP Version Not Supported
  2826. The server does not support, or refuses to support, the HTTP protocol
  2827. version that was used in the request message. The server is
  2828. indicating that it is unable or unwilling to complete the request
  2829. using the same major version as the client, as described in section
  2830. 3.1, other than with this error message. The response SHOULD contain
  2831. an entity describing why that version is not supported and what other
  2832. protocols are supported by that server.
  2833. 11 Access Authentication
  2834. HTTP provides several OPTIONAL challenge-response authentication
  2835. mechanisms which can be used by a server to challenge a client
  2836. request and by a client to provide authentication information. The
  2837. general framework for access authentication, and the specification of
  2838. "basic" and "digest" authentication, are specified in "HTTP
  2839. Authentication: Basic and Digest Access Authentication" [43]. This
  2840. specification adopts the definitions of "challenge" and "credentials"
  2841. from that specification.
  2842. 12 Content Negotiation
  2843. Most HTTP responses include an entity which contains information for
  2844. interpretation by a human user. Naturally, it is desirable to supply
  2845. the user with the "best available" entity corresponding to the
  2846. request. Unfortunately for servers and caches, not all users have the
  2847. same preferences for what is "best," and not all user agents are
  2848. equally capable of rendering all entity types. For that reason, HTTP
  2849. has provisions for several mechanisms for "content negotiation" --
  2850. the process of selecting the best representation for a given response
  2851. when there are multiple representations available.
  2852. Note: This is not called "format negotiation" because the
  2853. alternate representations may be of the same media type, but use
  2854. different capabilities of that type, be in different languages,
  2855. etc.
  2856. Fielding, et al. Standards Track [Page 71]
  2857. RFC 2616 HTTP/1.1 June 1999
  2858. Any response containing an entity-body MAY be subject to negotiation,
  2859. including error responses.
  2860. There are two kinds of content negotiation which are possible in
  2861. HTTP: server-driven and agent-driven negotiation. These two kinds of
  2862. negotiation are orthogonal and thus may be used separately or in
  2863. combination. One method of combination, referred to as transparent
  2864. negotiation, occurs when a cache uses the agent-driven negotiation
  2865. information provided by the origin server in order to provide
  2866. server-driven negotiation for subsequent requests.
  2867. 12.1 Server-driven Negotiation
  2868. If the selection of the best representation for a response is made by
  2869. an algorithm located at the server, it is called server-driven
  2870. negotiation. Selection is based on the available representations of
  2871. the response (the dimensions over which it can vary; e.g. language,
  2872. content-coding, etc.) and the contents of particular header fields in
  2873. the request message or on other information pertaining to the request
  2874. (such as the network address of the client).
  2875. Server-driven negotiation is advantageous when the algorithm for
  2876. selecting from among the available representations is difficult to
  2877. describe to the user agent, or when the server desires to send its
  2878. "best guess" to the client along with the first response (hoping to
  2879. avoid the round-trip delay of a subsequent request if the "best
  2880. guess" is good enough for the user). In order to improve the server's
  2881. guess, the user agent MAY include request header fields (Accept,
  2882. Accept-Language, Accept-Encoding, etc.) which describe its
  2883. preferences for such a response.
  2884. Server-driven negotiation has disadvantages:
  2885. 1. It is impossible for the server to accurately determine what
  2886. might be "best" for any given user, since that would require
  2887. complete knowledge of both the capabilities of the user agent
  2888. and the intended use for the response (e.g., does the user want
  2889. to view it on screen or print it on paper?).
  2890. 2. Having the user agent describe its capabilities in every
  2891. request can be both very inefficient (given that only a small
  2892. percentage of responses have multiple representations) and a
  2893. potential violation of the user's privacy.
  2894. 3. It complicates the implementation of an origin server and the
  2895. algorithms for generating responses to a request.
  2896. Fielding, et al. Standards Track [Page 72]
  2897. RFC 2616 HTTP/1.1 June 1999
  2898. 4. It may limit a public cache's ability to use the same response
  2899. for multiple user's requests.
  2900. HTTP/1.1 includes the following request-header fields for enabling
  2901. server-driven negotiation through description of user agent
  2902. capabilities and user preferences: Accept (section 14.1), Accept-
  2903. Charset (section 14.2), Accept-Encoding (section 14.3), Accept-
  2904. Language (section 14.4), and User-Agent (section 14.43). However, an
  2905. origin server is not limited to these dimensions and MAY vary the
  2906. response based on any aspect of the request, including information
  2907. outside the request-header fields or within extension header fields
  2908. not defined by this specification.
  2909. The Vary header field can be used to express the parameters the
  2910. server uses to select a representation that is subject to server-
  2911. driven negotiation. See section 13.6 for use of the Vary header field
  2912. by caches and section 14.44 for use of the Vary header field by
  2913. servers.
  2914. 12.2 Agent-driven Negotiation
  2915. With agent-driven negotiation, selection of the best representation
  2916. for a response is performed by the user agent after receiving an
  2917. initial response from the origin server. Selection is based on a list
  2918. of the available representations of the response included within the
  2919. header fields or entity-body of the initial response, with each
  2920. representation identified by its own URI. Selection from among the
  2921. representations may be performed automatically (if the user agent is
  2922. capable of doing so) or manually by the user selecting from a
  2923. generated (possibly hypertext) menu.
  2924. Agent-driven negotiation is advantageous when the response would vary
  2925. over commonly-used dimensions (such as type, language, or encoding),
  2926. when the origin server is unable to determine a user agent's
  2927. capabilities from examining the request, and generally when public
  2928. caches are used to distribute server load and reduce network usage.
  2929. Agent-driven negotiation suffers from the disadvantage of needing a
  2930. second request to obtain the best alternate representation. This
  2931. second request is only efficient when caching is used. In addition,
  2932. this specification does not define any mechanism for supporting
  2933. automatic selection, though it also does not prevent any such
  2934. mechanism from being developed as an extension and used within
  2935. HTTP/1.1.
  2936. Fielding, et al. Standards Track [Page 73]
  2937. RFC 2616 HTTP/1.1 June 1999
  2938. HTTP/1.1 defines the 300 (Multiple Choices) and 406 (Not Acceptable)
  2939. status codes for enabling agent-driven negotiation when the server is
  2940. unwilling or unable to provide a varying response using server-driven
  2941. negotiation.
  2942. 12.3 Transparent Negotiation
  2943. Transparent negotiation is a combination of both server-driven and
  2944. agent-driven negotiation. When a cache is supplied with a form of the
  2945. list of available representations of the response (as in agent-driven
  2946. negotiation) and the dimensions of variance are completely understood
  2947. by the cache, then the cache becomes capable of performing server-
  2948. driven negotiation on behalf of the origin server for subsequent
  2949. requests on that resource.
  2950. Transparent negotiation has the advantage of distributing the
  2951. negotiation work that would otherwise be required of the origin
  2952. server and also removing the second request delay of agent-driven
  2953. negotiation when the cache is able to correctly guess the right
  2954. response.
  2955. This specification does not define any mechanism for transparent
  2956. negotiation, though it also does not prevent any such mechanism from
  2957. being developed as an extension that could be used within HTTP/1.1.
  2958. 13 Caching in HTTP
  2959. HTTP is typically used for distributed information systems, where
  2960. performance can be improved by the use of response caches. The
  2961. HTTP/1.1 protocol includes a number of elements intended to make
  2962. caching work as well as possible. Because these elements are
  2963. inextricable from other aspects of the protocol, and because they
  2964. interact with each other, it is useful to describe the basic caching
  2965. design of HTTP separately from the detailed descriptions of methods,
  2966. headers, response codes, etc.
  2967. Caching would be useless if it did not significantly improve
  2968. performance. The goal of caching in HTTP/1.1 is to eliminate the need
  2969. to send requests in many cases, and to eliminate the need to send
  2970. full responses in many other cases. The former reduces the number of
  2971. network round-trips required for many operations; we use an
  2972. "expiration" mechanism for this purpose (see section 13.2). The
  2973. latter reduces network bandwidth requirements; we use a "validation"
  2974. mechanism for this purpose (see section 13.3).
  2975. Requirements for performance, availability, and disconnected
  2976. operation require us to be able to relax the goal of semantic
  2977. transparency. The HTTP/1.1 protocol allows origin servers, caches,
  2978. Fielding, et al. Standards Track [Page 74]
  2979. RFC 2616 HTTP/1.1 June 1999
  2980. and clients to explicitly reduce transparency when necessary.
  2981. However, because non-transparent operation may confuse non-expert
  2982. users, and might be incompatible with certain server applications
  2983. (such as those for ordering merchandise), the protocol requires that
  2984. transparency be relaxed
  2985. - only by an explicit protocol-level request when relaxed by
  2986. client or origin server
  2987. - only with an explicit warning to the end user when relaxed by
  2988. cache or client
  2989. Therefore, the HTTP/1.1 protocol provides these important elements:
  2990. 1. Protocol features that provide full semantic transparency when
  2991. this is required by all parties.
  2992. 2. Protocol features that allow an origin server or user agent to
  2993. explicitly request and control non-transparent operation.
  2994. 3. Protocol features that allow a cache to attach warnings to
  2995. responses that do not preserve the requested approximation of
  2996. semantic transparency.
  2997. A basic principle is that it must be possible for the clients to
  2998. detect any potential relaxation of semantic transparency.
  2999. Note: The server, cache, or client implementor might be faced with
  3000. design decisions not explicitly discussed in this specification.
  3001. If a decision might affect semantic transparency, the implementor
  3002. ought to err on the side of maintaining transparency unless a
  3003. careful and complete analysis shows significant benefits in
  3004. breaking transparency.
  3005. 13.1.1 Cache Correctness
  3006. A correct cache MUST respond to a request with the most up-to-date
  3007. response held by the cache that is appropriate to the request (see
  3008. sections 13.2.5, 13.2.6, and 13.12) which meets one of the following
  3009. conditions:
  3010. 1. It has been checked for equivalence with what the origin server
  3011. would have returned by revalidating the response with the
  3012. origin server (section 13.3);
  3013. Fielding, et al. Standards Track [Page 75]
  3014. RFC 2616 HTTP/1.1 June 1999
  3015. 2. It is "fresh enough" (see section 13.2). In the default case,
  3016. this means it meets the least restrictive freshness requirement
  3017. of the client, origin server, and cache (see section 14.9); if
  3018. the origin server so specifies, it is the freshness requirement
  3019. of the origin server alone.
  3020. If a stored response is not "fresh enough" by the most
  3021. restrictive freshness requirement of both the client and the
  3022. origin server, in carefully considered circumstances the cache
  3023. MAY still return the response with the appropriate Warning
  3024. header (see section 13.1.5 and 14.46), unless such a response
  3025. is prohibited (e.g., by a "no-store" cache-directive, or by a
  3026. "no-cache" cache-request-directive; see section 14.9).
  3027. 3. It is an appropriate 304 (Not Modified), 305 (Proxy Redirect),
  3028. or error (4xx or 5xx) response message.
  3029. If the cache can not communicate with the origin server, then a
  3030. correct cache SHOULD respond as above if the response can be
  3031. correctly served from the cache; if not it MUST return an error or
  3032. warning indicating that there was a communication failure.
  3033. If a cache receives a response (either an entire response, or a 304
  3034. (Not Modified) response) that it would normally forward to the
  3035. requesting client, and the received response is no longer fresh, the
  3036. cache SHOULD forward it to the requesting client without adding a new
  3037. Warning (but without removing any existing Warning headers). A cache
  3038. SHOULD NOT attempt to revalidate a response simply because that
  3039. response became stale in transit; this might lead to an infinite
  3040. loop. A user agent that receives a stale response without a Warning
  3041. MAY display a warning indication to the user.
  3042. 13.1.2 Warnings
  3043. Whenever a cache returns a response that is neither first-hand nor
  3044. "fresh enough" (in the sense of condition 2 in section 13.1.1), it
  3045. MUST attach a warning to that effect, using a Warning general-header.
  3046. The Warning header and the currently defined warnings are described
  3047. in section 14.46. The warning allows clients to take appropriate
  3048. action.
  3049. Warnings MAY be used for other purposes, both cache-related and
  3050. otherwise. The use of a warning, rather than an error status code,
  3051. distinguish these responses from true failures.
  3052. Warnings are assigned three digit warn-codes. The first digit
  3053. indicates whether the Warning MUST or MUST NOT be deleted from a
  3054. stored cache entry after a successful revalidation:
  3055. Fielding, et al. Standards Track [Page 76]
  3056. RFC 2616 HTTP/1.1 June 1999
  3057. 1xx Warnings that describe the freshness or revalidation status of
  3058. the response, and so MUST be deleted after a successful
  3059. revalidation. 1XX warn-codes MAY be generated by a cache only when
  3060. validating a cached entry. It MUST NOT be generated by clients.
  3061. 2xx Warnings that describe some aspect of the entity body or entity
  3062. headers that is not rectified by a revalidation (for example, a
  3063. lossy compression of the entity bodies) and which MUST NOT be
  3064. deleted after a successful revalidation.
  3065. See section 14.46 for the definitions of the codes themselves.
  3066. HTTP/1.0 caches will cache all Warnings in responses, without
  3067. deleting the ones in the first category. Warnings in responses that
  3068. are passed to HTTP/1.0 caches carry an extra warning-date field,
  3069. which prevents a future HTTP/1.1 recipient from believing an
  3070. erroneously cached Warning.
  3071. Warnings also carry a warning text. The text MAY be in any
  3072. appropriate natural language (perhaps based on the client's Accept
  3073. headers), and include an OPTIONAL indication of what character set is
  3074. used.
  3075. Multiple warnings MAY be attached to a response (either by the origin
  3076. server or by a cache), including multiple warnings with the same code
  3077. number. For example, a server might provide the same warning with
  3078. texts in both English and Basque.
  3079. When multiple warnings are attached to a response, it might not be
  3080. practical or reasonable to display all of them to the user. This
  3081. version of HTTP does not specify strict priority rules for deciding
  3082. which warnings to display and in what order, but does suggest some
  3083. heuristics.
  3084. 13.1.3 Cache-control Mechanisms
  3085. The basic cache mechanisms in HTTP/1.1 (server-specified expiration
  3086. times and validators) are implicit directives to caches. In some
  3087. cases, a server or client might need to provide explicit directives
  3088. to the HTTP caches. We use the Cache-Control header for this purpose.
  3089. The Cache-Control header allows a client or server to transmit a
  3090. variety of directives in either requests or responses. These
  3091. directives typically override the default caching algorithms. As a
  3092. general rule, if there is any apparent conflict between header
  3093. values, the most restrictive interpretation is applied (that is, the
  3094. one that is most likely to preserve semantic transparency). However,
  3095. Fielding, et al. Standards Track [Page 77]
  3096. RFC 2616 HTTP/1.1 June 1999
  3097. in some cases, cache-control directives are explicitly specified as
  3098. weakening the approximation of semantic transparency (for example,
  3099. "max-stale" or "public").
  3100. The cache-control directives are described in detail in section 14.9.
  3101. 13.1.4 Explicit User Agent Warnings
  3102. Many user agents make it possible for users to override the basic
  3103. caching mechanisms. For example, the user agent might allow the user
  3104. to specify that cached entities (even explicitly stale ones) are
  3105. never validated. Or the user agent might habitually add "Cache-
  3106. Control: max-stale=3600" to every request. The user agent SHOULD NOT
  3107. default to either non-transparent behavior, or behavior that results
  3108. in abnormally ineffective caching, but MAY be explicitly configured
  3109. to do so by an explicit action of the user.
  3110. If the user has overridden the basic caching mechanisms, the user
  3111. agent SHOULD explicitly indicate to the user whenever this results in
  3112. the display of information that might not meet the server's
  3113. transparency requirements (in particular, if the displayed entity is
  3114. known to be stale). Since the protocol normally allows the user agent
  3115. to determine if responses are stale or not, this indication need only
  3116. be displayed when this actually happens. The indication need not be a
  3117. dialog box; it could be an icon (for example, a picture of a rotting
  3118. fish) or some other indicator.
  3119. If the user has overridden the caching mechanisms in a way that would
  3120. abnormally reduce the effectiveness of caches, the user agent SHOULD
  3121. continually indicate this state to the user (for example, by a
  3122. display of a picture of currency in flames) so that the user does not
  3123. inadvertently consume excess resources or suffer from excessive
  3124. latency.
  3125. 13.1.5 Exceptions to the Rules and Warnings
  3126. In some cases, the operator of a cache MAY choose to configure it to
  3127. return stale responses even when not requested by clients. This
  3128. decision ought not be made lightly, but may be necessary for reasons
  3129. of availability or performance, especially when the cache is poorly
  3130. connected to the origin server. Whenever a cache returns a stale
  3131. response, it MUST mark it as such (using a Warning header) enabling
  3132. the client software to alert the user that there might be a potential
  3133. problem.
  3134. Fielding, et al. Standards Track [Page 78]
  3135. RFC 2616 HTTP/1.1 June 1999
  3136. It also allows the user agent to take steps to obtain a first-hand or
  3137. fresh response. For this reason, a cache SHOULD NOT return a stale
  3138. response if the client explicitly requests a first-hand or fresh one,
  3139. unless it is impossible to comply for technical or policy reasons.
  3140. 13.1.6 Client-controlled Behavior
  3141. While the origin server (and to a lesser extent, intermediate caches,
  3142. by their contribution to the age of a response) are the primary
  3143. source of expiration information, in some cases the client might need
  3144. to control a cache's decision about whether to return a cached
  3145. response without validating it. Clients do this using several
  3146. directives of the Cache-Control header.
  3147. A client's request MAY specify the maximum age it is willing to
  3148. accept of an unvalidated response; specifying a value of zero forces
  3149. the cache(s) to revalidate all responses. A client MAY also specify
  3150. the minimum time remaining before a response expires. Both of these
  3151. options increase constraints on the behavior of caches, and so cannot
  3152. further relax the cache's approximation of semantic transparency.
  3153. A client MAY also specify that it will accept stale responses, up to
  3154. some maximum amount of staleness. This loosens the constraints on the
  3155. caches, and so might violate the origin server's specified
  3156. constraints on semantic transparency, but might be necessary to
  3157. support disconnected operation, or high availability in the face of
  3158. poor connectivity.
  3159. 13.2 Expiration Model
  3160. 13.2.1 Server-Specified Expiration
  3161. HTTP caching works best when caches can entirely avoid making
  3162. requests to the origin server. The primary mechanism for avoiding
  3163. requests is for an origin server to provide an explicit expiration
  3164. time in the future, indicating that a response MAY be used to satisfy
  3165. subsequent requests. In other words, a cache can return a fresh
  3166. response without first contacting the server.
  3167. Our expectation is that servers will assign future explicit
  3168. expiration times to responses in the belief that the entity is not
  3169. likely to change, in a semantically significant way, before the
  3170. expiration time is reached. This normally preserves semantic
  3171. transparency, as long as the server's expiration times are carefully
  3172. chosen.
  3173. Fielding, et al. Standards Track [Page 79]
  3174. RFC 2616 HTTP/1.1 June 1999
  3175. The expiration mechanism applies only to responses taken from a cache
  3176. and not to first-hand responses forwarded immediately to the
  3177. requesting client.
  3178. If an origin server wishes to force a semantically transparent cache
  3179. to validate every request, it MAY assign an explicit expiration time
  3180. in the past. This means that the response is always stale, and so the
  3181. cache SHOULD validate it before using it for subsequent requests. See
  3182. section 14.9.4 for a more restrictive way to force revalidation.
  3183. If an origin server wishes to force any HTTP/1.1 cache, no matter how
  3184. it is configured, to validate every request, it SHOULD use the "must-
  3185. revalidate" cache-control directive (see section 14.9).
  3186. Servers specify explicit expiration times using either the Expires
  3187. header, or the max-age directive of the Cache-Control header.
  3188. An expiration time cannot be used to force a user agent to refresh
  3189. its display or reload a resource; its semantics apply only to caching
  3190. mechanisms, and such mechanisms need only check a resource's
  3191. expiration status when a new request for that resource is initiated.
  3192. See section 13.13 for an explanation of the difference between caches
  3193. and history mechanisms.
  3194. 13.2.2 Heuristic Expiration
  3195. Since origin servers do not always provide explicit expiration times,
  3196. HTTP caches typically assign heuristic expiration times, employing
  3197. algorithms that use other header values (such as the Last-Modified
  3198. time) to estimate a plausible expiration time. The HTTP/1.1
  3199. specification does not provide specific algorithms, but does impose
  3200. worst-case constraints on their results. Since heuristic expiration
  3201. times might compromise semantic transparency, they ought to used
  3202. cautiously, and we encourage origin servers to provide explicit
  3203. expiration times as much as possible.
  3204. 13.2.3 Age Calculations
  3205. In order to know if a cached entry is fresh, a cache needs to know if
  3206. its age exceeds its freshness lifetime. We discuss how to calculate
  3207. the latter in section 13.2.4; this section describes how to calculate
  3208. the age of a response or cache entry.
  3209. In this discussion, we use the term "now" to mean "the current value
  3210. of the clock at the host performing the calculation." Hosts that use
  3211. HTTP, but especially hosts running origin servers and caches, SHOULD
  3212. use NTP [28] or some similar protocol to synchronize their clocks to
  3213. a globally accurate time standard.
  3214. Fielding, et al. Standards Track [Page 80]
  3215. RFC 2616 HTTP/1.1 June 1999
  3216. HTTP/1.1 requires origin servers to send a Date header, if possible,
  3217. with every response, giving the time at which the response was
  3218. generated (see section 14.18). We use the term "date_value" to denote
  3219. the value of the Date header, in a form appropriate for arithmetic
  3220. operations.
  3221. HTTP/1.1 uses the Age response-header to convey the estimated age of
  3222. the response message when obtained from a cache. The Age field value
  3223. is the cache's estimate of the amount of time since the response was
  3224. generated or revalidated by the origin server.
  3225. In essence, the Age value is the sum of the time that the response
  3226. has been resident in each of the caches along the path from the
  3227. origin server, plus the amount of time it has been in transit along
  3228. network paths.
  3229. We use the term "age_value" to denote the value of the Age header, in
  3230. a form appropriate for arithmetic operations.
  3231. A response's age can be calculated in two entirely independent ways:
  3232. 1. now minus date_value, if the local clock is reasonably well
  3233. synchronized to the origin server's clock. If the result is
  3234. negative, the result is replaced by zero.
  3235. 2. age_value, if all of the caches along the response path
  3236. implement HTTP/1.1.
  3237. Given that we have two independent ways to compute the age of a
  3238. response when it is received, we can combine these as
  3239. corrected_received_age = max(now - date_value, age_value)
  3240. and as long as we have either nearly synchronized clocks or all-
  3241. HTTP/1.1 paths, one gets a reliable (conservative) result.
  3242. Because of network-imposed delays, some significant interval might
  3243. pass between the time that a server generates a response and the time
  3244. it is received at the next outbound cache or client. If uncorrected,
  3245. this delay could result in improperly low ages.
  3246. Because the request that resulted in the returned Age value must have
  3247. been initiated prior to that Age value's generation, we can correct
  3248. for delays imposed by the network by recording the time at which the
  3249. request was initiated. Then, when an Age value is received, it MUST
  3250. be interpreted relative to the time the request was initiated, not
  3251. Fielding, et al. Standards Track [Page 81]
  3252. RFC 2616 HTTP/1.1 June 1999
  3253. the time that the response was received. This algorithm results in
  3254. conservative behavior no matter how much delay is experienced. So, we
  3255. compute:
  3256. corrected_initial_age = corrected_received_age
  3257. + (now - request_time)
  3258. where "request_time" is the time (according to the local clock) when
  3259. the request that elicited this response was sent.
  3260. Summary of age calculation algorithm, when a cache receives a
  3261. response:
  3262. /*
  3263. * age_value
  3264. * is the value of Age: header received by the cache with
  3265. * this response.
  3266. * date_value
  3267. * is the value of the origin server's Date: header
  3268. * request_time
  3269. * is the (local) time when the cache made the request
  3270. * that resulted in this cached response
  3271. * response_time
  3272. * is the (local) time when the cache received the
  3273. * response
  3274. * now
  3275. * is the current (local) time
  3276. */
  3277. apparent_age = max(0, response_time - date_value);
  3278. corrected_received_age = max(apparent_age, age_value);
  3279. response_delay = response_time - request_time;
  3280. corrected_initial_age = corrected_received_age + response_delay;
  3281. resident_time = now - response_time;
  3282. current_age = corrected_initial_age + resident_time;
  3283. The current_age of a cache entry is calculated by adding the amount
  3284. of time (in seconds) since the cache entry was last validated by the
  3285. origin server to the corrected_initial_age. When a response is
  3286. generated from a cache entry, the cache MUST include a single Age
  3287. header field in the response with a value equal to the cache entry's
  3288. current_age.
  3289. The presence of an Age header field in a response implies that a
  3290. response is not first-hand. However, the converse is not true, since
  3291. the lack of an Age header field in a response does not imply that the
  3292. Fielding, et al. Standards Track [Page 82]
  3293. RFC 2616 HTTP/1.1 June 1999
  3294. response is first-hand unless all caches along the request path are
  3295. compliant with HTTP/1.1 (i.e., older HTTP caches did not implement
  3296. the Age header field).
  3297. 13.2.4 Expiration Calculations
  3298. In order to decide whether a response is fresh or stale, we need to
  3299. compare its freshness lifetime to its age. The age is calculated as
  3300. described in section 13.2.3; this section describes how to calculate
  3301. the freshness lifetime, and to determine if a response has expired.
  3302. In the discussion below, the values can be represented in any form
  3303. appropriate for arithmetic operations.
  3304. We use the term "expires_value" to denote the value of the Expires
  3305. header. We use the term "max_age_value" to denote an appropriate
  3306. value of the number of seconds carried by the "max-age" directive of
  3307. the Cache-Control header in a response (see section 14.9.3).
  3308. The max-age directive takes priority over Expires, so if max-age is
  3309. present in a response, the calculation is simply:
  3310. freshness_lifetime = max_age_value
  3311. Otherwise, if Expires is present in the response, the calculation is:
  3312. freshness_lifetime = expires_value - date_value
  3313. Note that neither of these calculations is vulnerable to clock skew,
  3314. since all of the information comes from the origin server.
  3315. If none of Expires, Cache-Control: max-age, or Cache-Control: s-
  3316. maxage (see section 14.9.3) appears in the response, and the response
  3317. does not include other restrictions on caching, the cache MAY compute
  3318. a freshness lifetime using a heuristic. The cache MUST attach Warning
  3319. 113 to any response whose age is more than 24 hours if such warning
  3320. has not already been added.
  3321. Also, if the response does have a Last-Modified time, the heuristic
  3322. expiration value SHOULD be no more than some fraction of the interval
  3323. since that time. A typical setting of this fraction might be 10%.
  3324. The calculation to determine if a response has expired is quite
  3325. simple:
  3326. response_is_fresh = (freshness_lifetime > current_age)
  3327. Fielding, et al. Standards Track [Page 83]
  3328. RFC 2616 HTTP/1.1 June 1999
  3329. 13.2.5 Disambiguating Expiration Values
  3330. Because expiration values are assigned optimistically, it is possible
  3331. for two caches to contain fresh values for the same resource that are
  3332. different.
  3333. If a client performing a retrieval receives a non-first-hand response
  3334. for a request that was already fresh in its own cache, and the Date
  3335. header in its existing cache entry is newer than the Date on the new
  3336. response, then the client MAY ignore the response. If so, it MAY
  3337. retry the request with a "Cache-Control: max-age=0" directive (see
  3338. section 14.9), to force a check with the origin server.
  3339. If a cache has two fresh responses for the same representation with
  3340. different validators, it MUST use the one with the more recent Date
  3341. header. This situation might arise because the cache is pooling
  3342. responses from other caches, or because a client has asked for a
  3343. reload or a revalidation of an apparently fresh cache entry.
  3344. 13.2.6 Disambiguating Multiple Responses
  3345. Because a client might be receiving responses via multiple paths, so
  3346. that some responses flow through one set of caches and other
  3347. responses flow through a different set of caches, a client might
  3348. receive responses in an order different from that in which the origin
  3349. server sent them. We would like the client to use the most recently
  3350. generated response, even if older responses are still apparently
  3351. fresh.
  3352. Neither the entity tag nor the expiration value can impose an
  3353. ordering on responses, since it is possible that a later response
  3354. intentionally carries an earlier expiration time. The Date values are
  3355. ordered to a granularity of one second.
  3356. When a client tries to revalidate a cache entry, and the response it
  3357. receives contains a Date header that appears to be older than the one
  3358. for the existing entry, then the client SHOULD repeat the request
  3359. unconditionally, and include
  3360. Cache-Control: max-age=0
  3361. to force any intermediate caches to validate their copies directly
  3362. with the origin server, or
  3363. Cache-Control: no-cache
  3364. to force any intermediate caches to obtain a new copy from the origin
  3365. server.
  3366. Fielding, et al. Standards Track [Page 84]
  3367. RFC 2616 HTTP/1.1 June 1999
  3368. If the Date values are equal, then the client MAY use either response
  3369. (or MAY, if it is being extremely prudent, request a new response).
  3370. Servers MUST NOT depend on clients being able to choose
  3371. deterministically between responses generated during the same second,
  3372. if their expiration times overlap.
  3373. 13.3 Validation Model
  3374. When a cache has a stale entry that it would like to use as a
  3375. response to a client's request, it first has to check with the origin
  3376. server (or possibly an intermediate cache with a fresh response) to
  3377. see if its cached entry is still usable. We call this "validating"
  3378. the cache entry. Since we do not want to have to pay the overhead of
  3379. retransmitting the full response if the cached entry is good, and we
  3380. do not want to pay the overhead of an extra round trip if the cached
  3381. entry is invalid, the HTTP/1.1 protocol supports the use of
  3382. conditional methods.
  3383. The key protocol features for supporting conditional methods are
  3384. those concerned with "cache validators." When an origin server
  3385. generates a full response, it attaches some sort of validator to it,
  3386. which is kept with the cache entry. When a client (user agent or
  3387. proxy cache) makes a conditional request for a resource for which it
  3388. has a cache entry, it includes the associated validator in the
  3389. request.
  3390. The server then checks that validator against the current validator
  3391. for the entity, and, if they match (see section 13.3.3), it responds
  3392. with a special status code (usually, 304 (Not Modified)) and no
  3393. entity-body. Otherwise, it returns a full response (including
  3394. entity-body). Thus, we avoid transmitting the full response if the
  3395. validator matches, and we avoid an extra round trip if it does not
  3396. match.
  3397. In HTTP/1.1, a conditional request looks exactly the same as a normal
  3398. request for the same resource, except that it carries a special
  3399. header (which includes the validator) that implicitly turns the
  3400. method (usually, GET) into a conditional.
  3401. The protocol includes both positive and negative senses of cache-
  3402. validating conditions. That is, it is possible to request either that
  3403. a method be performed if and only if a validator matches or if and
  3404. only if no validators match.
  3405. Fielding, et al. Standards Track [Page 85]
  3406. RFC 2616 HTTP/1.1 June 1999
  3407. Note: a response that lacks a validator may still be cached, and
  3408. served from cache until it expires, unless this is explicitly
  3409. prohibited by a cache-control directive. However, a cache cannot
  3410. do a conditional retrieval if it does not have a validator for the
  3411. entity, which means it will not be refreshable after it expires.
  3412. 13.3.1 Last-Modified Dates
  3413. The Last-Modified entity-header field value is often used as a cache
  3414. validator. In simple terms, a cache entry is considered to be valid
  3415. if the entity has not been modified since the Last-Modified value.
  3416. 13.3.2 Entity Tag Cache Validators
  3417. The ETag response-header field value, an entity tag, provides for an
  3418. "opaque" cache validator. This might allow more reliable validation
  3419. in situations where it is inconvenient to store modification dates,
  3420. where the one-second resolution of HTTP date values is not
  3421. sufficient, or where the origin server wishes to avoid certain
  3422. paradoxes that might arise from the use of modification dates.
  3423. Entity Tags are described in section 3.11. The headers used with
  3424. entity tags are described in sections 14.19, 14.24, 14.26 and 14.44.
  3425. 13.3.3 Weak and Strong Validators
  3426. Since both origin servers and caches will compare two validators to
  3427. decide if they represent the same or different entities, one normally
  3428. would expect that if the entity (the entity-body or any entity-
  3429. headers) changes in any way, then the associated validator would
  3430. change as well. If this is true, then we call this validator a
  3431. "strong validator."
  3432. However, there might be cases when a server prefers to change the
  3433. validator only on semantically significant changes, and not when
  3434. insignificant aspects of the entity change. A validator that does not
  3435. always change when the resource changes is a "weak validator."
  3436. Entity tags are normally "strong validators," but the protocol
  3437. provides a mechanism to tag an entity tag as "weak." One can think of
  3438. a strong validator as one that changes whenever the bits of an entity
  3439. changes, while a weak value changes whenever the meaning of an entity
  3440. changes. Alternatively, one can think of a strong validator as part
  3441. of an identifier for a specific entity, while a weak validator is
  3442. part of an identifier for a set of semantically equivalent entities.
  3443. Note: One example of a strong validator is an integer that is
  3444. incremented in stable storage every time an entity is changed.
  3445. Fielding, et al. Standards Track [Page 86]
  3446. RFC 2616 HTTP/1.1 June 1999
  3447. An entity's modification time, if represented with one-second
  3448. resolution, could be a weak validator, since it is possible that
  3449. the resource might be modified twice during a single second.
  3450. Support for weak validators is optional. However, weak validators
  3451. allow for more efficient caching of equivalent objects; for
  3452. example, a hit counter on a site is probably good enough if it is
  3453. updated every few days or weeks, and any value during that period
  3454. is likely "good enough" to be equivalent.
  3455. A "use" of a validator is either when a client generates a request
  3456. and includes the validator in a validating header field, or when a
  3457. server compares two validators.
  3458. Strong validators are usable in any context. Weak validators are only
  3459. usable in contexts that do not depend on exact equality of an entity.
  3460. For example, either kind is usable for a conditional GET of a full
  3461. entity. However, only a strong validator is usable for a sub-range
  3462. retrieval, since otherwise the client might end up with an internally
  3463. inconsistent entity.
  3464. Clients MAY issue simple (non-subrange) GET requests with either weak
  3465. validators or strong validators. Clients MUST NOT use weak validators
  3466. in other forms of request.
  3467. The only function that the HTTP/1.1 protocol defines on validators is
  3468. comparison. There are two validator comparison functions, depending
  3469. on whether the comparison context allows the use of weak validators
  3470. or not:
  3471. - The strong comparison function: in order to be considered equal,
  3472. both validators MUST be identical in every way, and both MUST
  3473. NOT be weak.
  3474. - The weak comparison function: in order to be considered equal,
  3475. both validators MUST be identical in every way, but either or
  3476. both of them MAY be tagged as "weak" without affecting the
  3477. result.
  3478. An entity tag is strong unless it is explicitly tagged as weak.
  3479. Section 3.11 gives the syntax for entity tags.
  3480. A Last-Modified time, when used as a validator in a request, is
  3481. implicitly weak unless it is possible to deduce that it is strong,
  3482. using the following rules:
  3483. - The validator is being compared by an origin server to the
  3484. actual current validator for the entity and,
  3485. Fielding, et al. Standards Track [Page 87]
  3486. RFC 2616 HTTP/1.1 June 1999
  3487. - That origin server reliably knows that the associated entity did
  3488. not change twice during the second covered by the presented
  3489. validator.
  3490. or
  3491. - The validator is about to be used by a client in an If-
  3492. Modified-Since or If-Unmodified-Since header, because the client
  3493. has a cache entry for the associated entity, and
  3494. - That cache entry includes a Date value, which gives the time
  3495. when the origin server sent the original response, and
  3496. - The presented Last-Modified time is at least 60 seconds before
  3497. the Date value.
  3498. or
  3499. - The validator is being compared by an intermediate cache to the
  3500. validator stored in its cache entry for the entity, and
  3501. - That cache entry includes a Date value, which gives the time
  3502. when the origin server sent the original response, and
  3503. - The presented Last-Modified time is at least 60 seconds before
  3504. the Date value.
  3505. This method relies on the fact that if two different responses were
  3506. sent by the origin server during the same second, but both had the
  3507. same Last-Modified time, then at least one of those responses would
  3508. have a Date value equal to its Last-Modified time. The arbitrary 60-
  3509. second limit guards against the possibility that the Date and Last-
  3510. Modified values are generated from different clocks, or at somewhat
  3511. different times during the preparation of the response. An
  3512. implementation MAY use a value larger than 60 seconds, if it is
  3513. believed that 60 seconds is too short.
  3514. If a client wishes to perform a sub-range retrieval on a value for
  3515. which it has only a Last-Modified time and no opaque validator, it
  3516. MAY do this only if the Last-Modified time is strong in the sense
  3517. described here.
  3518. A cache or origin server receiving a conditional request, other than
  3519. a full-body GET request, MUST use the strong comparison function to
  3520. evaluate the condition.
  3521. These rules allow HTTP/1.1 caches and clients to safely perform sub-
  3522. range retrievals on values that have been obtained from HTTP/1.0
  3523. Fielding, et al. Standards Track [Page 88]
  3524. RFC 2616 HTTP/1.1 June 1999
  3525. servers.
  3526. 13.3.4 Rules for When to Use Entity Tags and Last-Modified Dates
  3527. We adopt a set of rules and recommendations for origin servers,
  3528. clients, and caches regarding when various validator types ought to
  3529. be used, and for what purposes.
  3530. HTTP/1.1 origin servers:
  3531. - SHOULD send an entity tag validator unless it is not feasible to
  3532. generate one.
  3533. - MAY send a weak entity tag instead of a strong entity tag, if
  3534. performance considerations support the use of weak entity tags,
  3535. or if it is unfeasible to send a strong entity tag.
  3536. - SHOULD send a Last-Modified value if it is feasible to send one,
  3537. unless the risk of a breakdown in semantic transparency that
  3538. could result from using this date in an If-Modified-Since header
  3539. would lead to serious problems.
  3540. In other words, the preferred behavior for an HTTP/1.1 origin server
  3541. is to send both a strong entity tag and a Last-Modified value.
  3542. In order to be legal, a strong entity tag MUST change whenever the
  3543. associated entity value changes in any way. A weak entity tag SHOULD
  3544. change whenever the associated entity changes in a semantically
  3545. significant way.
  3546. Note: in order to provide semantically transparent caching, an
  3547. origin server must avoid reusing a specific strong entity tag
  3548. value for two different entities, or reusing a specific weak
  3549. entity tag value for two semantically different entities. Cache
  3550. entries might persist for arbitrarily long periods, regardless of
  3551. expiration times, so it might be inappropriate to expect that a
  3552. cache will never again attempt to validate an entry using a
  3553. validator that it obtained at some point in the past.
  3554. HTTP/1.1 clients:
  3555. - If an entity tag has been provided by the origin server, MUST
  3556. use that entity tag in any cache-conditional request (using If-
  3557. Match or If-None-Match).
  3558. - If only a Last-Modified value has been provided by the origin
  3559. server, SHOULD use that value in non-subrange cache-conditional
  3560. requests (using If-Modified-Since).
  3561. Fielding, et al. Standards Track [Page 89]
  3562. RFC 2616 HTTP/1.1 June 1999
  3563. - If only a Last-Modified value has been provided by an HTTP/1.0
  3564. origin server, MAY use that value in subrange cache-conditional
  3565. requests (using If-Unmodified-Since:). The user agent SHOULD
  3566. provide a way to disable this, in case of difficulty.
  3567. - If both an entity tag and a Last-Modified value have been
  3568. provided by the origin server, SHOULD use both validators in
  3569. cache-conditional requests. This allows both HTTP/1.0 and
  3570. HTTP/1.1 caches to respond appropriately.
  3571. An HTTP/1.1 origin server, upon receiving a conditional request that
  3572. includes both a Last-Modified date (e.g., in an If-Modified-Since or
  3573. If-Unmodified-Since header field) and one or more entity tags (e.g.,
  3574. in an If-Match, If-None-Match, or If-Range header field) as cache
  3575. validators, MUST NOT return a response status of 304 (Not Modified)
  3576. unless doing so is consistent with all of the conditional header
  3577. fields in the request.
  3578. An HTTP/1.1 caching proxy, upon receiving a conditional request that
  3579. includes both a Last-Modified date and one or more entity tags as
  3580. cache validators, MUST NOT return a locally cached response to the
  3581. client unless that cached response is consistent with all of the
  3582. conditional header fields in the request.
  3583. Note: The general principle behind these rules is that HTTP/1.1
  3584. servers and clients should transmit as much non-redundant
  3585. information as is available in their responses and requests.
  3586. HTTP/1.1 systems receiving this information will make the most
  3587. conservative assumptions about the validators they receive.
  3588. HTTP/1.0 clients and caches will ignore entity tags. Generally,
  3589. last-modified values received or used by these systems will
  3590. support transparent and efficient caching, and so HTTP/1.1 origin
  3591. servers should provide Last-Modified values. In those rare cases
  3592. where the use of a Last-Modified value as a validator by an
  3593. HTTP/1.0 system could result in a serious problem, then HTTP/1.1
  3594. origin servers should not provide one.
  3595. 13.3.5 Non-validating Conditionals
  3596. The principle behind entity tags is that only the service author
  3597. knows the semantics of a resource well enough to select an
  3598. appropriate cache validation mechanism, and the specification of any
  3599. validator comparison function more complex than byte-equality would
  3600. open up a can of worms. Thus, comparisons of any other headers
  3601. (except Last-Modified, for compatibility with HTTP/1.0) are never
  3602. used for purposes of validating a cache entry.
  3603. Fielding, et al. Standards Track [Page 90]
  3604. RFC 2616 HTTP/1.1 June 1999
  3605. 13.4 Response Cacheability
  3606. Unless specifically constrained by a cache-control (section 14.9)
  3607. directive, a caching system MAY always store a successful response
  3608. (see section 13.8) as a cache entry, MAY return it without validation
  3609. if it is fresh, and MAY return it after successful validation. If
  3610. there is neither a cache validator nor an explicit expiration time
  3611. associated with a response, we do not expect it to be cached, but
  3612. certain caches MAY violate this expectation (for example, when little
  3613. or no network connectivity is available). A client can usually detect
  3614. that such a response was taken from a cache by comparing the Date
  3615. header to the current time.
  3616. Note: some HTTP/1.0 caches are known to violate this expectation
  3617. without providing any Warning.
  3618. However, in some cases it might be inappropriate for a cache to
  3619. retain an entity, or to return it in response to a subsequent
  3620. request. This might be because absolute semantic transparency is
  3621. deemed necessary by the service author, or because of security or
  3622. privacy considerations. Certain cache-control directives are
  3623. therefore provided so that the server can indicate that certain
  3624. resource entities, or portions thereof, are not to be cached
  3625. regardless of other considerations.
  3626. Note that section 14.8 normally prevents a shared cache from saving
  3627. and returning a response to a previous request if that request
  3628. included an Authorization header.
  3629. A response received with a status code of 200, 203, 206, 300, 301 or
  3630. 410 MAY be stored by a cache and used in reply to a subsequent
  3631. request, subject to the expiration mechanism, unless a cache-control
  3632. directive prohibits caching. However, a cache that does not support
  3633. the Range and Content-Range headers MUST NOT cache 206 (Partial
  3634. Content) responses.
  3635. A response received with any other status code (e.g. status codes 302
  3636. and 307) MUST NOT be returned in a reply to a subsequent request
  3637. unless there are cache-control directives or another header(s) that
  3638. explicitly allow it. For example, these include the following: an
  3639. Expires header (section 14.21); a "max-age", "s-maxage", "must-
  3640. revalidate", "proxy-revalidate", "public" or "private" cache-control
  3641. directive (section 14.9).
  3642. Fielding, et al. Standards Track [Page 91]
  3643. RFC 2616 HTTP/1.1 June 1999
  3644. 13.5 Constructing Responses From Caches
  3645. The purpose of an HTTP cache is to store information received in
  3646. response to requests for use in responding to future requests. In
  3647. many cases, a cache simply returns the appropriate parts of a
  3648. response to the requester. However, if the cache holds a cache entry
  3649. based on a previous response, it might have to combine parts of a new
  3650. response with what is held in the cache entry.
  3651. 13.5.1 End-to-end and Hop-by-hop Headers
  3652. For the purpose of defining the behavior of caches and non-caching
  3653. proxies, we divide HTTP headers into two categories:
  3654. - End-to-end headers, which are transmitted to the ultimate
  3655. recipient of a request or response. End-to-end headers in
  3656. responses MUST be stored as part of a cache entry and MUST be
  3657. transmitted in any response formed from a cache entry.
  3658. - Hop-by-hop headers, which are meaningful only for a single
  3659. transport-level connection, and are not stored by caches or
  3660. forwarded by proxies.
  3661. The following HTTP/1.1 headers are hop-by-hop headers:
  3662. - Connection
  3663. - Keep-Alive
  3664. - Proxy-Authenticate
  3665. - Proxy-Authorization
  3666. - TE
  3667. - Trailers
  3668. - Transfer-Encoding
  3669. - Upgrade
  3670. All other headers defined by HTTP/1.1 are end-to-end headers.
  3671. Other hop-by-hop headers MUST be listed in a Connection header,
  3672. (section 14.10) to be introduced into HTTP/1.1 (or later).
  3673. 13.5.2 Non-modifiable Headers
  3674. Some features of the HTTP/1.1 protocol, such as Digest
  3675. Authentication, depend on the value of certain end-to-end headers. A
  3676. transparent proxy SHOULD NOT modify an end-to-end header unless the
  3677. definition of that header requires or specifically allows that.
  3678. Fielding, et al. Standards Track [Page 92]
  3679. RFC 2616 HTTP/1.1 June 1999
  3680. A transparent proxy MUST NOT modify any of the following fields in a
  3681. request or response, and it MUST NOT add any of these fields if not
  3682. already present:
  3683. - Content-Location
  3684. - Content-MD5
  3685. - ETag
  3686. - Last-Modified
  3687. A transparent proxy MUST NOT modify any of the following fields in a
  3688. response:
  3689. - Expires
  3690. but it MAY add any of these fields if not already present. If an
  3691. Expires header is added, it MUST be given a field-value identical to
  3692. that of the Date header in that response.
  3693. A proxy MUST NOT modify or add any of the following fields in a
  3694. message that contains the no-transform cache-control directive, or in
  3695. any request:
  3696. - Content-Encoding
  3697. - Content-Range
  3698. - Content-Type
  3699. A non-transparent proxy MAY modify or add these fields to a message
  3700. that does not include no-transform, but if it does so, it MUST add a
  3701. Warning 214 (Transformation applied) if one does not already appear
  3702. in the message (see section 14.46).
  3703. Warning: unnecessary modification of end-to-end headers might
  3704. cause authentication failures if stronger authentication
  3705. mechanisms are introduced in later versions of HTTP. Such
  3706. authentication mechanisms MAY rely on the values of header fields
  3707. not listed here.
  3708. The Content-Length field of a request or response is added or deleted
  3709. according to the rules in section 4.4. A transparent proxy MUST
  3710. preserve the entity-length (section 7.2.2) of the entity-body,
  3711. although it MAY change the transfer-length (section 4.4).
  3712. Fielding, et al. Standards Track [Page 93]
  3713. RFC 2616 HTTP/1.1 June 1999
  3714. 13.5.3 Combining Headers
  3715. When a cache makes a validating request to a server, and the server
  3716. provides a 304 (Not Modified) response or a 206 (Partial Content)
  3717. response, the cache then constructs a response to send to the
  3718. requesting client.
  3719. If the status code is 304 (Not Modified), the cache uses the entity-
  3720. body stored in the cache entry as the entity-body of this outgoing
  3721. response. If the status code is 206 (Partial Content) and the ETag or
  3722. Last-Modified headers match exactly, the cache MAY combine the
  3723. contents stored in the cache entry with the new contents received in
  3724. the response and use the result as the entity-body of this outgoing
  3725. response, (see 13.5.4).
  3726. The end-to-end headers stored in the cache entry are used for the
  3727. constructed response, except that
  3728. - any stored Warning headers with warn-code 1xx (see section
  3729. 14.46) MUST be deleted from the cache entry and the forwarded
  3730. response.
  3731. - any stored Warning headers with warn-code 2xx MUST be retained
  3732. in the cache entry and the forwarded response.
  3733. - any end-to-end headers provided in the 304 or 206 response MUST
  3734. replace the corresponding headers from the cache entry.
  3735. Unless the cache decides to remove the cache entry, it MUST also
  3736. replace the end-to-end headers stored with the cache entry with
  3737. corresponding headers received in the incoming response, except for
  3738. Warning headers as described immediately above. If a header field-
  3739. name in the incoming response matches more than one header in the
  3740. cache entry, all such old headers MUST be replaced.
  3741. In other words, the set of end-to-end headers received in the
  3742. incoming response overrides all corresponding end-to-end headers
  3743. stored with the cache entry (except for stored Warning headers with
  3744. warn-code 1xx, which are deleted even if not overridden).
  3745. Note: this rule allows an origin server to use a 304 (Not
  3746. Modified) or a 206 (Partial Content) response to update any header
  3747. associated with a previous response for the same entity or sub-
  3748. ranges thereof, although it might not always be meaningful or
  3749. correct to do so. This rule does not allow an origin server to use
  3750. a 304 (Not Modified) or a 206 (Partial Content) response to
  3751. entirely delete a header that it had provided with a previous
  3752. response.
  3753. Fielding, et al. Standards Track [Page 94]
  3754. RFC 2616 HTTP/1.1 June 1999
  3755. 13.5.4 Combining Byte Ranges
  3756. A response might transfer only a subrange of the bytes of an entity-
  3757. body, either because the request included one or more Range
  3758. specifications, or because a connection was broken prematurely. After
  3759. several such transfers, a cache might have received several ranges of
  3760. the same entity-body.
  3761. If a cache has a stored non-empty set of subranges for an entity, and
  3762. an incoming response transfers another subrange, the cache MAY
  3763. combine the new subrange with the existing set if both the following
  3764. conditions are met:
  3765. - Both the incoming response and the cache entry have a cache
  3766. validator.
  3767. - The two cache validators match using the strong comparison
  3768. function (see section 13.3.3).
  3769. If either requirement is not met, the cache MUST use only the most
  3770. recent partial response (based on the Date values transmitted with
  3771. every response, and using the incoming response if these values are
  3772. equal or missing), and MUST discard the other partial information.
  3773. 13.6 Caching Negotiated Responses
  3774. Use of server-driven content negotiation (section 12.1), as indicated
  3775. by the presence of a Vary header field in a response, alters the
  3776. conditions and procedure by which a cache can use the response for
  3777. subsequent requests. See section 14.44 for use of the Vary header
  3778. field by servers.
  3779. A server SHOULD use the Vary header field to inform a cache of what
  3780. request-header fields were used to select among multiple
  3781. representations of a cacheable response subject to server-driven
  3782. negotiation. The set of header fields named by the Vary field value
  3783. is known as the "selecting" request-headers.
  3784. When the cache receives a subsequent request whose Request-URI
  3785. specifies one or more cache entries including a Vary header field,
  3786. the cache MUST NOT use such a cache entry to construct a response to
  3787. the new request unless all of the selecting request-headers present
  3788. in the new request match the corresponding stored request-headers in
  3789. the original request.
  3790. The selecting request-headers from two requests are defined to match
  3791. if and only if the selecting request-headers in the first request can
  3792. be transformed to the selecting request-headers in the second request
  3793. Fielding, et al. Standards Track [Page 95]
  3794. RFC 2616 HTTP/1.1 June 1999
  3795. by adding or removing linear white space (LWS) at places where this
  3796. is allowed by the corresponding BNF, and/or combining multiple
  3797. message-header fields with the same field name following the rules
  3798. about message headers in section 4.2.
  3799. A Vary header field-value of "*" always fails to match and subsequent
  3800. requests on that resource can only be properly interpreted by the
  3801. origin server.
  3802. If the selecting request header fields for the cached entry do not
  3803. match the selecting request header fields of the new request, then
  3804. the cache MUST NOT use a cached entry to satisfy the request unless
  3805. it first relays the new request to the origin server in a conditional
  3806. request and the server responds with 304 (Not Modified), including an
  3807. entity tag or Content-Location that indicates the entity to be used.
  3808. If an entity tag was assigned to a cached representation, the
  3809. forwarded request SHOULD be conditional and include the entity tags
  3810. in an If-None-Match header field from all its cache entries for the
  3811. resource. This conveys to the server the set of entities currently
  3812. held by the cache, so that if any one of these entities matches the
  3813. requested entity, the server can use the ETag header field in its 304
  3814. (Not Modified) response to tell the cache which entry is appropriate.
  3815. If the entity-tag of the new response matches that of an existing
  3816. entry, the new response SHOULD be used to update the header fields of
  3817. the existing entry, and the result MUST be returned to the client.
  3818. If any of the existing cache entries contains only partial content
  3819. for the associated entity, its entity-tag SHOULD NOT be included in
  3820. the If-None-Match header field unless the request is for a range that
  3821. would be fully satisfied by that entry.
  3822. If a cache receives a successful response whose Content-Location
  3823. field matches that of an existing cache entry for the same Request-
  3824. ]URI, whose entity-tag differs from that of the existing entry, and
  3825. whose Date is more recent than that of the existing entry, the
  3826. existing entry SHOULD NOT be returned in response to future requests
  3827. and SHOULD be deleted from the cache.
  3828. 13.7 Shared and Non-Shared Caches
  3829. For reasons of security and privacy, it is necessary to make a
  3830. distinction between "shared" and "non-shared" caches. A non-shared
  3831. cache is one that is accessible only to a single user. Accessibility
  3832. in this case SHOULD be enforced by appropriate security mechanisms.
  3833. All other caches are considered to be "shared." Other sections of
  3834. Fielding, et al. Standards Track [Page 96]
  3835. RFC 2616 HTTP/1.1 June 1999
  3836. this specification place certain constraints on the operation of
  3837. shared caches in order to prevent loss of privacy or failure of
  3838. access controls.
  3839. 13.8 Errors or Incomplete Response Cache Behavior
  3840. A cache that receives an incomplete response (for example, with fewer
  3841. bytes of data than specified in a Content-Length header) MAY store
  3842. the response. However, the cache MUST treat this as a partial
  3843. response. Partial responses MAY be combined as described in section
  3844. 13.5.4; the result might be a full response or might still be
  3845. partial. A cache MUST NOT return a partial response to a client
  3846. without explicitly marking it as such, using the 206 (Partial
  3847. Content) status code. A cache MUST NOT return a partial response
  3848. using a status code of 200 (OK).
  3849. If a cache receives a 5xx response while attempting to revalidate an
  3850. entry, it MAY either forward this response to the requesting client,
  3851. or act as if the server failed to respond. In the latter case, it MAY
  3852. return a previously received response unless the cached entry
  3853. includes the "must-revalidate" cache-control directive (see section
  3854. 14.9).
  3855. 13.9 Side Effects of GET and HEAD
  3856. Unless the origin server explicitly prohibits the caching of their
  3857. responses, the application of GET and HEAD methods to any resources
  3858. SHOULD NOT have side effects that would lead to erroneous behavior if
  3859. these responses are taken from a cache. They MAY still have side
  3860. effects, but a cache is not required to consider such side effects in
  3861. its caching decisions. Caches are always expected to observe an
  3862. origin server's explicit restrictions on caching.
  3863. We note one exception to this rule: since some applications have
  3864. traditionally used GETs and HEADs with query URLs (those containing a
  3865. "?" in the rel_path part) to perform operations with significant side
  3866. effects, caches MUST NOT treat responses to such URIs as fresh unless
  3867. the server provides an explicit expiration time. This specifically
  3868. means that responses from HTTP/1.0 servers for such URIs SHOULD NOT
  3869. be taken from a cache. See section 9.1.1 for related information.
  3870. 13.10 Invalidation After Updates or Deletions
  3871. The effect of certain methods performed on a resource at the origin
  3872. server might cause one or more existing cache entries to become non-
  3873. transparently invalid. That is, although they might continue to be
  3874. "fresh," they do not accurately reflect what the origin server would
  3875. return for a new request on that resource.
  3876. Fielding, et al. Standards Track [Page 97]
  3877. RFC 2616 HTTP/1.1 June 1999
  3878. There is no way for the HTTP protocol to guarantee that all such
  3879. cache entries are marked invalid. For example, the request that
  3880. caused the change at the origin server might not have gone through
  3881. the proxy where a cache entry is stored. However, several rules help
  3882. reduce the likelihood of erroneous behavior.
  3883. In this section, the phrase "invalidate an entity" means that the
  3884. cache will either remove all instances of that entity from its
  3885. storage, or will mark these as "invalid" and in need of a mandatory
  3886. revalidation before they can be returned in response to a subsequent
  3887. request.
  3888. Some HTTP methods MUST cause a cache to invalidate an entity. This is
  3889. either the entity referred to by the Request-URI, or by the Location
  3890. or Content-Location headers (if present). These methods are:
  3891. - PUT
  3892. - DELETE
  3893. - POST
  3894. In order to prevent denial of service attacks, an invalidation based
  3895. on the URI in a Location or Content-Location header MUST only be
  3896. performed if the host part is the same as in the Request-URI.
  3897. A cache that passes through requests for methods it does not
  3898. understand SHOULD invalidate any entities referred to by the
  3899. Request-URI.
  3900. 13.11 Write-Through Mandatory
  3901. All methods that might be expected to cause modifications to the
  3902. origin server's resources MUST be written through to the origin
  3903. server. This currently includes all methods except for GET and HEAD.
  3904. A cache MUST NOT reply to such a request from a client before having
  3905. transmitted the request to the inbound server, and having received a
  3906. corresponding response from the inbound server. This does not prevent
  3907. a proxy cache from sending a 100 (Continue) response before the
  3908. inbound server has sent its final reply.
  3909. The alternative (known as "write-back" or "copy-back" caching) is not
  3910. allowed in HTTP/1.1, due to the difficulty of providing consistent
  3911. updates and the problems arising from server, cache, or network
  3912. failure prior to write-back.
  3913. Fielding, et al. Standards Track [Page 98]
  3914. RFC 2616 HTTP/1.1 June 1999
  3915. 13.12 Cache Replacement
  3916. If a new cacheable (see sections 14.9.2, 13.2.5, 13.2.6 and 13.8)
  3917. response is received from a resource while any existing responses for
  3918. the same resource are cached, the cache SHOULD use the new response
  3919. to reply to the current request. It MAY insert it into cache storage
  3920. and MAY, if it meets all other requirements, use it to respond to any
  3921. future requests that would previously have caused the old response to
  3922. be returned. If it inserts the new response into cache storage the
  3923. rules in section 13.5.3 apply.
  3924. Note: a new response that has an older Date header value than
  3925. existing cached responses is not cacheable.
  3926. 13.13 History Lists
  3927. User agents often have history mechanisms, such as "Back" buttons and
  3928. history lists, which can be used to redisplay an entity retrieved
  3929. earlier in a session.
  3930. History mechanisms and caches are different. In particular history
  3931. mechanisms SHOULD NOT try to show a semantically transparent view of
  3932. the current state of a resource. Rather, a history mechanism is meant
  3933. to show exactly what the user saw at the time when the resource was
  3934. retrieved.
  3935. By default, an expiration time does not apply to history mechanisms.
  3936. If the entity is still in storage, a history mechanism SHOULD display
  3937. it even if the entity has expired, unless the user has specifically
  3938. configured the agent to refresh expired history documents.
  3939. This is not to be construed to prohibit the history mechanism from
  3940. telling the user that a view might be stale.
  3941. Note: if history list mechanisms unnecessarily prevent users from
  3942. viewing stale resources, this will tend to force service authors
  3943. to avoid using HTTP expiration controls and cache controls when
  3944. they would otherwise like to. Service authors may consider it
  3945. important that users not be presented with error messages or
  3946. warning messages when they use navigation controls (such as BACK)
  3947. to view previously fetched resources. Even though sometimes such
  3948. resources ought not to cached, or ought to expire quickly, user
  3949. interface considerations may force service authors to resort to
  3950. other means of preventing caching (e.g. "once-only" URLs) in order
  3951. not to suffer the effects of improperly functioning history
  3952. mechanisms.
  3953. Fielding, et al. Standards Track [Page 99]
  3954. RFC 2616 HTTP/1.1 June 1999
  3955. 14 Header Field Definitions
  3956. This section defines the syntax and semantics of all standard
  3957. HTTP/1.1 header fields. For entity-header fields, both sender and
  3958. recipient refer to either the client or the server, depending on who
  3959. sends and who receives the entity.
  3960. 14.1 Accept
  3961. The Accept request-header field can be used to specify certain media
  3962. types which are acceptable for the response. Accept headers can be
  3963. used to indicate that the request is specifically limited to a small
  3964. set of desired types, as in the case of a request for an in-line
  3965. image.
  3966. Accept = "Accept" ":"
  3967. #( media-range [ accept-params ] )
  3968. media-range = ( "*/*"
  3969. | ( type "/" "*" )
  3970. | ( type "/" subtype )
  3971. ) *( ";" parameter )
  3972. accept-params = ";" "q" "=" qvalue *( accept-extension )
  3973. accept-extension = ";" token [ "=" ( token | quoted-string ) ]
  3974. The asterisk "*" character is used to group media types into ranges,
  3975. with "*/*" indicating all media types and "type/*" indicating all
  3976. subtypes of that type. The media-range MAY include media type
  3977. parameters that are applicable to that range.
  3978. Each media-range MAY be followed by one or more accept-params,
  3979. beginning with the "q" parameter for indicating a relative quality
  3980. factor. The first "q" parameter (if any) separates the media-range
  3981. parameter(s) from the accept-params. Quality factors allow the user
  3982. or user agent to indicate the relative degree of preference for that
  3983. media-range, using the qvalue scale from 0 to 1 (section 3.9). The
  3984. default value is q=1.
  3985. Note: Use of the "q" parameter name to separate media type
  3986. parameters from Accept extension parameters is due to historical
  3987. practice. Although this prevents any media type parameter named
  3988. "q" from being used with a media range, such an event is believed
  3989. to be unlikely given the lack of any "q" parameters in the IANA
  3990. media type registry and the rare usage of any media type
  3991. parameters in Accept. Future media types are discouraged from
  3992. registering any parameter named "q".
  3993. Fielding, et al. Standards Track [Page 100]
  3994. RFC 2616 HTTP/1.1 June 1999
  3995. The example
  3996. Accept: audio/*; q=0.2, audio/basic
  3997. SHOULD be interpreted as "I prefer audio/basic, but send me any audio
  3998. type if it is the best available after an 80% mark-down in quality."
  3999. If no Accept header field is present, then it is assumed that the
  4000. client accepts all media types. If an Accept header field is present,
  4001. and if the server cannot send a response which is acceptable
  4002. according to the combined Accept field value, then the server SHOULD
  4003. send a 406 (not acceptable) response.
  4004. A more elaborate example is
  4005. Accept: text/plain; q=0.5, text/html,
  4006. text/x-dvi; q=0.8, text/x-c
  4007. Verbally, this would be interpreted as "text/html and text/x-c are
  4008. the preferred media types, but if they do not exist, then send the
  4009. text/x-dvi entity, and if that does not exist, send the text/plain
  4010. entity."
  4011. Media ranges can be overridden by more specific media ranges or
  4012. specific media types. If more than one media range applies to a given
  4013. type, the most specific reference has precedence. For example,
  4014. Accept: text/*, text/html, text/html;level=1, */*
  4015. have the following precedence:
  4016. 1) text/html;level=1
  4017. 2) text/html
  4018. 3) text/*
  4019. 4) */*
  4020. The media type quality factor associated with a given type is
  4021. determined by finding the media range with the highest precedence
  4022. which matches that type. For example,
  4023. Accept: text/*;q=0.3, text/html;q=0.7, text/html;level=1,
  4024. text/html;level=2;q=0.4, */*;q=0.5
  4025. would cause the following values to be associated:
  4026. text/html;level=1 = 1
  4027. text/html = 0.7
  4028. text/plain = 0.3
  4029. Fielding, et al. Standards Track [Page 101]
  4030. RFC 2616 HTTP/1.1 June 1999
  4031. image/jpeg = 0.5
  4032. text/html;level=2 = 0.4
  4033. text/html;level=3 = 0.7
  4034. Note: A user agent might be provided with a default set of quality
  4035. values for certain media ranges. However, unless the user agent is
  4036. a closed system which cannot interact with other rendering agents,
  4037. this default set ought to be configurable by the user.
  4038. 14.2 Accept-Charset
  4039. The Accept-Charset request-header field can be used to indicate what
  4040. character sets are acceptable for the response. This field allows
  4041. clients capable of understanding more comprehensive or special-
  4042. purpose character sets to signal that capability to a server which is
  4043. capable of representing documents in those character sets.
  4044. Accept-Charset = "Accept-Charset" ":"
  4045. 1#( ( charset | "*" )[ ";" "q" "=" qvalue ] )
  4046. Character set values are described in section 3.4. Each charset MAY
  4047. be given an associated quality value which represents the user's
  4048. preference for that charset. The default value is q=1. An example is
  4049. Accept-Charset: iso-8859-5, unicode-1-1;q=0.8
  4050. The special value "*", if present in the Accept-Charset field,
  4051. matches every character set (including ISO-8859-1) which is not
  4052. mentioned elsewhere in the Accept-Charset field. If no "*" is present
  4053. in an Accept-Charset field, then all character sets not explicitly
  4054. mentioned get a quality value of 0, except for ISO-8859-1, which gets
  4055. a quality value of 1 if not explicitly mentioned.
  4056. If no Accept-Charset header is present, the default is that any
  4057. character set is acceptable. If an Accept-Charset header is present,
  4058. and if the server cannot send a response which is acceptable
  4059. according to the Accept-Charset header, then the server SHOULD send
  4060. an error response with the 406 (not acceptable) status code, though
  4061. the sending of an unacceptable response is also allowed.
  4062. 14.3 Accept-Encoding
  4063. The Accept-Encoding request-header field is similar to Accept, but
  4064. restricts the content-codings (section 3.5) that are acceptable in
  4065. the response.
  4066. Accept-Encoding = "Accept-Encoding" ":"
  4067. Fielding, et al. Standards Track [Page 102]
  4068. RFC 2616 HTTP/1.1 June 1999
  4069. 1#( codings [ ";" "q" "=" qvalue ] )
  4070. codings = ( content-coding | "*" )
  4071. Examples of its use are:
  4072. Accept-Encoding: compress, gzip
  4073. Accept-Encoding:
  4074. Accept-Encoding: *
  4075. Accept-Encoding: compress;q=0.5, gzip;q=1.0
  4076. Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0
  4077. A server tests whether a content-coding is acceptable, according to
  4078. an Accept-Encoding field, using these rules:
  4079. 1. If the content-coding is one of the content-codings listed in
  4080. the Accept-Encoding field, then it is acceptable, unless it is
  4081. accompanied by a qvalue of 0. (As defined in section 3.9, a
  4082. qvalue of 0 means "not acceptable.")
  4083. 2. The special "*" symbol in an Accept-Encoding field matches any
  4084. available content-coding not explicitly listed in the header
  4085. field.
  4086. 3. If multiple content-codings are acceptable, then the acceptable
  4087. content-coding with the highest non-zero qvalue is preferred.
  4088. 4. The "identity" content-coding is always acceptable, unless
  4089. specifically refused because the Accept-Encoding field includes
  4090. "identity;q=0", or because the field includes "*;q=0" and does
  4091. not explicitly include the "identity" content-coding. If the
  4092. Accept-Encoding field-value is empty, then only the "identity"
  4093. encoding is acceptable.
  4094. If an Accept-Encoding field is present in a request, and if the
  4095. server cannot send a response which is acceptable according to the
  4096. Accept-Encoding header, then the server SHOULD send an error response
  4097. with the 406 (Not Acceptable) status code.
  4098. If no Accept-Encoding field is present in a request, the server MAY
  4099. assume that the client will accept any content coding. In this case,
  4100. if "identity" is one of the available content-codings, then the
  4101. server SHOULD use the "identity" content-coding, unless it has
  4102. additional information that a different content-coding is meaningful
  4103. to the client.
  4104. Note: If the request does not include an Accept-Encoding field,
  4105. and if the "identity" content-coding is unavailable, then
  4106. content-codings commonly understood by HTTP/1.0 clients (i.e.,
  4107. Fielding, et al. Standards Track [Page 103]
  4108. RFC 2616 HTTP/1.1 June 1999
  4109. "gzip" and "compress") are preferred; some older clients
  4110. improperly display messages sent with other content-codings. The
  4111. server might also make this decision based on information about
  4112. the particular user-agent or client.
  4113. Note: Most HTTP/1.0 applications do not recognize or obey qvalues
  4114. associated with content-codings. This means that qvalues will not
  4115. work and are not permitted with x-gzip or x-compress.
  4116. 14.4 Accept-Language
  4117. The Accept-Language request-header field is similar to Accept, but
  4118. restricts the set of natural languages that are preferred as a
  4119. response to the request. Language tags are defined in section 3.10.
  4120. Accept-Language = "Accept-Language" ":"
  4121. 1#( language-range [ ";" "q" "=" qvalue ] )
  4122. language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
  4123. Each language-range MAY be given an associated quality value which
  4124. represents an estimate of the user's preference for the languages
  4125. specified by that range. The quality value defaults to "q=1". For
  4126. example,
  4127. Accept-Language: da, en-gb;q=0.8, en;q=0.7
  4128. would mean: "I prefer Danish, but will accept British English and
  4129. other types of English." A language-range matches a language-tag if
  4130. it exactly equals the tag, or if it exactly equals a prefix of the
  4131. tag such that the first tag character following the prefix is "-".
  4132. The special range "*", if present in the Accept-Language field,
  4133. matches every tag not matched by any other range present in the
  4134. Accept-Language field.
  4135. Note: This use of a prefix matching rule does not imply that
  4136. language tags are assigned to languages in such a way that it is
  4137. always true that if a user understands a language with a certain
  4138. tag, then this user will also understand all languages with tags
  4139. for which this tag is a prefix. The prefix rule simply allows the
  4140. use of prefix tags if this is the case.
  4141. The language quality factor assigned to a language-tag by the
  4142. Accept-Language field is the quality value of the longest language-
  4143. range in the field that matches the language-tag. If no language-
  4144. range in the field matches the tag, the language quality factor
  4145. assigned is 0. If no Accept-Language header is present in the
  4146. request, the server
  4147. Fielding, et al. Standards Track [Page 104]
  4148. RFC 2616 HTTP/1.1 June 1999
  4149. SHOULD assume that all languages are equally acceptable. If an
  4150. Accept-Language header is present, then all languages which are
  4151. assigned a quality factor greater than 0 are acceptable.
  4152. It might be contrary to the privacy expectations of the user to send
  4153. an Accept-Language header with the complete linguistic preferences of
  4154. the user in every request. For a discussion of this issue, see
  4155. section 15.1.4.
  4156. As intelligibility is highly dependent on the individual user, it is
  4157. recommended that client applications make the choice of linguistic
  4158. preference available to the user. If the choice is not made
  4159. available, then the Accept-Language header field MUST NOT be given in
  4160. the request.
  4161. Note: When making the choice of linguistic preference available to
  4162. the user, we remind implementors of the fact that users are not
  4163. familiar with the details of language matching as described above,
  4164. and should provide appropriate guidance. As an example, users
  4165. might assume that on selecting "en-gb", they will be served any
  4166. kind of English document if British English is not available. A
  4167. user agent might suggest in such a case to add "en" to get the
  4168. best matching behavior.
  4169. 14.5 Accept-Ranges
  4170. The Accept-Ranges response-header field allows the server to
  4171. indicate its acceptance of range requests for a resource:
  4172. Accept-Ranges = "Accept-Ranges" ":" acceptable-ranges
  4173. acceptable-ranges = 1#range-unit | "none"
  4174. Origin servers that accept byte-range requests MAY send
  4175. Accept-Ranges: bytes
  4176. but are not required to do so. Clients MAY generate byte-range
  4177. requests without having received this header for the resource
  4178. involved. Range units are defined in section 3.12.
  4179. Servers that do not accept any kind of range request for a
  4180. resource MAY send
  4181. Accept-Ranges: none
  4182. to advise the client not to attempt a range request.
  4183. Fielding, et al. Standards Track [Page 105]
  4184. RFC 2616 HTTP/1.1 June 1999
  4185. 14.6 Age
  4186. The Age response-header field conveys the sender's estimate of the
  4187. amount of time since the response (or its revalidation) was
  4188. generated at the origin server. A cached response is "fresh" if
  4189. its age does not exceed its freshness lifetime. Age values are
  4190. calculated as specified in section 13.2.3.
  4191. Age = "Age" ":" age-value
  4192. age-value = delta-seconds
  4193. Age values are non-negative decimal integers, representing time in
  4194. seconds.
  4195. If a cache receives a value larger than the largest positive
  4196. integer it can represent, or if any of its age calculations
  4197. overflows, it MUST transmit an Age header with a value of
  4198. 2147483648 (2^31). An HTTP/1.1 server that includes a cache MUST
  4199. include an Age header field in every response generated from its
  4200. own cache. Caches SHOULD use an arithmetic type of at least 31
  4201. bits of range.
  4202. 14.7 Allow
  4203. The Allow entity-header field lists the set of methods supported
  4204. by the resource identified by the Request-URI. The purpose of this
  4205. field is strictly to inform the recipient of valid methods
  4206. associated with the resource. An Allow header field MUST be
  4207. present in a 405 (Method Not Allowed) response.
  4208. Allow = "Allow" ":" #Method
  4209. Example of use:
  4210. Allow: GET, HEAD, PUT
  4211. This field cannot prevent a client from trying other methods.
  4212. However, the indications given by the Allow header field value
  4213. SHOULD be followed. The actual set of allowed methods is defined
  4214. by the origin server at the time of each request.
  4215. The Allow header field MAY be provided with a PUT request to
  4216. recommend the methods to be supported by the new or modified
  4217. resource. The server is not required to support these methods and
  4218. SHOULD include an Allow header in the response giving the actual
  4219. supported methods.
  4220. Fielding, et al. Standards Track [Page 106]
  4221. RFC 2616 HTTP/1.1 June 1999
  4222. A proxy MUST NOT modify the Allow header field even if it does not
  4223. understand all the methods specified, since the user agent might
  4224. have other means of communicating with the origin server.
  4225. 14.8 Authorization
  4226. A user agent that wishes to authenticate itself with a server--
  4227. usually, but not necessarily, after receiving a 401 response--does
  4228. so by including an Authorization request-header field with the
  4229. request. The Authorization field value consists of credentials
  4230. containing the authentication information of the user agent for
  4231. the realm of the resource being requested.
  4232. Authorization = "Authorization" ":" credentials
  4233. HTTP access authentication is described in "HTTP Authentication:
  4234. Basic and Digest Access Authentication" [43]. If a request is
  4235. authenticated and a realm specified, the same credentials SHOULD
  4236. be valid for all other requests within this realm (assuming that
  4237. the authentication scheme itself does not require otherwise, such
  4238. as credentials that vary according to a challenge value or using
  4239. synchronized clocks).
  4240. When a shared cache (see section 13.7) receives a request
  4241. containing an Authorization field, it MUST NOT return the
  4242. corresponding response as a reply to any other request, unless one
  4243. of the following specific exceptions holds:
  4244. 1. If the response includes the "s-maxage" cache-control
  4245. directive, the cache MAY use that response in replying to a
  4246. subsequent request. But (if the specified maximum age has
  4247. passed) a proxy cache MUST first revalidate it with the origin
  4248. server, using the request-headers from the new request to allow
  4249. the origin server to authenticate the new request. (This is the
  4250. defined behavior for s-maxage.) If the response includes "s-
  4251. maxage=0", the proxy MUST always revalidate it before re-using
  4252. it.
  4253. 2. If the response includes the "must-revalidate" cache-control
  4254. directive, the cache MAY use that response in replying to a
  4255. subsequent request. But if the response is stale, all caches
  4256. MUST first revalidate it with the origin server, using the
  4257. request-headers from the new request to allow the origin server
  4258. to authenticate the new request.
  4259. 3. If the response includes the "public" cache-control directive,
  4260. it MAY be returned in reply to any subsequent request.
  4261. Fielding, et al. Standards Track [Page 107]
  4262. RFC 2616 HTTP/1.1 June 1999
  4263. 14.9 Cache-Control
  4264. The Cache-Control general-header field is used to specify directives
  4265. that MUST be obeyed by all caching mechanisms along the
  4266. request/response chain. The directives specify behavior intended to
  4267. prevent caches from adversely interfering with the request or
  4268. response. These directives typically override the default caching
  4269. algorithms. Cache directives are unidirectional in that the presence
  4270. of a directive in a request does not imply that the same directive is
  4271. to be given in the response.
  4272. Note that HTTP/1.0 caches might not implement Cache-Control and
  4273. might only implement Pragma: no-cache (see section 14.32).
  4274. Cache directives MUST be passed through by a proxy or gateway
  4275. application, regardless of their significance to that application,
  4276. since the directives might be applicable to all recipients along the
  4277. request/response chain. It is not possible to specify a cache-
  4278. directive for a specific cache.
  4279. Cache-Control = "Cache-Control" ":" 1#cache-directive
  4280. cache-directive = cache-request-directive
  4281. | cache-response-directive
  4282. cache-request-directive =
  4283. "no-cache" ; Section 14.9.1
  4284. | "no-store" ; Section 14.9.2
  4285. | "max-age" "=" delta-seconds ; Section 14.9.3, 14.9.4
  4286. | "max-stale" [ "=" delta-seconds ] ; Section 14.9.3
  4287. | "min-fresh" "=" delta-seconds ; Section 14.9.3
  4288. | "no-transform" ; Section 14.9.5
  4289. | "only-if-cached" ; Section 14.9.4
  4290. | cache-extension ; Section 14.9.6
  4291. cache-response-directive =
  4292. "public" ; Section 14.9.1
  4293. | "private" [ "=" <"> 1#field-name <"> ] ; Section 14.9.1
  4294. | "no-cache" [ "=" <"> 1#field-name <"> ]; Section 14.9.1
  4295. | "no-store" ; Section 14.9.2
  4296. | "no-transform" ; Section 14.9.5
  4297. | "must-revalidate" ; Section 14.9.4
  4298. | "proxy-revalidate" ; Section 14.9.4
  4299. | "max-age" "=" delta-seconds ; Section 14.9.3
  4300. | "s-maxage" "=" delta-seconds ; Section 14.9.3
  4301. | cache-extension ; Section 14.9.6
  4302. cache-extension = token [ "=" ( token | quoted-string ) ]
  4303. Fielding, et al. Standards Track [Page 108]
  4304. RFC 2616 HTTP/1.1 June 1999
  4305. When a directive appears without any 1#field-name parameter, the
  4306. directive applies to the entire request or response. When such a
  4307. directive appears with a 1#field-name parameter, it applies only to
  4308. the named field or fields, and not to the rest of the request or
  4309. response. This mechanism supports extensibility; implementations of
  4310. future versions of the HTTP protocol might apply these directives to
  4311. header fields not defined in HTTP/1.1.
  4312. The cache-control directives can be broken down into these general
  4313. categories:
  4314. - Restrictions on what are cacheable; these may only be imposed by
  4315. the origin server.
  4316. - Restrictions on what may be stored by a cache; these may be
  4317. imposed by either the origin server or the user agent.
  4318. - Modifications of the basic expiration mechanism; these may be
  4319. imposed by either the origin server or the user agent.
  4320. - Controls over cache revalidation and reload; these may only be
  4321. imposed by a user agent.
  4322. - Control over transformation of entities.
  4323. - Extensions to the caching system.
  4324. 14.9.1 What is Cacheable
  4325. By default, a response is cacheable if the requirements of the
  4326. request method, request header fields, and the response status
  4327. indicate that it is cacheable. Section 13.4 summarizes these defaults
  4328. for cacheability. The following Cache-Control response directives
  4329. allow an origin server to override the default cacheability of a
  4330. response:
  4331. public
  4332. Indicates that the response MAY be cached by any cache, even if it
  4333. would normally be non-cacheable or cacheable only within a non-
  4334. shared cache. (See also Authorization, section 14.8, for
  4335. additional details.)
  4336. private
  4337. Indicates that all or part of the response message is intended for
  4338. a single user and MUST NOT be cached by a shared cache. This
  4339. allows an origin server to state that the specified parts of the
  4340. Fielding, et al. Standards Track [Page 109]
  4341. RFC 2616 HTTP/1.1 June 1999
  4342. response are intended for only one user and are not a valid
  4343. response for requests by other users. A private (non-shared) cache
  4344. MAY cache the response.
  4345. Note: This usage of the word private only controls where the
  4346. response may be cached, and cannot ensure the privacy of the
  4347. message content.
  4348. no-cache
  4349. If the no-cache directive does not specify a field-name, then a
  4350. cache MUST NOT use the response to satisfy a subsequent request
  4351. without successful revalidation with the origin server. This
  4352. allows an origin server to prevent caching even by caches that
  4353. have been configured to return stale responses to client requests.
  4354. If the no-cache directive does specify one or more field-names,
  4355. then a cache MAY use the response to satisfy a subsequent request,
  4356. subject to any other restrictions on caching. However, the
  4357. specified field-name(s) MUST NOT be sent in the response to a
  4358. subsequent request without successful revalidation with the origin
  4359. server. This allows an origin server to prevent the re-use of
  4360. certain header fields in a response, while still allowing caching
  4361. of the rest of the response.
  4362. Note: Most HTTP/1.0 caches will not recognize or obey this
  4363. directive.
  4364. 14.9.2 What May be Stored by Caches
  4365. no-store
  4366. The purpose of the no-store directive is to prevent the
  4367. inadvertent release or retention of sensitive information (for
  4368. example, on backup tapes). The no-store directive applies to the
  4369. entire message, and MAY be sent either in a response or in a
  4370. request. If sent in a request, a cache MUST NOT store any part of
  4371. either this request or any response to it. If sent in a response,
  4372. a cache MUST NOT store any part of either this response or the
  4373. request that elicited it. This directive applies to both non-
  4374. shared and shared caches. "MUST NOT store" in this context means
  4375. that the cache MUST NOT intentionally store the information in
  4376. non-volatile storage, and MUST make a best-effort attempt to
  4377. remove the information from volatile storage as promptly as
  4378. possible after forwarding it.
  4379. Even when this directive is associated with a response, users
  4380. might explicitly store such a response outside of the caching
  4381. system (e.g., with a "Save As" dialog). History buffers MAY store
  4382. such responses as part of their normal operation.
  4383. Fielding, et al. Standards Track [Page 110]
  4384. RFC 2616 HTTP/1.1 June 1999
  4385. The purpose of this directive is to meet the stated requirements
  4386. of certain users and service authors who are concerned about
  4387. accidental releases of information via unanticipated accesses to
  4388. cache data structures. While the use of this directive might
  4389. improve privacy in some cases, we caution that it is NOT in any
  4390. way a reliable or sufficient mechanism for ensuring privacy. In
  4391. particular, malicious or compromised caches might not recognize or
  4392. obey this directive, and communications networks might be
  4393. vulnerable to eavesdropping.
  4394. 14.9.3 Modifications of the Basic Expiration Mechanism
  4395. The expiration time of an entity MAY be specified by the origin
  4396. server using the Expires header (see section 14.21). Alternatively,
  4397. it MAY be specified using the max-age directive in a response. When
  4398. the max-age cache-control directive is present in a cached response,
  4399. the response is stale if its current age is greater than the age
  4400. value given (in seconds) at the time of a new request for that
  4401. resource. The max-age directive on a response implies that the
  4402. response is cacheable (i.e., "public") unless some other, more
  4403. restrictive cache directive is also present.
  4404. If a response includes both an Expires header and a max-age
  4405. directive, the max-age directive overrides the Expires header, even
  4406. if the Expires header is more restrictive. This rule allows an origin
  4407. server to provide, for a given response, a longer expiration time to
  4408. an HTTP/1.1 (or later) cache than to an HTTP/1.0 cache. This might be
  4409. useful if certain HTTP/1.0 caches improperly calculate ages or
  4410. expiration times, perhaps due to desynchronized clocks.
  4411. Many HTTP/1.0 cache implementations will treat an Expires value that
  4412. is less than or equal to the response Date value as being equivalent
  4413. to the Cache-Control response directive "no-cache". If an HTTP/1.1
  4414. cache receives such a response, and the response does not include a
  4415. Cache-Control header field, it SHOULD consider the response to be
  4416. non-cacheable in order to retain compatibility with HTTP/1.0 servers.
  4417. Note: An origin server might wish to use a relatively new HTTP
  4418. cache control feature, such as the "private" directive, on a
  4419. network including older caches that do not understand that
  4420. feature. The origin server will need to combine the new feature
  4421. with an Expires field whose value is less than or equal to the
  4422. Date value. This will prevent older caches from improperly
  4423. caching the response.
  4424. Fielding, et al. Standards Track [Page 111]
  4425. RFC 2616 HTTP/1.1 June 1999
  4426. s-maxage
  4427. If a response includes an s-maxage directive, then for a shared
  4428. cache (but not for a private cache), the maximum age specified by
  4429. this directive overrides the maximum age specified by either the
  4430. max-age directive or the Expires header. The s-maxage directive
  4431. also implies the semantics of the proxy-revalidate directive (see
  4432. section 14.9.4), i.e., that the shared cache must not use the
  4433. entry after it becomes stale to respond to a subsequent request
  4434. without first revalidating it with the origin server. The s-
  4435. maxage directive is always ignored by a private cache.
  4436. Note that most older caches, not compliant with this specification,
  4437. do not implement any cache-control directives. An origin server
  4438. wishing to use a cache-control directive that restricts, but does not
  4439. prevent, caching by an HTTP/1.1-compliant cache MAY exploit the
  4440. requirement that the max-age directive overrides the Expires header,
  4441. and the fact that pre-HTTP/1.1-compliant caches do not observe the
  4442. max-age directive.
  4443. Other directives allow a user agent to modify the basic expiration
  4444. mechanism. These directives MAY be specified on a request:
  4445. max-age
  4446. Indicates that the client is willing to accept a response whose
  4447. age is no greater than the specified time in seconds. Unless max-
  4448. stale directive is also included, the client is not willing to
  4449. accept a stale response.
  4450. min-fresh
  4451. Indicates that the client is willing to accept a response whose
  4452. freshness lifetime is no less than its current age plus the
  4453. specified time in seconds. That is, the client wants a response
  4454. that will still be fresh for at least the specified number of
  4455. seconds.
  4456. max-stale
  4457. Indicates that the client is willing to accept a response that has
  4458. exceeded its expiration time. If max-stale is assigned a value,
  4459. then the client is willing to accept a response that has exceeded
  4460. its expiration time by no more than the specified number of
  4461. seconds. If no value is assigned to max-stale, then the client is
  4462. willing to accept a stale response of any age.
  4463. If a cache returns a stale response, either because of a max-stale
  4464. directive on a request, or because the cache is configured to
  4465. override the expiration time of a response, the cache MUST attach a
  4466. Warning header to the stale response, using Warning 110 (Response is
  4467. stale).
  4468. Fielding, et al. Standards Track [Page 112]
  4469. RFC 2616 HTTP/1.1 June 1999
  4470. A cache MAY be configured to return stale responses without
  4471. validation, but only if this does not conflict with any "MUST"-level
  4472. requirements concerning cache validation (e.g., a "must-revalidate"
  4473. cache-control directive).
  4474. If both the new request and the cached entry include "max-age"
  4475. directives, then the lesser of the two values is used for determining
  4476. the freshness of the cached entry for that request.
  4477. 14.9.4 Cache Revalidation and Reload Controls
  4478. Sometimes a user agent might want or need to insist that a cache
  4479. revalidate its cache entry with the origin server (and not just with
  4480. the next cache along the path to the origin server), or to reload its
  4481. cache entry from the origin server. End-to-end revalidation might be
  4482. necessary if either the cache or the origin server has overestimated
  4483. the expiration time of the cached response. End-to-end reload may be
  4484. necessary if the cache entry has become corrupted for some reason.
  4485. End-to-end revalidation may be requested either when the client does
  4486. not have its own local cached copy, in which case we call it
  4487. "unspecified end-to-end revalidation", or when the client does have a
  4488. local cached copy, in which case we call it "specific end-to-end
  4489. revalidation."
  4490. The client can specify these three kinds of action using Cache-
  4491. Control request directives:
  4492. End-to-end reload
  4493. The request includes a "no-cache" cache-control directive or, for
  4494. compatibility with HTTP/1.0 clients, "Pragma: no-cache". Field
  4495. names MUST NOT be included with the no-cache directive in a
  4496. request. The server MUST NOT use a cached copy when responding to
  4497. such a request.
  4498. Specific end-to-end revalidation
  4499. The request includes a "max-age=0" cache-control directive, which
  4500. forces each cache along the path to the origin server to
  4501. revalidate its own entry, if any, with the next cache or server.
  4502. The initial request includes a cache-validating conditional with
  4503. the client's current validator.
  4504. Unspecified end-to-end revalidation
  4505. The request includes "max-age=0" cache-control directive, which
  4506. forces each cache along the path to the origin server to
  4507. revalidate its own entry, if any, with the next cache or server.
  4508. The initial request does not include a cache-validating
  4509. Fielding, et al. Standards Track [Page 113]
  4510. RFC 2616 HTTP/1.1 June 1999
  4511. conditional; the first cache along the path (if any) that holds a
  4512. cache entry for this resource includes a cache-validating
  4513. conditional with its current validator.
  4514. max-age
  4515. When an intermediate cache is forced, by means of a max-age=0
  4516. directive, to revalidate its own cache entry, and the client has
  4517. supplied its own validator in the request, the supplied validator
  4518. might differ from the validator currently stored with the cache
  4519. entry. In this case, the cache MAY use either validator in making
  4520. its own request without affecting semantic transparency.
  4521. However, the choice of validator might affect performance. The
  4522. best approach is for the intermediate cache to use its own
  4523. validator when making its request. If the server replies with 304
  4524. (Not Modified), then the cache can return its now validated copy
  4525. to the client with a 200 (OK) response. If the server replies with
  4526. a new entity and cache validator, however, the intermediate cache
  4527. can compare the returned validator with the one provided in the
  4528. client's request, using the strong comparison function. If the
  4529. client's validator is equal to the origin server's, then the
  4530. intermediate cache simply returns 304 (Not Modified). Otherwise,
  4531. it returns the new entity with a 200 (OK) response.
  4532. If a request includes the no-cache directive, it SHOULD NOT
  4533. include min-fresh, max-stale, or max-age.
  4534. only-if-cached
  4535. In some cases, such as times of extremely poor network
  4536. connectivity, a client may want a cache to return only those
  4537. responses that it currently has stored, and not to reload or
  4538. revalidate with the origin server. To do this, the client may
  4539. include the only-if-cached directive in a request. If it receives
  4540. this directive, a cache SHOULD either respond using a cached entry
  4541. that is consistent with the other constraints of the request, or
  4542. respond with a 504 (Gateway Timeout) status. However, if a group
  4543. of caches is being operated as a unified system with good internal
  4544. connectivity, such a request MAY be forwarded within that group of
  4545. caches.
  4546. must-revalidate
  4547. Because a cache MAY be configured to ignore a server's specified
  4548. expiration time, and because a client request MAY include a max-
  4549. stale directive (which has a similar effect), the protocol also
  4550. includes a mechanism for the origin server to require revalidation
  4551. of a cache entry on any subsequent use. When the must-revalidate
  4552. directive is present in a response received by a cache, that cache
  4553. MUST NOT use the entry after it becomes stale to respond to a
  4554. Fielding, et al. Standards Track [Page 114]
  4555. RFC 2616 HTTP/1.1 June 1999
  4556. subsequent request without first revalidating it with the origin
  4557. server. (I.e., the cache MUST do an end-to-end revalidation every
  4558. time, if, based solely on the origin server's Expires or max-age
  4559. value, the cached response is stale.)
  4560. The must-revalidate directive is necessary to support reliable
  4561. operation for certain protocol features. In all circumstances an
  4562. HTTP/1.1 cache MUST obey the must-revalidate directive; in
  4563. particular, if the cache cannot reach the origin server for any
  4564. reason, it MUST generate a 504 (Gateway Timeout) response.
  4565. Servers SHOULD send the must-revalidate directive if and only if
  4566. failure to revalidate a request on the entity could result in
  4567. incorrect operation, such as a silently unexecuted financial
  4568. transaction. Recipients MUST NOT take any automated action that
  4569. violates this directive, and MUST NOT automatically provide an
  4570. unvalidated copy of the entity if revalidation fails.
  4571. Although this is not recommended, user agents operating under
  4572. severe connectivity constraints MAY violate this directive but, if
  4573. so, MUST explicitly warn the user that an unvalidated response has
  4574. been provided. The warning MUST be provided on each unvalidated
  4575. access, and SHOULD require explicit user confirmation.
  4576. proxy-revalidate
  4577. The proxy-revalidate directive has the same meaning as the must-
  4578. revalidate directive, except that it does not apply to non-shared
  4579. user agent caches. It can be used on a response to an
  4580. authenticated request to permit the user's cache to store and
  4581. later return the response without needing to revalidate it (since
  4582. it has already been authenticated once by that user), while still
  4583. requiring proxies that service many users to revalidate each time
  4584. (in order to make sure that each user has been authenticated).
  4585. Note that such authenticated responses also need the public cache
  4586. control directive in order to allow them to be cached at all.
  4587. 14.9.5 No-Transform Directive
  4588. no-transform
  4589. Implementors of intermediate caches (proxies) have found it useful
  4590. to convert the media type of certain entity bodies. A non-
  4591. transparent proxy might, for example, convert between image
  4592. formats in order to save cache space or to reduce the amount of
  4593. traffic on a slow link.
  4594. Serious operational problems occur, however, when these
  4595. transformations are applied to entity bodies intended for certain
  4596. kinds of applications. For example, applications for medical
  4597. Fielding, et al. Standards Track [Page 115]
  4598. RFC 2616 HTTP/1.1 June 1999
  4599. imaging, scientific data analysis and those using end-to-end
  4600. authentication, all depend on receiving an entity body that is bit
  4601. for bit identical to the original entity-body.
  4602. Therefore, if a message includes the no-transform directive, an
  4603. intermediate cache or proxy MUST NOT change those headers that are
  4604. listed in section 13.5.2 as being subject to the no-transform
  4605. directive. This implies that the cache or proxy MUST NOT change
  4606. any aspect of the entity-body that is specified by these headers,
  4607. including the value of the entity-body itself.
  4608. 14.9.6 Cache Control Extensions
  4609. The Cache-Control header field can be extended through the use of one
  4610. or more cache-extension tokens, each with an optional assigned value.
  4611. Informational extensions (those which do not require a change in
  4612. cache behavior) MAY be added without changing the semantics of other
  4613. directives. Behavioral extensions are designed to work by acting as
  4614. modifiers to the existing base of cache directives. Both the new
  4615. directive and the standard directive are supplied, such that
  4616. applications which do not understand the new directive will default
  4617. to the behavior specified by the standard directive, and those that
  4618. understand the new directive will recognize it as modifying the
  4619. requirements associated with the standard directive. In this way,
  4620. extensions to the cache-control directives can be made without
  4621. requiring changes to the base protocol.
  4622. This extension mechanism depends on an HTTP cache obeying all of the
  4623. cache-control directives defined for its native HTTP-version, obeying
  4624. certain extensions, and ignoring all directives that it does not
  4625. understand.
  4626. For example, consider a hypothetical new response directive called
  4627. community which acts as a modifier to the private directive. We
  4628. define this new directive to mean that, in addition to any non-shared
  4629. cache, any cache which is shared only by members of the community
  4630. named within its value may cache the response. An origin server
  4631. wishing to allow the UCI community to use an otherwise private
  4632. response in their shared cache(s) could do so by including
  4633. Cache-Control: private, community="UCI"
  4634. A cache seeing this header field will act correctly even if the cache
  4635. does not understand the community cache-extension, since it will also
  4636. see and understand the private directive and thus default to the safe
  4637. behavior.
  4638. Fielding, et al. Standards Track [Page 116]
  4639. RFC 2616 HTTP/1.1 June 1999
  4640. Unrecognized cache-directives MUST be ignored; it is assumed that any
  4641. cache-directive likely to be unrecognized by an HTTP/1.1 cache will
  4642. be combined with standard directives (or the response's default
  4643. cacheability) such that the cache behavior will remain minimally
  4644. correct even if the cache does not understand the extension(s).
  4645. 14.10 Connection
  4646. The Connection general-header field allows the sender to specify
  4647. options that are desired for that particular connection and MUST NOT
  4648. be communicated by proxies over further connections.
  4649. The Connection header has the following grammar:
  4650. Connection = "Connection" ":" 1#(connection-token)
  4651. connection-token = token
  4652. HTTP/1.1 proxies MUST parse the Connection header field before a
  4653. message is forwarded and, for each connection-token in this field,
  4654. remove any header field(s) from the message with the same name as the
  4655. connection-token. Connection options are signaled by the presence of
  4656. a connection-token in the Connection header field, not by any
  4657. corresponding additional header field(s), since the additional header
  4658. field may not be sent if there are no parameters associated with that
  4659. connection option.
  4660. Message headers listed in the Connection header MUST NOT include
  4661. end-to-end headers, such as Cache-Control.
  4662. HTTP/1.1 defines the "close" connection option for the sender to
  4663. signal that the connection will be closed after completion of the
  4664. response. For example,
  4665. Connection: close
  4666. in either the request or the response header fields indicates that
  4667. the connection SHOULD NOT be considered `persistent' (section 8.1)
  4668. after the current request/response is complete.
  4669. HTTP/1.1 applications that do not support persistent connections MUST
  4670. include the "close" connection option in every message.
  4671. A system receiving an HTTP/1.0 (or lower-version) message that
  4672. includes a Connection header MUST, for each connection-token in this
  4673. field, remove and ignore any header field(s) from the message with
  4674. the same name as the connection-token. This protects against mistaken
  4675. forwarding of such header fields by pre-HTTP/1.1 proxies. See section
  4676. 19.6.2.
  4677. Fielding, et al. Standards Track [Page 117]
  4678. RFC 2616 HTTP/1.1 June 1999
  4679. 14.11 Content-Encoding
  4680. The Content-Encoding entity-header field is used as a modifier to the
  4681. media-type. When present, its value indicates what additional content
  4682. codings have been applied to the entity-body, and thus what decoding
  4683. mechanisms must be applied in order to obtain the media-type
  4684. referenced by the Content-Type header field. Content-Encoding is
  4685. primarily used to allow a document to be compressed without losing
  4686. the identity of its underlying media type.
  4687. Content-Encoding = "Content-Encoding" ":" 1#content-coding
  4688. Content codings are defined in section 3.5. An example of its use is
  4689. Content-Encoding: gzip
  4690. The content-coding is a characteristic of the entity identified by
  4691. the Request-URI. Typically, the entity-body is stored with this
  4692. encoding and is only decoded before rendering or analogous usage.
  4693. However, a non-transparent proxy MAY modify the content-coding if the
  4694. new coding is known to be acceptable to the recipient, unless the
  4695. "no-transform" cache-control directive is present in the message.
  4696. If the content-coding of an entity is not "identity", then the
  4697. response MUST include a Content-Encoding entity-header (section
  4698. 14.11) that lists the non-identity content-coding(s) used.
  4699. If the content-coding of an entity in a request message is not
  4700. acceptable to the origin server, the server SHOULD respond with a
  4701. status code of 415 (Unsupported Media Type).
  4702. If multiple encodings have been applied to an entity, the content
  4703. codings MUST be listed in the order in which they were applied.
  4704. Additional information about the encoding parameters MAY be provided
  4705. by other entity-header fields not defined by this specification.
  4706. 14.12 Content-Language
  4707. The Content-Language entity-header field describes the natural
  4708. language(s) of the intended audience for the enclosed entity. Note
  4709. that this might not be equivalent to all the languages used within
  4710. the entity-body.
  4711. Content-Language = "Content-Language" ":" 1#language-tag
  4712. Fielding, et al. Standards Track [Page 118]
  4713. RFC 2616 HTTP/1.1 June 1999
  4714. Language tags are defined in section 3.10. The primary purpose of
  4715. Content-Language is to allow a user to identify and differentiate
  4716. entities according to the user's own preferred language. Thus, if the
  4717. body content is intended only for a Danish-literate audience, the
  4718. appropriate field is
  4719. Content-Language: da
  4720. If no Content-Language is specified, the default is that the content
  4721. is intended for all language audiences. This might mean that the
  4722. sender does not consider it to be specific to any natural language,
  4723. or that the sender does not know for which language it is intended.
  4724. Multiple languages MAY be listed for content that is intended for
  4725. multiple audiences. For example, a rendition of the "Treaty of
  4726. Waitangi," presented simultaneously in the original Maori and English
  4727. versions, would call for
  4728. Content-Language: mi, en
  4729. However, just because multiple languages are present within an entity
  4730. does not mean that it is intended for multiple linguistic audiences.
  4731. An example would be a beginner's language primer, such as "A First
  4732. Lesson in Latin," which is clearly intended to be used by an
  4733. English-literate audience. In this case, the Content-Language would
  4734. properly only include "en".
  4735. Content-Language MAY be applied to any media type -- it is not
  4736. limited to textual documents.
  4737. 14.13 Content-Length
  4738. The Content-Length entity-header field indicates the size of the
  4739. entity-body, in decimal number of OCTETs, sent to the recipient or,
  4740. in the case of the HEAD method, the size of the entity-body that
  4741. would have been sent had the request been a GET.
  4742. Content-Length = "Content-Length" ":" 1*DIGIT
  4743. An example is
  4744. Content-Length: 3495
  4745. Applications SHOULD use this field to indicate the transfer-length of
  4746. the message-body, unless this is prohibited by the rules in section
  4747. 4.4.
  4748. Fielding, et al. Standards Track [Page 119]
  4749. RFC 2616 HTTP/1.1 June 1999
  4750. Any Content-Length greater than or equal to zero is a valid value.
  4751. Section 4.4 describes how to determine the length of a message-body
  4752. if a Content-Length is not given.
  4753. Note that the meaning of this field is significantly different from
  4754. the corresponding definition in MIME, where it is an optional field
  4755. used within the "message/external-body" content-type. In HTTP, it
  4756. SHOULD be sent whenever the message's length can be determined prior
  4757. to being transferred, unless this is prohibited by the rules in
  4758. section 4.4.
  4759. 14.14 Content-Location
  4760. The Content-Location entity-header field MAY be used to supply the
  4761. resource location for the entity enclosed in the message when that
  4762. entity is accessible from a location separate from the requested
  4763. resource's URI. A server SHOULD provide a Content-Location for the
  4764. variant corresponding to the response entity; especially in the case
  4765. where a resource has multiple entities associated with it, and those
  4766. entities actually have separate locations by which they might be
  4767. individually accessed, the server SHOULD provide a Content-Location
  4768. for the particular variant which is returned.
  4769. Content-Location = "Content-Location" ":"
  4770. ( absoluteURI | relativeURI )
  4771. The value of Content-Location also defines the base URI for the
  4772. entity.
  4773. The Content-Location value is not a replacement for the original
  4774. requested URI; it is only a statement of the location of the resource
  4775. corresponding to this particular entity at the time of the request.
  4776. Future requests MAY specify the Content-Location URI as the request-
  4777. URI if the desire is to identify the source of that particular
  4778. entity.
  4779. A cache cannot assume that an entity with a Content-Location
  4780. different from the URI used to retrieve it can be used to respond to
  4781. later requests on that Content-Location URI. However, the Content-
  4782. Location can be used to differentiate between multiple entities
  4783. retrieved from a single requested resource, as described in section
  4784. 13.6.
  4785. If the Content-Location is a relative URI, the relative URI is
  4786. interpreted relative to the Request-URI.
  4787. The meaning of the Content-Location header in PUT or POST requests is
  4788. undefined; servers are free to ignore it in those cases.
  4789. Fielding, et al. Standards Track [Page 120]
  4790. RFC 2616 HTTP/1.1 June 1999
  4791. 14.15 Content-MD5
  4792. The Content-MD5 entity-header field, as defined in RFC 1864 [23], is
  4793. an MD5 digest of the entity-body for the purpose of providing an
  4794. end-to-end message integrity check (MIC) of the entity-body. (Note: a
  4795. MIC is good for detecting accidental modification of the entity-body
  4796. in transit, but is not proof against malicious attacks.)
  4797. Content-MD5 = "Content-MD5" ":" md5-digest
  4798. md5-digest = <base64 of 128 bit MD5 digest as per RFC 1864>
  4799. The Content-MD5 header field MAY be generated by an origin server or
  4800. client to function as an integrity check of the entity-body. Only
  4801. origin servers or clients MAY generate the Content-MD5 header field;
  4802. proxies and gateways MUST NOT generate it, as this would defeat its
  4803. value as an end-to-end integrity check. Any recipient of the entity-
  4804. body, including gateways and proxies, MAY check that the digest value
  4805. in this header field matches that of the entity-body as received.
  4806. The MD5 digest is computed based on the content of the entity-body,
  4807. including any content-coding that has been applied, but not including
  4808. any transfer-encoding applied to the message-body. If the message is
  4809. received with a transfer-encoding, that encoding MUST be removed
  4810. prior to checking the Content-MD5 value against the received entity.
  4811. This has the result that the digest is computed on the octets of the
  4812. entity-body exactly as, and in the order that, they would be sent if
  4813. no transfer-encoding were being applied.
  4814. HTTP extends RFC 1864 to permit the digest to be computed for MIME
  4815. composite media-types (e.g., multipart/* and message/rfc822), but
  4816. this does not change how the digest is computed as defined in the
  4817. preceding paragraph.
  4818. There are several consequences of this. The entity-body for composite
  4819. types MAY contain many body-parts, each with its own MIME and HTTP
  4820. headers (including Content-MD5, Content-Transfer-Encoding, and
  4821. Content-Encoding headers). If a body-part has a Content-Transfer-
  4822. Encoding or Content-Encoding header, it is assumed that the content
  4823. of the body-part has had the encoding applied, and the body-part is
  4824. included in the Content-MD5 digest as is -- i.e., after the
  4825. application. The Transfer-Encoding header field is not allowed within
  4826. body-parts.
  4827. Conversion of all line breaks to CRLF MUST NOT be done before
  4828. computing or checking the digest: the line break convention used in
  4829. the text actually transmitted MUST be left unaltered when computing
  4830. the digest.
  4831. Fielding, et al. Standards Track [Page 121]
  4832. RFC 2616 HTTP/1.1 June 1999
  4833. Note: while the definition of Content-MD5 is exactly the same for
  4834. HTTP as in RFC 1864 for MIME entity-bodies, there are several ways
  4835. in which the application of Content-MD5 to HTTP entity-bodies
  4836. differs from its application to MIME entity-bodies. One is that
  4837. HTTP, unlike MIME, does not use Content-Transfer-Encoding, and
  4838. does use Transfer-Encoding and Content-Encoding. Another is that
  4839. HTTP more frequently uses binary content types than MIME, so it is
  4840. worth noting that, in such cases, the byte order used to compute
  4841. the digest is the transmission byte order defined for the type.
  4842. Lastly, HTTP allows transmission of text types with any of several
  4843. line break conventions and not just the canonical form using CRLF.
  4844. 14.16 Content-Range
  4845. The Content-Range entity-header is sent with a partial entity-body to
  4846. specify where in the full entity-body the partial body should be
  4847. applied. Range units are defined in section 3.12.
  4848. Content-Range = "Content-Range" ":" content-range-spec
  4849. content-range-spec = byte-content-range-spec
  4850. byte-content-range-spec = bytes-unit SP
  4851. byte-range-resp-spec "/"
  4852. ( instance-length | "*" )
  4853. byte-range-resp-spec = (first-byte-pos "-" last-byte-pos)
  4854. | "*"
  4855. instance-length = 1*DIGIT
  4856. The header SHOULD indicate the total length of the full entity-body,
  4857. unless this length is unknown or difficult to determine. The asterisk
  4858. "*" character means that the instance-length is unknown at the time
  4859. when the response was generated.
  4860. Unlike byte-ranges-specifier values (see section 14.35.1), a byte-
  4861. range-resp-spec MUST only specify one range, and MUST contain
  4862. absolute byte positions for both the first and last byte of the
  4863. range.
  4864. A byte-content-range-spec with a byte-range-resp-spec whose last-
  4865. byte-pos value is less than its first-byte-pos value, or whose
  4866. instance-length value is less than or equal to its last-byte-pos
  4867. value, is invalid. The recipient of an invalid byte-content-range-
  4868. spec MUST ignore it and any content transferred along with it.
  4869. A server sending a response with status code 416 (Requested range not
  4870. satisfiable) SHOULD include a Content-Range field with a byte-range-
  4871. resp-spec of "*". The instance-length specifies the current length of
  4872. Fielding, et al. Standards Track [Page 122]
  4873. RFC 2616 HTTP/1.1 June 1999
  4874. the selected resource. A response with status code 206 (Partial
  4875. Content) MUST NOT include a Content-Range field with a byte-range-
  4876. resp-spec of "*".
  4877. Examples of byte-content-range-spec values, assuming that the entity
  4878. contains a total of 1234 bytes:
  4879. . The first 500 bytes:
  4880. bytes 0-499/1234
  4881. . The second 500 bytes:
  4882. bytes 500-999/1234
  4883. . All except for the first 500 bytes:
  4884. bytes 500-1233/1234
  4885. . The last 500 bytes:
  4886. bytes 734-1233/1234
  4887. When an HTTP message includes the content of a single range (for
  4888. example, a response to a request for a single range, or to a request
  4889. for a set of ranges that overlap without any holes), this content is
  4890. transmitted with a Content-Range header, and a Content-Length header
  4891. showing the number of bytes actually transferred. For example,
  4892. HTTP/1.1 206 Partial content
  4893. Date: Wed, 15 Nov 1995 06:25:24 GMT
  4894. Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
  4895. Content-Range: bytes 21010-47021/47022
  4896. Content-Length: 26012
  4897. Content-Type: image/gif
  4898. When an HTTP message includes the content of multiple ranges (for
  4899. example, a response to a request for multiple non-overlapping
  4900. ranges), these are transmitted as a multipart message. The multipart
  4901. media type used for this purpose is "multipart/byteranges" as defined
  4902. in appendix 19.2. See appendix 19.6.3 for a compatibility issue.
  4903. A response to a request for a single range MUST NOT be sent using the
  4904. multipart/byteranges media type. A response to a request for
  4905. multiple ranges, whose result is a single range, MAY be sent as a
  4906. multipart/byteranges media type with one part. A client that cannot
  4907. decode a multipart/byteranges message MUST NOT ask for multiple
  4908. byte-ranges in a single request.
  4909. When a client requests multiple byte-ranges in one request, the
  4910. server SHOULD return them in the order that they appeared in the
  4911. request.
  4912. Fielding, et al. Standards Track [Page 123]
  4913. RFC 2616 HTTP/1.1 June 1999
  4914. If the server ignores a byte-range-spec because it is syntactically
  4915. invalid, the server SHOULD treat the request as if the invalid Range
  4916. header field did not exist. (Normally, this means return a 200
  4917. response containing the full entity).
  4918. If the server receives a request (other than one including an If-
  4919. Range request-header field) with an unsatisfiable Range request-
  4920. header field (that is, all of whose byte-range-spec values have a
  4921. first-byte-pos value greater than the current length of the selected
  4922. resource), it SHOULD return a response code of 416 (Requested range
  4923. not satisfiable) (section 10.4.17).
  4924. Note: clients cannot depend on servers to send a 416 (Requested
  4925. range not satisfiable) response instead of a 200 (OK) response for
  4926. an unsatisfiable Range request-header, since not all servers
  4927. implement this request-header.
  4928. 14.17 Content-Type
  4929. The Content-Type entity-header field indicates the media type of the
  4930. entity-body sent to the recipient or, in the case of the HEAD method,
  4931. the media type that would have been sent had the request been a GET.
  4932. Content-Type = "Content-Type" ":" media-type
  4933. Media types are defined in section 3.7. An example of the field is
  4934. Content-Type: text/html; charset=ISO-8859-4
  4935. Further discussion of methods for identifying the media type of an
  4936. entity is provided in section 7.2.1.
  4937. 14.18 Date
  4938. The Date general-header field represents the date and time at which
  4939. the message was originated, having the same semantics as orig-date in
  4940. RFC 822. The field value is an HTTP-date, as described in section
  4941. 3.3.1; it MUST be sent in RFC 1123 [8]-date format.
  4942. Date = "Date" ":" HTTP-date
  4943. An example is
  4944. Date: Tue, 15 Nov 1994 08:12:31 GMT
  4945. Origin servers MUST include a Date header field in all responses,
  4946. except in these cases:
  4947. Fielding, et al. Standards Track [Page 124]
  4948. RFC 2616 HTTP/1.1 June 1999
  4949. 1. If the response status code is 100 (Continue) or 101 (Switching
  4950. Protocols), the response MAY include a Date header field, at
  4951. the server's option.
  4952. 2. If the response status code conveys a server error, e.g. 500
  4953. (Internal Server Error) or 503 (Service Unavailable), and it is
  4954. inconvenient or impossible to generate a valid Date.
  4955. 3. If the server does not have a clock that can provide a
  4956. reasonable approximation of the current time, its responses
  4957. MUST NOT include a Date header field. In this case, the rules
  4958. in section 14.18.1 MUST be followed.
  4959. A received message that does not have a Date header field MUST be
  4960. assigned one by the recipient if the message will be cached by that
  4961. recipient or gatewayed via a protocol which requires a Date. An HTTP
  4962. implementation without a clock MUST NOT cache responses without
  4963. revalidating them on every use. An HTTP cache, especially a shared
  4964. cache, SHOULD use a mechanism, such as NTP [28], to synchronize its
  4965. clock with a reliable external standard.
  4966. Clients SHOULD only send a Date header field in messages that include
  4967. an entity-body, as in the case of the PUT and POST requests, and even
  4968. then it is optional. A client without a clock MUST NOT send a Date
  4969. header field in a request.
  4970. The HTTP-date sent in a Date header SHOULD NOT represent a date and
  4971. time subsequent to the generation of the message. It SHOULD represent
  4972. the best available approximation of the date and time of message
  4973. generation, unless the implementation has no means of generating a
  4974. reasonably accurate date and time. In theory, the date ought to
  4975. represent the moment just before the entity is generated. In
  4976. practice, the date can be generated at any time during the message
  4977. origination without affecting its semantic value.
  4978. 14.18.1 Clockless Origin Server Operation
  4979. Some origin server implementations might not have a clock available.
  4980. An origin server without a clock MUST NOT assign Expires or Last-
  4981. Modified values to a response, unless these values were associated
  4982. with the resource by a system or user with a reliable clock. It MAY
  4983. assign an Expires value that is known, at or before server
  4984. configuration time, to be in the past (this allows "pre-expiration"
  4985. of responses without storing separate Expires values for each
  4986. resource).
  4987. Fielding, et al. Standards Track [Page 125]
  4988. RFC 2616 HTTP/1.1 June 1999
  4989. 14.19 ETag
  4990. The ETag response-header field provides the current value of the
  4991. entity tag for the requested variant. The headers used with entity
  4992. tags are described in sections 14.24, 14.26 and 14.44. The entity tag
  4993. MAY be used for comparison with other entities from the same resource
  4994. (see section 13.3.3).
  4995. ETag = "ETag" ":" entity-tag
  4996. Examples:
  4997. ETag: "xyzzy"
  4998. ETag: W/"xyzzy"
  4999. ETag: ""
  5000. 14.20 Expect
  5001. The Expect request-header field is used to indicate that particular
  5002. server behaviors are required by the client.
  5003. Expect = "Expect" ":" 1#expectation
  5004. expectation = "100-continue" | expectation-extension
  5005. expectation-extension = token [ "=" ( token | quoted-string )
  5006. *expect-params ]
  5007. expect-params = ";" token [ "=" ( token | quoted-string ) ]
  5008. A server that does not understand or is unable to comply with any of
  5009. the expectation values in the Expect field of a request MUST respond
  5010. with appropriate error status. The server MUST respond with a 417
  5011. (Expectation Failed) status if any of the expectations cannot be met
  5012. or, if there are other problems with the request, some other 4xx
  5013. status.
  5014. This header field is defined with extensible syntax to allow for
  5015. future extensions. If a server receives a request containing an
  5016. Expect field that includes an expectation-extension that it does not
  5017. support, it MUST respond with a 417 (Expectation Failed) status.
  5018. Comparison of expectation values is case-insensitive for unquoted
  5019. tokens (including the 100-continue token), and is case-sensitive for
  5020. quoted-string expectation-extensions.
  5021. Fielding, et al. Standards Track [Page 126]
  5022. RFC 2616 HTTP/1.1 June 1999
  5023. The Expect mechanism is hop-by-hop: that is, an HTTP/1.1 proxy MUST
  5024. return a 417 (Expectation Failed) status if it receives a request
  5025. with an expectation that it cannot meet. However, the Expect
  5026. request-header itself is end-to-end; it MUST be forwarded if the
  5027. request is forwarded.
  5028. Many older HTTP/1.0 and HTTP/1.1 applications do not understand the
  5029. Expect header.
  5030. See section 8.2.3 for the use of the 100 (continue) status.
  5031. 14.21 Expires
  5032. The Expires entity-header field gives the date/time after which the
  5033. response is considered stale. A stale cache entry may not normally be
  5034. returned by a cache (either a proxy cache or a user agent cache)
  5035. unless it is first validated with the origin server (or with an
  5036. intermediate cache that has a fresh copy of the entity). See section
  5037. 13.2 for further discussion of the expiration model.
  5038. The presence of an Expires field does not imply that the original
  5039. resource will change or cease to exist at, before, or after that
  5040. time.
  5041. The format is an absolute date and time as defined by HTTP-date in
  5042. section 3.3.1; it MUST be in RFC 1123 date format:
  5043. Expires = "Expires" ":" HTTP-date
  5044. An example of its use is
  5045. Expires: Thu, 01 Dec 1994 16:00:00 GMT
  5046. Note: if a response includes a Cache-Control field with the max-
  5047. age directive (see section 14.9.3), that directive overrides the
  5048. Expires field.
  5049. HTTP/1.1 clients and caches MUST treat other invalid date formats,
  5050. especially including the value "0", as in the past (i.e., "already
  5051. expired").
  5052. To mark a response as "already expired," an origin server sends an
  5053. Expires date that is equal to the Date header value. (See the rules
  5054. for expiration calculations in section 13.2.4.)
  5055. Fielding, et al. Standards Track [Page 127]
  5056. RFC 2616 HTTP/1.1 June 1999
  5057. To mark a response as "never expires," an origin server sends an
  5058. Expires date approximately one year from the time the response is
  5059. sent. HTTP/1.1 servers SHOULD NOT send Expires dates more than one
  5060. year in the future.
  5061. The presence of an Expires header field with a date value of some
  5062. time in the future on a response that otherwise would by default be
  5063. non-cacheable indicates that the response is cacheable, unless
  5064. indicated otherwise by a Cache-Control header field (section 14.9).
  5065. 14.22 From
  5066. The From request-header field, if given, SHOULD contain an Internet
  5067. e-mail address for the human user who controls the requesting user
  5068. agent. The address SHOULD be machine-usable, as defined by "mailbox"
  5069. in RFC 822 [9] as updated by RFC 1123 [8]:
  5070. From = "From" ":" mailbox
  5071. An example is:
  5072. From: webmaster@w3.org
  5073. This header field MAY be used for logging purposes and as a means for
  5074. identifying the source of invalid or unwanted requests. It SHOULD NOT
  5075. be used as an insecure form of access protection. The interpretation
  5076. of this field is that the request is being performed on behalf of the
  5077. person given, who accepts responsibility for the method performed. In
  5078. particular, robot agents SHOULD include this header so that the
  5079. person responsible for running the robot can be contacted if problems
  5080. occur on the receiving end.
  5081. The Internet e-mail address in this field MAY be separate from the
  5082. Internet host which issued the request. For example, when a request
  5083. is passed through a proxy the original issuer's address SHOULD be
  5084. used.
  5085. The client SHOULD NOT send the From header field without the user's
  5086. approval, as it might conflict with the user's privacy interests or
  5087. their site's security policy. It is strongly recommended that the
  5088. user be able to disable, enable, and modify the value of this field
  5089. at any time prior to a request.
  5090. 14.23 Host
  5091. The Host request-header field specifies the Internet host and port
  5092. number of the resource being requested, as obtained from the original
  5093. URI given by the user or referring resource (generally an HTTP URL,
  5094. Fielding, et al. Standards Track [Page 128]
  5095. RFC 2616 HTTP/1.1 June 1999
  5096. as described in section 3.2.2). The Host field value MUST represent
  5097. the naming authority of the origin server or gateway given by the
  5098. original URL. This allows the origin server or gateway to
  5099. differentiate between internally-ambiguous URLs, such as the root "/"
  5100. URL of a server for multiple host names on a single IP address.
  5101. Host = "Host" ":" host [ ":" port ] ; Section 3.2.2
  5102. A "host" without any trailing port information implies the default
  5103. port for the service requested (e.g., "80" for an HTTP URL). For
  5104. example, a request on the origin server for
  5105. <http://www.w3.org/pub/WWW/> would properly include:
  5106. GET /pub/WWW/ HTTP/1.1
  5107. Host: www.w3.org
  5108. A client MUST include a Host header field in all HTTP/1.1 request
  5109. messages . If the requested URI does not include an Internet host
  5110. name for the service being requested, then the Host header field MUST
  5111. be given with an empty value. An HTTP/1.1 proxy MUST ensure that any
  5112. request message it forwards does contain an appropriate Host header
  5113. field that identifies the service being requested by the proxy. All
  5114. Internet-based HTTP/1.1 servers MUST respond with a 400 (Bad Request)
  5115. status code to any HTTP/1.1 request message which lacks a Host header
  5116. field.
  5117. See sections 5.2 and 19.6.1.1 for other requirements relating to
  5118. Host.
  5119. 14.24 If-Match
  5120. The If-Match request-header field is used with a method to make it
  5121. conditional. A client that has one or more entities previously
  5122. obtained from the resource can verify that one of those entities is
  5123. current by including a list of their associated entity tags in the
  5124. If-Match header field. Entity tags are defined in section 3.11. The
  5125. purpose of this feature is to allow efficient updates of cached
  5126. information with a minimum amount of transaction overhead. It is also
  5127. used, on updating requests, to prevent inadvertent modification of
  5128. the wrong version of a resource. As a special case, the value "*"
  5129. matches any current entity of the resource.
  5130. If-Match = "If-Match" ":" ( "*" | 1#entity-tag )
  5131. If any of the entity tags match the entity tag of the entity that
  5132. would have been returned in the response to a similar GET request
  5133. (without the If-Match header) on that resource, or if "*" is given
  5134. Fielding, et al. Standards Track [Page 129]
  5135. RFC 2616 HTTP/1.1 June 1999
  5136. and any current entity exists for that resource, then the server MAY
  5137. perform the requested method as if the If-Match header field did not
  5138. exist.
  5139. A server MUST use the strong comparison function (see section 13.3.3)
  5140. to compare the entity tags in If-Match.
  5141. If none of the entity tags match, or if "*" is given and no current
  5142. entity exists, the server MUST NOT perform the requested method, and
  5143. MUST return a 412 (Precondition Failed) response. This behavior is
  5144. most useful when the client wants to prevent an updating method, such
  5145. as PUT, from modifying a resource that has changed since the client
  5146. last retrieved it.
  5147. If the request would, without the If-Match header field, result in
  5148. anything other than a 2xx or 412 status, then the If-Match header
  5149. MUST be ignored.
  5150. The meaning of "If-Match: *" is that the method SHOULD be performed
  5151. if the representation selected by the origin server (or by a cache,
  5152. possibly using the Vary mechanism, see section 14.44) exists, and
  5153. MUST NOT be performed if the representation does not exist.
  5154. A request intended to update a resource (e.g., a PUT) MAY include an
  5155. If-Match header field to signal that the request method MUST NOT be
  5156. applied if the entity corresponding to the If-Match value (a single
  5157. entity tag) is no longer a representation of that resource. This
  5158. allows the user to indicate that they do not wish the request to be
  5159. successful if the resource has been changed without their knowledge.
  5160. Examples:
  5161. If-Match: "xyzzy"
  5162. If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
  5163. If-Match: *
  5164. The result of a request having both an If-Match header field and
  5165. either an If-None-Match or an If-Modified-Since header fields is
  5166. undefined by this specification.
  5167. 14.25 If-Modified-Since
  5168. The If-Modified-Since request-header field is used with a method to
  5169. make it conditional: if the requested variant has not been modified
  5170. since the time specified in this field, an entity will not be
  5171. returned from the server; instead, a 304 (not modified) response will
  5172. be returned without any message-body.
  5173. If-Modified-Since = "If-Modified-Since" ":" HTTP-date
  5174. Fielding, et al. Standards Track [Page 130]
  5175. RFC 2616 HTTP/1.1 June 1999
  5176. An example of the field is:
  5177. If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
  5178. A GET method with an If-Modified-Since header and no Range header
  5179. requests that the identified entity be transferred only if it has
  5180. been modified since the date given by the If-Modified-Since header.
  5181. The algorithm for determining this includes the following cases:
  5182. a) If the request would normally result in anything other than a
  5183. 200 (OK) status, or if the passed If-Modified-Since date is
  5184. invalid, the response is exactly the same as for a normal GET.
  5185. A date which is later than the server's current time is
  5186. invalid.
  5187. b) If the variant has been modified since the If-Modified-Since
  5188. date, the response is exactly the same as for a normal GET.
  5189. c) If the variant has not been modified since a valid If-
  5190. Modified-Since date, the server SHOULD return a 304 (Not
  5191. Modified) response.
  5192. The purpose of this feature is to allow efficient updates of cached
  5193. information with a minimum amount of transaction overhead.
  5194. Note: The Range request-header field modifies the meaning of If-
  5195. Modified-Since; see section 14.35 for full details.
  5196. Note: If-Modified-Since times are interpreted by the server, whose
  5197. clock might not be synchronized with the client.
  5198. Note: When handling an If-Modified-Since header field, some
  5199. servers will use an exact date comparison function, rather than a
  5200. less-than function, for deciding whether to send a 304 (Not
  5201. Modified) response. To get best results when sending an If-
  5202. Modified-Since header field for cache validation, clients are
  5203. advised to use the exact date string received in a previous Last-
  5204. Modified header field whenever possible.
  5205. Note: If a client uses an arbitrary date in the If-Modified-Since
  5206. header instead of a date taken from the Last-Modified header for
  5207. the same request, the client should be aware of the fact that this
  5208. date is interpreted in the server's understanding of time. The
  5209. client should consider unsynchronized clocks and rounding problems
  5210. due to the different encodings of time between the client and
  5211. server. This includes the possibility of race conditions if the
  5212. document has changed between the time it was first requested and
  5213. the If-Modified-Since date of a subsequent request, and the
  5214. Fielding, et al. Standards Track [Page 131]
  5215. RFC 2616 HTTP/1.1 June 1999
  5216. possibility of clock-skew-related problems if the If-Modified-
  5217. Since date is derived from the client's clock without correction
  5218. to the server's clock. Corrections for different time bases
  5219. between client and server are at best approximate due to network
  5220. latency.
  5221. The result of a request having both an If-Modified-Since header field
  5222. and either an If-Match or an If-Unmodified-Since header fields is
  5223. undefined by this specification.
  5224. 14.26 If-None-Match
  5225. The If-None-Match request-header field is used with a method to make
  5226. it conditional. A client that has one or more entities previously
  5227. obtained from the resource can verify that none of those entities is
  5228. current by including a list of their associated entity tags in the
  5229. If-None-Match header field. The purpose of this feature is to allow
  5230. efficient updates of cached information with a minimum amount of
  5231. transaction overhead. It is also used to prevent a method (e.g. PUT)
  5232. from inadvertently modifying an existing resource when the client
  5233. believes that the resource does not exist.
  5234. As a special case, the value "*" matches any current entity of the
  5235. resource.
  5236. If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag )
  5237. If any of the entity tags match the entity tag of the entity that
  5238. would have been returned in the response to a similar GET request
  5239. (without the If-None-Match header) on that resource, or if "*" is
  5240. given and any current entity exists for that resource, then the
  5241. server MUST NOT perform the requested method, unless required to do
  5242. so because the resource's modification date fails to match that
  5243. supplied in an If-Modified-Since header field in the request.
  5244. Instead, if the request method was GET or HEAD, the server SHOULD
  5245. respond with a 304 (Not Modified) response, including the cache-
  5246. related header fields (particularly ETag) of one of the entities that
  5247. matched. For all other request methods, the server MUST respond with
  5248. a status of 412 (Precondition Failed).
  5249. See section 13.3.3 for rules on how to determine if two entities tags
  5250. match. The weak comparison function can only be used with GET or HEAD
  5251. requests.
  5252. Fielding, et al. Standards Track [Page 132]
  5253. RFC 2616 HTTP/1.1 June 1999
  5254. If none of the entity tags match, then the server MAY perform the
  5255. requested method as if the If-None-Match header field did not exist,
  5256. but MUST also ignore any If-Modified-Since header field(s) in the
  5257. request. That is, if no entity tags match, then the server MUST NOT
  5258. return a 304 (Not Modified) response.
  5259. If the request would, without the If-None-Match header field, result
  5260. in anything other than a 2xx or 304 status, then the If-None-Match
  5261. header MUST be ignored. (See section 13.3.4 for a discussion of
  5262. server behavior when both If-Modified-Since and If-None-Match appear
  5263. in the same request.)
  5264. The meaning of "If-None-Match: *" is that the method MUST NOT be
  5265. performed if the representation selected by the origin server (or by
  5266. a cache, possibly using the Vary mechanism, see section 14.44)
  5267. exists, and SHOULD be performed if the representation does not exist.
  5268. This feature is intended to be useful in preventing races between PUT
  5269. operations.
  5270. Examples:
  5271. If-None-Match: "xyzzy"
  5272. If-None-Match: W/"xyzzy"
  5273. If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
  5274. If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
  5275. If-None-Match: *
  5276. The result of a request having both an If-None-Match header field and
  5277. either an If-Match or an If-Unmodified-Since header fields is
  5278. undefined by this specification.
  5279. 14.27 If-Range
  5280. If a client has a partial copy of an entity in its cache, and wishes
  5281. to have an up-to-date copy of the entire entity in its cache, it
  5282. could use the Range request-header with a conditional GET (using
  5283. either or both of If-Unmodified-Since and If-Match.) However, if the
  5284. condition fails because the entity has been modified, the client
  5285. would then have to make a second request to obtain the entire current
  5286. entity-body.
  5287. The If-Range header allows a client to "short-circuit" the second
  5288. request. Informally, its meaning is `if the entity is unchanged, send
  5289. me the part(s) that I am missing; otherwise, send me the entire new
  5290. entity'.
  5291. If-Range = "If-Range" ":" ( entity-tag | HTTP-date )
  5292. Fielding, et al. Standards Track [Page 133]
  5293. RFC 2616 HTTP/1.1 June 1999
  5294. If the client has no entity tag for an entity, but does have a Last-
  5295. Modified date, it MAY use that date in an If-Range header. (The
  5296. server can distinguish between a valid HTTP-date and any form of
  5297. entity-tag by examining no more than two characters.) The If-Range
  5298. header SHOULD only be used together with a Range header, and MUST be
  5299. ignored if the request does not include a Range header, or if the
  5300. server does not support the sub-range operation.
  5301. If the entity tag given in the If-Range header matches the current
  5302. entity tag for the entity, then the server SHOULD provide the
  5303. specified sub-range of the entity using a 206 (Partial content)
  5304. response. If the entity tag does not match, then the server SHOULD
  5305. return the entire entity using a 200 (OK) response.
  5306. 14.28 If-Unmodified-Since
  5307. The If-Unmodified-Since request-header field is used with a method to
  5308. make it conditional. If the requested resource has not been modified
  5309. since the time specified in this field, the server SHOULD perform the
  5310. requested operation as if the If-Unmodified-Since header were not
  5311. present.
  5312. If the requested variant has been modified since the specified time,
  5313. the server MUST NOT perform the requested operation, and MUST return
  5314. a 412 (Precondition Failed).
  5315. If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
  5316. An example of the field is:
  5317. If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
  5318. If the request normally (i.e., without the If-Unmodified-Since
  5319. header) would result in anything other than a 2xx or 412 status, the
  5320. If-Unmodified-Since header SHOULD be ignored.
  5321. If the specified date is invalid, the header is ignored.
  5322. The result of a request having both an If-Unmodified-Since header
  5323. field and either an If-None-Match or an If-Modified-Since header
  5324. fields is undefined by this specification.
  5325. 14.29 Last-Modified
  5326. The Last-Modified entity-header field indicates the date and time at
  5327. which the origin server believes the variant was last modified.
  5328. Last-Modified = "Last-Modified" ":" HTTP-date
  5329. Fielding, et al. Standards Track [Page 134]
  5330. RFC 2616 HTTP/1.1 June 1999
  5331. An example of its use is
  5332. Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
  5333. The exact meaning of this header field depends on the implementation
  5334. of the origin server and the nature of the original resource. For
  5335. files, it may be just the file system last-modified time. For
  5336. entities with dynamically included parts, it may be the most recent
  5337. of the set of last-modify times for its component parts. For database
  5338. gateways, it may be the last-update time stamp of the record. For
  5339. virtual objects, it may be the last time the internal state changed.
  5340. An origin server MUST NOT send a Last-Modified date which is later
  5341. than the server's time of message origination. In such cases, where
  5342. the resource's last modification would indicate some time in the
  5343. future, the server MUST replace that date with the message
  5344. origination date.
  5345. An origin server SHOULD obtain the Last-Modified value of the entity
  5346. as close as possible to the time that it generates the Date value of
  5347. its response. This allows a recipient to make an accurate assessment
  5348. of the entity's modification time, especially if the entity changes
  5349. near the time that the response is generated.
  5350. HTTP/1.1 servers SHOULD send Last-Modified whenever feasible.
  5351. 14.30 Location
  5352. The Location response-header field is used to redirect the recipient
  5353. to a location other than the Request-URI for completion of the
  5354. request or identification of a new resource. For 201 (Created)
  5355. responses, the Location is that of the new resource which was created
  5356. by the request. For 3xx responses, the location SHOULD indicate the
  5357. server's preferred URI for automatic redirection to the resource. The
  5358. field value consists of a single absolute URI.
  5359. Location = "Location" ":" absoluteURI
  5360. An example is:
  5361. Location: http://www.w3.org/pub/WWW/People.html
  5362. Note: The Content-Location header field (section 14.14) differs
  5363. from Location in that the Content-Location identifies the original
  5364. location of the entity enclosed in the request. It is therefore
  5365. possible for a response to contain header fields for both Location
  5366. and Content-Location. Also see section 13.10 for cache
  5367. requirements of some methods.
  5368. Fielding, et al. Standards Track [Page 135]
  5369. RFC 2616 HTTP/1.1 June 1999
  5370. 14.31 Max-Forwards
  5371. The Max-Forwards request-header field provides a mechanism with the
  5372. TRACE (section 9.8) and OPTIONS (section 9.2) methods to limit the
  5373. number of proxies or gateways that can forward the request to the
  5374. next inbound server. This can be useful when the client is attempting
  5375. to trace a request chain which appears to be failing or looping in
  5376. mid-chain.
  5377. Max-Forwards = "Max-Forwards" ":" 1*DIGIT
  5378. The Max-Forwards value is a decimal integer indicating the remaining
  5379. number of times this request message may be forwarded.
  5380. Each proxy or gateway recipient of a TRACE or OPTIONS request
  5381. containing a Max-Forwards header field MUST check and update its
  5382. value prior to forwarding the request. If the received value is zero
  5383. (0), the recipient MUST NOT forward the request; instead, it MUST
  5384. respond as the final recipient. If the received Max-Forwards value is
  5385. greater than zero, then the forwarded message MUST contain an updated
  5386. Max-Forwards field with a value decremented by one (1).
  5387. The Max-Forwards header field MAY be ignored for all other methods
  5388. defined by this specification and for any extension methods for which
  5389. it is not explicitly referred to as part of that method definition.
  5390. 14.32 Pragma
  5391. The Pragma general-header field is used to include implementation-
  5392. specific directives that might apply to any recipient along the
  5393. request/response chain. All pragma directives specify optional
  5394. behavior from the viewpoint of the protocol; however, some systems
  5395. MAY require that behavior be consistent with the directives.
  5396. Pragma = "Pragma" ":" 1#pragma-directive
  5397. pragma-directive = "no-cache" | extension-pragma
  5398. extension-pragma = token [ "=" ( token | quoted-string ) ]
  5399. When the no-cache directive is present in a request message, an
  5400. application SHOULD forward the request toward the origin server even
  5401. if it has a cached copy of what is being requested. This pragma
  5402. directive has the same semantics as the no-cache cache-directive (see
  5403. section 14.9) and is defined here for backward compatibility with
  5404. HTTP/1.0. Clients SHOULD include both header fields when a no-cache
  5405. request is sent to a server not known to be HTTP/1.1 compliant.
  5406. Fielding, et al. Standards Track [Page 136]
  5407. RFC 2616 HTTP/1.1 June 1999
  5408. Pragma directives MUST be passed through by a proxy or gateway
  5409. application, regardless of their significance to that application,
  5410. since the directives might be applicable to all recipients along the
  5411. request/response chain. It is not possible to specify a pragma for a
  5412. specific recipient; however, any pragma directive not relevant to a
  5413. recipient SHOULD be ignored by that recipient.
  5414. HTTP/1.1 caches SHOULD treat "Pragma: no-cache" as if the client had
  5415. sent "Cache-Control: no-cache". No new Pragma directives will be
  5416. defined in HTTP.
  5417. Note: because the meaning of "Pragma: no-cache as a response
  5418. header field is not actually specified, it does not provide a
  5419. reliable replacement for "Cache-Control: no-cache" in a response
  5420. 14.33 Proxy-Authenticate
  5421. The Proxy-Authenticate response-header field MUST be included as part
  5422. of a 407 (Proxy Authentication Required) response. The field value
  5423. consists of a challenge that indicates the authentication scheme and
  5424. parameters applicable to the proxy for this Request-URI.
  5425. Proxy-Authenticate = "Proxy-Authenticate" ":" 1#challenge
  5426. The HTTP access authentication process is described in "HTTP
  5427. Authentication: Basic and Digest Access Authentication" [43]. Unlike
  5428. WWW-Authenticate, the Proxy-Authenticate header field applies only to
  5429. the current connection and SHOULD NOT be passed on to downstream
  5430. clients. However, an intermediate proxy might need to obtain its own
  5431. credentials by requesting them from the downstream client, which in
  5432. some circumstances will appear as if the proxy is forwarding the
  5433. Proxy-Authenticate header field.
  5434. 14.34 Proxy-Authorization
  5435. The Proxy-Authorization request-header field allows the client to
  5436. identify itself (or its user) to a proxy which requires
  5437. authentication. The Proxy-Authorization field value consists of
  5438. credentials containing the authentication information of the user
  5439. agent for the proxy and/or realm of the resource being requested.
  5440. Proxy-Authorization = "Proxy-Authorization" ":" credentials
  5441. The HTTP access authentication process is described in "HTTP
  5442. Authentication: Basic and Digest Access Authentication" [43] . Unlike
  5443. Authorization, the Proxy-Authorization header field applies only to
  5444. the next outbound proxy that demanded authentication using the Proxy-
  5445. Authenticate field. When multiple proxies are used in a chain, the
  5446. Fielding, et al. Standards Track [Page 137]
  5447. RFC 2616 HTTP/1.1 June 1999
  5448. Proxy-Authorization header field is consumed by the first outbound
  5449. proxy that was expecting to receive credentials. A proxy MAY relay
  5450. the credentials from the client request to the next proxy if that is
  5451. the mechanism by which the proxies cooperatively authenticate a given
  5452. request.
  5453. 14.35 Range
  5454. 14.35.1 Byte Ranges
  5455. Since all HTTP entities are represented in HTTP messages as sequences
  5456. of bytes, the concept of a byte range is meaningful for any HTTP
  5457. entity. (However, not all clients and servers need to support byte-
  5458. range operations.)
  5459. Byte range specifications in HTTP apply to the sequence of bytes in
  5460. the entity-body (not necessarily the same as the message-body).
  5461. A byte range operation MAY specify a single range of bytes, or a set
  5462. of ranges within a single entity.
  5463. ranges-specifier = byte-ranges-specifier
  5464. byte-ranges-specifier = bytes-unit "=" byte-range-set
  5465. byte-range-set = 1#( byte-range-spec | suffix-byte-range-spec )
  5466. byte-range-spec = first-byte-pos "-" [last-byte-pos]
  5467. first-byte-pos = 1*DIGIT
  5468. last-byte-pos = 1*DIGIT
  5469. The first-byte-pos value in a byte-range-spec gives the byte-offset
  5470. of the first byte in a range. The last-byte-pos value gives the
  5471. byte-offset of the last byte in the range; that is, the byte
  5472. positions specified are inclusive. Byte offsets start at zero.
  5473. If the last-byte-pos value is present, it MUST be greater than or
  5474. equal to the first-byte-pos in that byte-range-spec, or the byte-
  5475. range-spec is syntactically invalid. The recipient of a byte-range-
  5476. set that includes one or more syntactically invalid byte-range-spec
  5477. values MUST ignore the header field that includes that byte-range-
  5478. set.
  5479. If the last-byte-pos value is absent, or if the value is greater than
  5480. or equal to the current length of the entity-body, last-byte-pos is
  5481. taken to be equal to one less than the current length of the entity-
  5482. body in bytes.
  5483. By its choice of last-byte-pos, a client can limit the number of
  5484. bytes retrieved without knowing the size of the entity.
  5485. Fielding, et al. Standards Track [Page 138]
  5486. RFC 2616 HTTP/1.1 June 1999
  5487. suffix-byte-range-spec = "-" suffix-length
  5488. suffix-length = 1*DIGIT
  5489. A suffix-byte-range-spec is used to specify the suffix of the
  5490. entity-body, of a length given by the suffix-length value. (That is,
  5491. this form specifies the last N bytes of an entity-body.) If the
  5492. entity is shorter than the specified suffix-length, the entire
  5493. entity-body is used.
  5494. If a syntactically valid byte-range-set includes at least one byte-
  5495. range-spec whose first-byte-pos is less than the current length of
  5496. the entity-body, or at least one suffix-byte-range-spec with a non-
  5497. zero suffix-length, then the byte-range-set is satisfiable.
  5498. Otherwise, the byte-range-set is unsatisfiable. If the byte-range-set
  5499. is unsatisfiable, the server SHOULD return a response with a status
  5500. of 416 (Requested range not satisfiable). Otherwise, the server
  5501. SHOULD return a response with a status of 206 (Partial Content)
  5502. containing the satisfiable ranges of the entity-body.
  5503. Examples of byte-ranges-specifier values (assuming an entity-body of
  5504. length 10000):
  5505. - The first 500 bytes (byte offsets 0-499, inclusive): bytes=0-
  5506. 499
  5507. - The second 500 bytes (byte offsets 500-999, inclusive):
  5508. bytes=500-999
  5509. - The final 500 bytes (byte offsets 9500-9999, inclusive):
  5510. bytes=-500
  5511. - Or bytes=9500-
  5512. - The first and last bytes only (bytes 0 and 9999): bytes=0-0,-1
  5513. - Several legal but not canonical specifications of the second 500
  5514. bytes (byte offsets 500-999, inclusive):
  5515. bytes=500-600,601-999
  5516. bytes=500-700,601-999
  5517. 14.35.2 Range Retrieval Requests
  5518. HTTP retrieval requests using conditional or unconditional GET
  5519. methods MAY request one or more sub-ranges of the entity, instead of
  5520. the entire entity, using the Range request header, which applies to
  5521. the entity returned as the result of the request:
  5522. Range = "Range" ":" ranges-specifier
  5523. Fielding, et al. Standards Track [Page 139]
  5524. RFC 2616 HTTP/1.1 June 1999
  5525. A server MAY ignore the Range header. However, HTTP/1.1 origin
  5526. servers and intermediate caches ought to support byte ranges when
  5527. possible, since Range supports efficient recovery from partially
  5528. failed transfers, and supports efficient partial retrieval of large
  5529. entities.
  5530. If the server supports the Range header and the specified range or
  5531. ranges are appropriate for the entity:
  5532. - The presence of a Range header in an unconditional GET modifies
  5533. what is returned if the GET is otherwise successful. In other
  5534. words, the response carries a status code of 206 (Partial
  5535. Content) instead of 200 (OK).
  5536. - The presence of a Range header in a conditional GET (a request
  5537. using one or both of If-Modified-Since and If-None-Match, or
  5538. one or both of If-Unmodified-Since and If-Match) modifies what
  5539. is returned if the GET is otherwise successful and the
  5540. condition is true. It does not affect the 304 (Not Modified)
  5541. response returned if the conditional is false.
  5542. In some cases, it might be more appropriate to use the If-Range
  5543. header (see section 14.27) in addition to the Range header.
  5544. If a proxy that supports ranges receives a Range request, forwards
  5545. the request to an inbound server, and receives an entire entity in
  5546. reply, it SHOULD only return the requested range to its client. It
  5547. SHOULD store the entire received response in its cache if that is
  5548. consistent with its cache allocation policies.
  5549. 14.36 Referer
  5550. The Referer[sic] request-header field allows the client to specify,
  5551. for the server's benefit, the address (URI) of the resource from
  5552. which the Request-URI was obtained (the "referrer", although the
  5553. header field is misspelled.) The Referer request-header allows a
  5554. server to generate lists of back-links to resources for interest,
  5555. logging, optimized caching, etc. It also allows obsolete or mistyped
  5556. links to be traced for maintenance. The Referer field MUST NOT be
  5557. sent if the Request-URI was obtained from a source that does not have
  5558. its own URI, such as input from the user keyboard.
  5559. Referer = "Referer" ":" ( absoluteURI | relativeURI )
  5560. Example:
  5561. Referer: http://www.w3.org/hypertext/DataSources/Overview.html
  5562. Fielding, et al. Standards Track [Page 140]
  5563. RFC 2616 HTTP/1.1 June 1999
  5564. If the field value is a relative URI, it SHOULD be interpreted
  5565. relative to the Request-URI. The URI MUST NOT include a fragment. See
  5566. section 15.1.3 for security considerations.
  5567. 14.37 Retry-After
  5568. The Retry-After response-header field can be used with a 503 (Service
  5569. Unavailable) response to indicate how long the service is expected to
  5570. be unavailable to the requesting client. This field MAY also be used
  5571. with any 3xx (Redirection) response to indicate the minimum time the
  5572. user-agent is asked wait before issuing the redirected request. The
  5573. value of this field can be either an HTTP-date or an integer number
  5574. of seconds (in decimal) after the time of the response.
  5575. Retry-After = "Retry-After" ":" ( HTTP-date | delta-seconds )
  5576. Two examples of its use are
  5577. Retry-After: Fri, 31 Dec 1999 23:59:59 GMT
  5578. Retry-After: 120
  5579. In the latter example, the delay is 2 minutes.
  5580. 14.38 Server
  5581. The Server response-header field contains information about the
  5582. software used by the origin server to handle the request. The field
  5583. can contain multiple product tokens (section 3.8) and comments
  5584. identifying the server and any significant subproducts. The product
  5585. tokens are listed in order of their significance for identifying the
  5586. application.
  5587. Server = "Server" ":" 1*( product | comment )
  5588. Example:
  5589. Server: CERN/3.0 libwww/2.17
  5590. If the response is being forwarded through a proxy, the proxy
  5591. application MUST NOT modify the Server response-header. Instead, it
  5592. SHOULD include a Via field (as described in section 14.45).
  5593. Note: Revealing the specific software version of the server might
  5594. allow the server machine to become more vulnerable to attacks
  5595. against software that is known to contain security holes. Server
  5596. implementors are encouraged to make this field a configurable
  5597. option.
  5598. Fielding, et al. Standards Track [Page 141]
  5599. RFC 2616 HTTP/1.1 June 1999
  5600. 14.39 TE
  5601. The TE request-header field indicates what extension transfer-codings
  5602. it is willing to accept in the response and whether or not it is
  5603. willing to accept trailer fields in a chunked transfer-coding. Its
  5604. value may consist of the keyword "trailers" and/or a comma-separated
  5605. list of extension transfer-coding names with optional accept
  5606. parameters (as described in section 3.6).
  5607. TE = "TE" ":" #( t-codings )
  5608. t-codings = "trailers" | ( transfer-extension [ accept-params ] )
  5609. The presence of the keyword "trailers" indicates that the client is
  5610. willing to accept trailer fields in a chunked transfer-coding, as
  5611. defined in section 3.6.1. This keyword is reserved for use with
  5612. transfer-coding values even though it does not itself represent a
  5613. transfer-coding.
  5614. Examples of its use are:
  5615. TE: deflate
  5616. TE:
  5617. TE: trailers, deflate;q=0.5
  5618. The TE header field only applies to the immediate connection.
  5619. Therefore, the keyword MUST be supplied within a Connection header
  5620. field (section 14.10) whenever TE is present in an HTTP/1.1 message.
  5621. A server tests whether a transfer-coding is acceptable, according to
  5622. a TE field, using these rules:
  5623. 1. The "chunked" transfer-coding is always acceptable. If the
  5624. keyword "trailers" is listed, the client indicates that it is
  5625. willing to accept trailer fields in the chunked response on
  5626. behalf of itself and any downstream clients. The implication is
  5627. that, if given, the client is stating that either all
  5628. downstream clients are willing to accept trailer fields in the
  5629. forwarded response, or that it will attempt to buffer the
  5630. response on behalf of downstream recipients.
  5631. Note: HTTP/1.1 does not define any means to limit the size of a
  5632. chunked response such that a client can be assured of buffering
  5633. the entire response.
  5634. 2. If the transfer-coding being tested is one of the transfer-
  5635. codings listed in the TE field, then it is acceptable unless it
  5636. is accompanied by a qvalue of 0. (As defined in section 3.9, a
  5637. qvalue of 0 means "not acceptable.")
  5638. Fielding, et al. Standards Track [Page 142]
  5639. RFC 2616 HTTP/1.1 June 1999
  5640. 3. If multiple transfer-codings are acceptable, then the
  5641. acceptable transfer-coding with the highest non-zero qvalue is
  5642. preferred. The "chunked" transfer-coding always has a qvalue
  5643. of 1.
  5644. If the TE field-value is empty or if no TE field is present, the only
  5645. transfer-coding is "chunked". A message with no transfer-coding is
  5646. always acceptable.
  5647. 14.40 Trailer
  5648. The Trailer general field value indicates that the given set of
  5649. header fields is present in the trailer of a message encoded with
  5650. chunked transfer-coding.
  5651. Trailer = "Trailer" ":" 1#field-name
  5652. An HTTP/1.1 message SHOULD include a Trailer header field in a
  5653. message using chunked transfer-coding with a non-empty trailer. Doing
  5654. so allows the recipient to know which header fields to expect in the
  5655. trailer.
  5656. If no Trailer header field is present, the trailer SHOULD NOT include
  5657. any header fields. See section 3.6.1 for restrictions on the use of
  5658. trailer fields in a "chunked" transfer-coding.
  5659. Message header fields listed in the Trailer header field MUST NOT
  5660. include the following header fields:
  5661. . Transfer-Encoding
  5662. . Content-Length
  5663. . Trailer
  5664. 14.41 Transfer-Encoding
  5665. The Transfer-Encoding general-header field indicates what (if any)
  5666. type of transformation has been applied to the message body in order
  5667. to safely transfer it between the sender and the recipient. This
  5668. differs from the content-coding in that the transfer-coding is a
  5669. property of the message, not of the entity.
  5670. Transfer-Encoding = "Transfer-Encoding" ":" 1#transfer-coding
  5671. Transfer-codings are defined in section 3.6. An example is:
  5672. Transfer-Encoding: chunked
  5673. Fielding, et al. Standards Track [Page 143]
  5674. RFC 2616 HTTP/1.1 June 1999
  5675. If multiple encodings have been applied to an entity, the transfer-
  5676. codings MUST be listed in the order in which they were applied.
  5677. Additional information about the encoding parameters MAY be provided
  5678. by other entity-header fields not defined by this specification.
  5679. Many older HTTP/1.0 applications do not understand the Transfer-
  5680. Encoding header.
  5681. 14.42 Upgrade
  5682. The Upgrade general-header allows the client to specify what
  5683. additional communication protocols it supports and would like to use
  5684. if the server finds it appropriate to switch protocols. The server
  5685. MUST use the Upgrade header field within a 101 (Switching Protocols)
  5686. response to indicate which protocol(s) are being switched.
  5687. Upgrade = "Upgrade" ":" 1#product
  5688. For example,
  5689. Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11
  5690. The Upgrade header field is intended to provide a simple mechanism
  5691. for transition from HTTP/1.1 to some other, incompatible protocol. It
  5692. does so by allowing the client to advertise its desire to use another
  5693. protocol, such as a later version of HTTP with a higher major version
  5694. number, even though the current request has been made using HTTP/1.1.
  5695. This eases the difficult transition between incompatible protocols by
  5696. allowing the client to initiate a request in the more commonly
  5697. supported protocol while indicating to the server that it would like
  5698. to use a "better" protocol if available (where "better" is determined
  5699. by the server, possibly according to the nature of the method and/or
  5700. resource being requested).
  5701. The Upgrade header field only applies to switching application-layer
  5702. protocols upon the existing transport-layer connection. Upgrade
  5703. cannot be used to insist on a protocol change; its acceptance and use
  5704. by the server is optional. The capabilities and nature of the
  5705. application-layer communication after the protocol change is entirely
  5706. dependent upon the new protocol chosen, although the first action
  5707. after changing the protocol MUST be a response to the initial HTTP
  5708. request containing the Upgrade header field.
  5709. The Upgrade header field only applies to the immediate connection.
  5710. Therefore, the upgrade keyword MUST be supplied within a Connection
  5711. header field (section 14.10) whenever Upgrade is present in an
  5712. HTTP/1.1 message.
  5713. Fielding, et al. Standards Track [Page 144]
  5714. RFC 2616 HTTP/1.1 June 1999
  5715. The Upgrade header field cannot be used to indicate a switch to a
  5716. protocol on a different connection. For that purpose, it is more
  5717. appropriate to use a 301, 302, 303, or 305 redirection response.
  5718. This specification only defines the protocol name "HTTP" for use by
  5719. the family of Hypertext Transfer Protocols, as defined by the HTTP
  5720. version rules of section 3.1 and future updates to this
  5721. specification. Any token can be used as a protocol name; however, it
  5722. will only be useful if both the client and server associate the name
  5723. with the same protocol.
  5724. 14.43 User-Agent
  5725. The User-Agent request-header field contains information about the
  5726. user agent originating the request. This is for statistical purposes,
  5727. the tracing of protocol violations, and automated recognition of user
  5728. agents for the sake of tailoring responses to avoid particular user
  5729. agent limitations. User agents SHOULD include this field with
  5730. requests. The field can contain multiple product tokens (section 3.8)
  5731. and comments identifying the agent and any subproducts which form a
  5732. significant part of the user agent. By convention, the product tokens
  5733. are listed in order of their significance for identifying the
  5734. application.
  5735. User-Agent = "User-Agent" ":" 1*( product | comment )
  5736. Example:
  5737. User-Agent: CERN-LineMode/2.15 libwww/2.17b3
  5738. 14.44 Vary
  5739. The Vary field value indicates the set of request-header fields that
  5740. fully determines, while the response is fresh, whether a cache is
  5741. permitted to use the response to reply to a subsequent request
  5742. without revalidation. For uncacheable or stale responses, the Vary
  5743. field value advises the user agent about the criteria that were used
  5744. to select the representation. A Vary field value of "*" implies that
  5745. a cache cannot determine from the request headers of a subsequent
  5746. request whether this response is the appropriate representation. See
  5747. section 13.6 for use of the Vary header field by caches.
  5748. Vary = "Vary" ":" ( "*" | 1#field-name )
  5749. An HTTP/1.1 server SHOULD include a Vary header field with any
  5750. cacheable response that is subject to server-driven negotiation.
  5751. Doing so allows a cache to properly interpret future requests on that
  5752. resource and informs the user agent about the presence of negotiation
  5753. Fielding, et al. Standards Track [Page 145]
  5754. RFC 2616 HTTP/1.1 June 1999
  5755. on that resource. A server MAY include a Vary header field with a
  5756. non-cacheable response that is subject to server-driven negotiation,
  5757. since this might provide the user agent with useful information about
  5758. the dimensions over which the response varies at the time of the
  5759. response.
  5760. A Vary field value consisting of a list of field-names signals that
  5761. the representation selected for the response is based on a selection
  5762. algorithm which considers ONLY the listed request-header field values
  5763. in selecting the most appropriate representation. A cache MAY assume
  5764. that the same selection will be made for future requests with the
  5765. same values for the listed field names, for the duration of time for
  5766. which the response is fresh.
  5767. The field-names given are not limited to the set of standard
  5768. request-header fields defined by this specification. Field names are
  5769. case-insensitive.
  5770. A Vary field value of "*" signals that unspecified parameters not
  5771. limited to the request-headers (e.g., the network address of the
  5772. client), play a role in the selection of the response representation.
  5773. The "*" value MUST NOT be generated by a proxy server; it may only be
  5774. generated by an origin server.
  5775. 14.45 Via
  5776. The Via general-header field MUST be used by gateways and proxies to
  5777. indicate the intermediate protocols and recipients between the user
  5778. agent and the server on requests, and between the origin server and
  5779. the client on responses. It is analogous to the "Received" field of
  5780. RFC 822 [9] and is intended to be used for tracking message forwards,
  5781. avoiding request loops, and identifying the protocol capabilities of
  5782. all senders along the request/response chain.
  5783. Via = "Via" ":" 1#( received-protocol received-by [ comment ] )
  5784. received-protocol = [ protocol-name "/" ] protocol-version
  5785. protocol-name = token
  5786. protocol-version = token
  5787. received-by = ( host [ ":" port ] ) | pseudonym
  5788. pseudonym = token
  5789. The received-protocol indicates the protocol version of the message
  5790. received by the server or client along each segment of the
  5791. request/response chain. The received-protocol version is appended to
  5792. the Via field value when the message is forwarded so that information
  5793. about the protocol capabilities of upstream applications remains
  5794. visible to all recipients.
  5795. Fielding, et al. Standards Track [Page 146]
  5796. RFC 2616 HTTP/1.1 June 1999
  5797. The protocol-name is optional if and only if it would be "HTTP". The
  5798. received-by field is normally the host and optional port number of a
  5799. recipient server or client that subsequently forwarded the message.
  5800. However, if the real host is considered to be sensitive information,
  5801. it MAY be replaced by a pseudonym. If the port is not given, it MAY
  5802. be assumed to be the default port of the received-protocol.
  5803. Multiple Via field values represents each proxy or gateway that has
  5804. forwarded the message. Each recipient MUST append its information
  5805. such that the end result is ordered according to the sequence of
  5806. forwarding applications.
  5807. Comments MAY be used in the Via header field to identify the software
  5808. of the recipient proxy or gateway, analogous to the User-Agent and
  5809. Server header fields. However, all comments in the Via field are
  5810. optional and MAY be removed by any recipient prior to forwarding the
  5811. message.
  5812. For example, a request message could be sent from an HTTP/1.0 user
  5813. agent to an internal proxy code-named "fred", which uses HTTP/1.1 to
  5814. forward the request to a public proxy at nowhere.com, which completes
  5815. the request by forwarding it to the origin server at www.ics.uci.edu.
  5816. The request received by www.ics.uci.edu would then have the following
  5817. Via header field:
  5818. Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1)
  5819. Proxies and gateways used as a portal through a network firewall
  5820. SHOULD NOT, by default, forward the names and ports of hosts within
  5821. the firewall region. This information SHOULD only be propagated if
  5822. explicitly enabled. If not enabled, the received-by host of any host
  5823. behind the firewall SHOULD be replaced by an appropriate pseudonym
  5824. for that host.
  5825. For organizations that have strong privacy requirements for hiding
  5826. internal structures, a proxy MAY combine an ordered subsequence of
  5827. Via header field entries with identical received-protocol values into
  5828. a single such entry. For example,
  5829. Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy
  5830. could be collapsed to
  5831. Via: 1.0 ricky, 1.1 mertz, 1.0 lucy
  5832. Fielding, et al. Standards Track [Page 147]
  5833. RFC 2616 HTTP/1.1 June 1999
  5834. Applications SHOULD NOT combine multiple entries unless they are all
  5835. under the same organizational control and the hosts have already been
  5836. replaced by pseudonyms. Applications MUST NOT combine entries which
  5837. have different received-protocol values.
  5838. 14.46 Warning
  5839. The Warning general-header field is used to carry additional
  5840. information about the status or transformation of a message which
  5841. might not be reflected in the message. This information is typically
  5842. used to warn about a possible lack of semantic transparency from
  5843. caching operations or transformations applied to the entity body of
  5844. the message.
  5845. Warning headers are sent with responses using:
  5846. Warning = "Warning" ":" 1#warning-value
  5847. warning-value = warn-code SP warn-agent SP warn-text
  5848. [SP warn-date]
  5849. warn-code = 3DIGIT
  5850. warn-agent = ( host [ ":" port ] ) | pseudonym
  5851. ; the name or pseudonym of the server adding
  5852. ; the Warning header, for use in debugging
  5853. warn-text = quoted-string
  5854. warn-date = <"> HTTP-date <">
  5855. A response MAY carry more than one Warning header.
  5856. The warn-text SHOULD be in a natural language and character set that
  5857. is most likely to be intelligible to the human user receiving the
  5858. response. This decision MAY be based on any available knowledge, such
  5859. as the location of the cache or user, the Accept-Language field in a
  5860. request, the Content-Language field in a response, etc. The default
  5861. language is English and the default character set is ISO-8859-1.
  5862. If a character set other than ISO-8859-1 is used, it MUST be encoded
  5863. in the warn-text using the method described in RFC 2047 [14].
  5864. Warning headers can in general be applied to any message, however
  5865. some specific warn-codes are specific to caches and can only be
  5866. applied to response messages. New Warning headers SHOULD be added
  5867. after any existing Warning headers. A cache MUST NOT delete any
  5868. Warning header that it received with a message. However, if a cache
  5869. successfully validates a cache entry, it SHOULD remove any Warning
  5870. headers previously attached to that entry except as specified for
  5871. Fielding, et al. Standards Track [Page 148]
  5872. RFC 2616 HTTP/1.1 June 1999
  5873. specific Warning codes. It MUST then add any Warning headers received
  5874. in the validating response. In other words, Warning headers are those
  5875. that would be attached to the most recent relevant response.
  5876. When multiple Warning headers are attached to a response, the user
  5877. agent ought to inform the user of as many of them as possible, in the
  5878. order that they appear in the response. If it is not possible to
  5879. inform the user of all of the warnings, the user agent SHOULD follow
  5880. these heuristics:
  5881. - Warnings that appear early in the response take priority over
  5882. those appearing later in the response.
  5883. - Warnings in the user's preferred character set take priority
  5884. over warnings in other character sets but with identical warn-
  5885. codes and warn-agents.
  5886. Systems that generate multiple Warning headers SHOULD order them with
  5887. this user agent behavior in mind.
  5888. Requirements for the behavior of caches with respect to Warnings are
  5889. stated in section 13.1.2.
  5890. This is a list of the currently-defined warn-codes, each with a
  5891. recommended warn-text in English, and a description of its meaning.
  5892. 110 Response is stale
  5893. MUST be included whenever the returned response is stale.
  5894. 111 Revalidation failed
  5895. MUST be included if a cache returns a stale response because an
  5896. attempt to revalidate the response failed, due to an inability to
  5897. reach the server.
  5898. 112 Disconnected operation
  5899. SHOULD be included if the cache is intentionally disconnected from
  5900. the rest of the network for a period of time.
  5901. 113 Heuristic expiration
  5902. MUST be included if the cache heuristically chose a freshness
  5903. lifetime greater than 24 hours and the response's age is greater
  5904. than 24 hours.
  5905. 199 Miscellaneous warning
  5906. The warning text MAY include arbitrary information to be presented
  5907. to a human user, or logged. A system receiving this warning MUST
  5908. NOT take any automated action, besides presenting the warning to
  5909. the user.
  5910. Fielding, et al. Standards Track [Page 149]
  5911. RFC 2616 HTTP/1.1 June 1999
  5912. 214 Transformation applied
  5913. MUST be added by an intermediate cache or proxy if it applies any
  5914. transformation changing the content-coding (as specified in the
  5915. Content-Encoding header) or media-type (as specified in the
  5916. Content-Type header) of the response, or the entity-body of the
  5917. response, unless this Warning code already appears in the response.
  5918. 299 Miscellaneous persistent warning
  5919. The warning text MAY include arbitrary information to be presented
  5920. to a human user, or logged. A system receiving this warning MUST
  5921. NOT take any automated action.
  5922. If an implementation sends a message with one or more Warning headers
  5923. whose version is HTTP/1.0 or lower, then the sender MUST include in
  5924. each warning-value a warn-date that matches the date in the response.
  5925. If an implementation receives a message with a warning-value that
  5926. includes a warn-date, and that warn-date is different from the Date
  5927. value in the response, then that warning-value MUST be deleted from
  5928. the message before storing, forwarding, or using it. (This prevents
  5929. bad consequences of naive caching of Warning header fields.) If all
  5930. of the warning-values are deleted for this reason, the Warning header
  5931. MUST be deleted as well.
  5932. 14.47 WWW-Authenticate
  5933. The WWW-Authenticate response-header field MUST be included in 401
  5934. (Unauthorized) response messages. The field value consists of at
  5935. least one challenge that indicates the authentication scheme(s) and
  5936. parameters applicable to the Request-URI.
  5937. WWW-Authenticate = "WWW-Authenticate" ":" 1#challenge
  5938. The HTTP access authentication process is described in "HTTP
  5939. Authentication: Basic and Digest Access Authentication" [43]. User
  5940. agents are advised to take special care in parsing the WWW-
  5941. Authenticate field value as it might contain more than one challenge,
  5942. or if more than one WWW-Authenticate header field is provided, the
  5943. contents of a challenge itself can contain a comma-separated list of
  5944. authentication parameters.
  5945. 15 Security Considerations
  5946. This section is meant to inform application developers, information
  5947. providers, and users of the security limitations in HTTP/1.1 as
  5948. described by this document. The discussion does not include
  5949. definitive solutions to the problems revealed, though it does make
  5950. some suggestions for reducing security risks.
  5951. Fielding, et al. Standards Track [Page 150]
  5952. RFC 2616 HTTP/1.1 June 1999
  5953. 15.1 Personal Information
  5954. HTTP clients are often privy to large amounts of personal information
  5955. (e.g. the user's name, location, mail address, passwords, encryption
  5956. keys, etc.), and SHOULD be very careful to prevent unintentional
  5957. leakage of this information via the HTTP protocol to other sources.
  5958. We very strongly recommend that a convenient interface be provided
  5959. for the user to control dissemination of such information, and that
  5960. designers and implementors be particularly careful in this area.
  5961. History shows that errors in this area often create serious security
  5962. and/or privacy problems and generate highly adverse publicity for the
  5963. implementor's company.
  5964. 15.1.1 Abuse of Server Log Information
  5965. A server is in the position to save personal data about a user's
  5966. requests which might identify their reading patterns or subjects of
  5967. interest. This information is clearly confidential in nature and its
  5968. handling can be constrained by law in certain countries. People using
  5969. the HTTP protocol to provide data are responsible for ensuring that
  5970. such material is not distributed without the permission of any
  5971. individuals that are identifiable by the published results.
  5972. 15.1.2 Transfer of Sensitive Information
  5973. Like any generic data transfer protocol, HTTP cannot regulate the
  5974. content of the data that is transferred, nor is there any a priori
  5975. method of determining the sensitivity of any particular piece of
  5976. information within the context of any given request. Therefore,
  5977. applications SHOULD supply as much control over this information as
  5978. possible to the provider of that information. Four header fields are
  5979. worth special mention in this context: Server, Via, Referer and From.
  5980. Revealing the specific software version of the server might allow the
  5981. server machine to become more vulnerable to attacks against software
  5982. that is known to contain security holes. Implementors SHOULD make the
  5983. Server header field a configurable option.
  5984. Proxies which serve as a portal through a network firewall SHOULD
  5985. take special precautions regarding the transfer of header information
  5986. that identifies the hosts behind the firewall. In particular, they
  5987. SHOULD remove, or replace with sanitized versions, any Via fields
  5988. generated behind the firewall.
  5989. The Referer header allows reading patterns to be studied and reverse
  5990. links drawn. Although it can be very useful, its power can be abused
  5991. if user details are not separated from the information contained in
  5992. Fielding, et al. Standards Track [Page 151]
  5993. RFC 2616 HTTP/1.1 June 1999
  5994. the Referer. Even when the personal information has been removed, the
  5995. Referer header might indicate a private document's URI whose
  5996. publication would be inappropriate.
  5997. The information sent in the From field might conflict with the user's
  5998. privacy interests or their site's security policy, and hence it
  5999. SHOULD NOT be transmitted without the user being able to disable,
  6000. enable, and modify the contents of the field. The user MUST be able
  6001. to set the contents of this field within a user preference or
  6002. application defaults configuration.
  6003. We suggest, though do not require, that a convenient toggle interface
  6004. be provided for the user to enable or disable the sending of From and
  6005. Referer information.
  6006. The User-Agent (section 14.43) or Server (section 14.38) header
  6007. fields can sometimes be used to determine that a specific client or
  6008. server have a particular security hole which might be exploited.
  6009. Unfortunately, this same information is often used for other valuable
  6010. purposes for which HTTP currently has no better mechanism.
  6011. 15.1.3 Encoding Sensitive Information in URI's
  6012. Because the source of a link might be private information or might
  6013. reveal an otherwise private information source, it is strongly
  6014. recommended that the user be able to select whether or not the
  6015. Referer field is sent. For example, a browser client could have a
  6016. toggle switch for browsing openly/anonymously, which would
  6017. respectively enable/disable the sending of Referer and From
  6018. information.
  6019. Clients SHOULD NOT include a Referer header field in a (non-secure)
  6020. HTTP request if the referring page was transferred with a secure
  6021. protocol.
  6022. Authors of services which use the HTTP protocol SHOULD NOT use GET
  6023. based forms for the submission of sensitive data, because this will
  6024. cause this data to be encoded in the Request-URI. Many existing
  6025. servers, proxies, and user agents will log the request URI in some
  6026. place where it might be visible to third parties. Servers can use
  6027. POST-based form submission instead
  6028. 15.1.4 Privacy Issues Connected to Accept Headers
  6029. Accept request-headers can reveal information about the user to all
  6030. servers which are accessed. The Accept-Language header in particular
  6031. can reveal information the user would consider to be of a private
  6032. nature, because the understanding of particular languages is often
  6033. Fielding, et al. Standards Track [Page 152]
  6034. RFC 2616 HTTP/1.1 June 1999
  6035. strongly correlated to the membership of a particular ethnic group.
  6036. User agents which offer the option to configure the contents of an
  6037. Accept-Language header to be sent in every request are strongly
  6038. encouraged to let the configuration process include a message which
  6039. makes the user aware of the loss of privacy involved.
  6040. An approach that limits the loss of privacy would be for a user agent
  6041. to omit the sending of Accept-Language headers by default, and to ask
  6042. the user whether or not to start sending Accept-Language headers to a
  6043. server if it detects, by looking for any Vary response-header fields
  6044. generated by the server, that such sending could improve the quality
  6045. of service.
  6046. Elaborate user-customized accept header fields sent in every request,
  6047. in particular if these include quality values, can be used by servers
  6048. as relatively reliable and long-lived user identifiers. Such user
  6049. identifiers would allow content providers to do click-trail tracking,
  6050. and would allow collaborating content providers to match cross-server
  6051. click-trails or form submissions of individual users. Note that for
  6052. many users not behind a proxy, the network address of the host
  6053. running the user agent will also serve as a long-lived user
  6054. identifier. In environments where proxies are used to enhance
  6055. privacy, user agents ought to be conservative in offering accept
  6056. header configuration options to end users. As an extreme privacy
  6057. measure, proxies could filter the accept headers in relayed requests.
  6058. General purpose user agents which provide a high degree of header
  6059. configurability SHOULD warn users about the loss of privacy which can
  6060. be involved.
  6061. 15.2 Attacks Based On File and Path Names
  6062. Implementations of HTTP origin servers SHOULD be careful to restrict
  6063. the documents returned by HTTP requests to be only those that were
  6064. intended by the server administrators. If an HTTP server translates
  6065. HTTP URIs directly into file system calls, the server MUST take
  6066. special care not to serve files that were not intended to be
  6067. delivered to HTTP clients. For example, UNIX, Microsoft Windows, and
  6068. other operating systems use ".." as a path component to indicate a
  6069. directory level above the current one. On such a system, an HTTP
  6070. server MUST disallow any such construct in the Request-URI if it
  6071. would otherwise allow access to a resource outside those intended to
  6072. be accessible via the HTTP server. Similarly, files intended for
  6073. reference only internally to the server (such as access control
  6074. files, configuration files, and script code) MUST be protected from
  6075. inappropriate retrieval, since they might contain sensitive
  6076. information. Experience has shown that minor bugs in such HTTP server
  6077. implementations have turned into security risks.
  6078. Fielding, et al. Standards Track [Page 153]
  6079. RFC 2616 HTTP/1.1 June 1999
  6080. 15.3 DNS Spoofing
  6081. Clients using HTTP rely heavily on the Domain Name Service, and are
  6082. thus generally prone to security attacks based on the deliberate
  6083. mis-association of IP addresses and DNS names. Clients need to be
  6084. cautious in assuming the continuing validity of an IP number/DNS name
  6085. association.
  6086. In particular, HTTP clients SHOULD rely on their name resolver for
  6087. confirmation of an IP number/DNS name association, rather than
  6088. caching the result of previous host name lookups. Many platforms
  6089. already can cache host name lookups locally when appropriate, and
  6090. they SHOULD be configured to do so. It is proper for these lookups to
  6091. be cached, however, only when the TTL (Time To Live) information
  6092. reported by the name server makes it likely that the cached
  6093. information will remain useful.
  6094. If HTTP clients cache the results of host name lookups in order to
  6095. achieve a performance improvement, they MUST observe the TTL
  6096. information reported by DNS.
  6097. If HTTP clients do not observe this rule, they could be spoofed when
  6098. a previously-accessed server's IP address changes. As network
  6099. renumbering is expected to become increasingly common [24], the
  6100. possibility of this form of attack will grow. Observing this
  6101. requirement thus reduces this potential security vulnerability.
  6102. This requirement also improves the load-balancing behavior of clients
  6103. for replicated servers using the same DNS name and reduces the
  6104. likelihood of a user's experiencing failure in accessing sites which
  6105. use that strategy.
  6106. 15.4 Location Headers and Spoofing
  6107. If a single server supports multiple organizations that do not trust
  6108. one another, then it MUST check the values of Location and Content-
  6109. Location headers in responses that are generated under control of
  6110. said organizations to make sure that they do not attempt to
  6111. invalidate resources over which they have no authority.
  6112. 15.5 Content-Disposition Issues
  6113. RFC 1806 [35], from which the often implemented Content-Disposition
  6114. (see section 19.5.1) header in HTTP is derived, has a number of very
  6115. serious security considerations. Content-Disposition is not part of
  6116. the HTTP standard, but since it is widely implemented, we are
  6117. documenting its use and risks for implementors. See RFC 2183 [49]
  6118. (which updates RFC 1806) for details.
  6119. Fielding, et al. Standards Track [Page 154]
  6120. RFC 2616 HTTP/1.1 June 1999
  6121. 15.6 Authentication Credentials and Idle Clients
  6122. Existing HTTP clients and user agents typically retain authentication
  6123. information indefinitely. HTTP/1.1. does not provide a method for a
  6124. server to direct clients to discard these cached credentials. This is
  6125. a significant defect that requires further extensions to HTTP.
  6126. Circumstances under which credential caching can interfere with the
  6127. application's security model include but are not limited to:
  6128. - Clients which have been idle for an extended period following
  6129. which the server might wish to cause the client to reprompt the
  6130. user for credentials.
  6131. - Applications which include a session termination indication
  6132. (such as a `logout' or `commit' button on a page) after which
  6133. the server side of the application `knows' that there is no
  6134. further reason for the client to retain the credentials.
  6135. This is currently under separate study. There are a number of work-
  6136. arounds to parts of this problem, and we encourage the use of
  6137. password protection in screen savers, idle time-outs, and other
  6138. methods which mitigate the security problems inherent in this
  6139. problem. In particular, user agents which cache credentials are
  6140. encouraged to provide a readily accessible mechanism for discarding
  6141. cached credentials under user control.
  6142. 15.7 Proxies and Caching
  6143. By their very nature, HTTP proxies are men-in-the-middle, and
  6144. represent an opportunity for man-in-the-middle attacks. Compromise of
  6145. the systems on which the proxies run can result in serious security
  6146. and privacy problems. Proxies have access to security-related
  6147. information, personal information about individual users and
  6148. organizations, and proprietary information belonging to users and
  6149. content providers. A compromised proxy, or a proxy implemented or
  6150. configured without regard to security and privacy considerations,
  6151. might be used in the commission of a wide range of potential attacks.
  6152. Proxy operators should protect the systems on which proxies run as
  6153. they would protect any system that contains or transports sensitive
  6154. information. In particular, log information gathered at proxies often
  6155. contains highly sensitive personal information, and/or information
  6156. about organizations. Log information should be carefully guarded, and
  6157. appropriate guidelines for use developed and followed. (Section
  6158. 15.1.1).
  6159. Fielding, et al. Standards Track [Page 155]
  6160. RFC 2616 HTTP/1.1 June 1999
  6161. Caching proxies provide additional potential vulnerabilities, since
  6162. the contents of the cache represent an attractive target for
  6163. malicious exploitation. Because cache contents persist after an HTTP
  6164. request is complete, an attack on the cache can reveal information
  6165. long after a user believes that the information has been removed from
  6166. the network. Therefore, cache contents should be protected as
  6167. sensitive information.
  6168. Proxy implementors should consider the privacy and security
  6169. implications of their design and coding decisions, and of the
  6170. configuration options they provide to proxy operators (especially the
  6171. default configuration).
  6172. Users of a proxy need to be aware that they are no trustworthier than
  6173. the people who run the proxy; HTTP itself cannot solve this problem.
  6174. The judicious use of cryptography, when appropriate, may suffice to
  6175. protect against a broad range of security and privacy attacks. Such
  6176. cryptography is beyond the scope of the HTTP/1.1 specification.
  6177. 15.7.1 Denial of Service Attacks on Proxies
  6178. They exist. They are hard to defend against. Research continues.
  6179. Beware.
  6180. 16 Acknowledgments
  6181. This specification makes heavy use of the augmented BNF and generic
  6182. constructs defined by David H. Crocker for RFC 822 [9]. Similarly, it
  6183. reuses many of the definitions provided by Nathaniel Borenstein and
  6184. Ned Freed for MIME [7]. We hope that their inclusion in this
  6185. specification will help reduce past confusion over the relationship
  6186. between HTTP and Internet mail message formats.
  6187. The HTTP protocol has evolved considerably over the years. It has
  6188. benefited from a large and active developer community--the many
  6189. people who have participated on the www-talk mailing list--and it is
  6190. that community which has been most responsible for the success of
  6191. HTTP and of the World-Wide Web in general. Marc Andreessen, Robert
  6192. Cailliau, Daniel W. Connolly, Bob Denny, John Franks, Jean-Francois
  6193. Groff, Phillip M. Hallam-Baker, Hakon W. Lie, Ari Luotonen, Rob
  6194. McCool, Lou Montulli, Dave Raggett, Tony Sanders, and Marc
  6195. VanHeyningen deserve special recognition for their efforts in
  6196. defining early aspects of the protocol.
  6197. This document has benefited greatly from the comments of all those
  6198. participating in the HTTP-WG. In addition to those already mentioned,
  6199. the following individuals have contributed to this specification:
  6200. Fielding, et al. Standards Track [Page 156]
  6201. RFC 2616 HTTP/1.1 June 1999
  6202. Gary Adams Ross Patterson
  6203. Harald Tveit Alvestrand Albert Lunde
  6204. Keith Ball John C. Mallery
  6205. Brian Behlendorf Jean-Philippe Martin-Flatin
  6206. Paul Burchard Mitra
  6207. Maurizio Codogno David Morris
  6208. Mike Cowlishaw Gavin Nicol
  6209. Roman Czyborra Bill Perry
  6210. Michael A. Dolan Jeffrey Perry
  6211. David J. Fiander Scott Powers
  6212. Alan Freier Owen Rees
  6213. Marc Hedlund Luigi Rizzo
  6214. Greg Herlihy David Robinson
  6215. Koen Holtman Marc Salomon
  6216. Alex Hopmann Rich Salz
  6217. Bob Jernigan Allan M. Schiffman
  6218. Shel Kaphan Jim Seidman
  6219. Rohit Khare Chuck Shotton
  6220. John Klensin Eric W. Sink
  6221. Martijn Koster Simon E. Spero
  6222. Alexei Kosut Richard N. Taylor
  6223. David M. Kristol Robert S. Thau
  6224. Daniel LaLiberte Bill (BearHeart) Weinman
  6225. Ben Laurie Francois Yergeau
  6226. Paul J. Leach Mary Ellen Zurko
  6227. Daniel DuBois Josh Cohen
  6228. Much of the content and presentation of the caching design is due to
  6229. suggestions and comments from individuals including: Shel Kaphan,
  6230. Paul Leach, Koen Holtman, David Morris, and Larry Masinter.
  6231. Most of the specification of ranges is based on work originally done
  6232. by Ari Luotonen and John Franks, with additional input from Steve
  6233. Zilles.
  6234. Thanks to the "cave men" of Palo Alto. You know who you are.
  6235. Jim Gettys (the current editor of this document) wishes particularly
  6236. to thank Roy Fielding, the previous editor of this document, along
  6237. with John Klensin, Jeff Mogul, Paul Leach, Dave Kristol, Koen
  6238. Holtman, John Franks, Josh Cohen, Alex Hopmann, Scott Lawrence, and
  6239. Larry Masinter for their help. And thanks go particularly to Jeff
  6240. Mogul and Scott Lawrence for performing the "MUST/MAY/SHOULD" audit.
  6241. Fielding, et al. Standards Track [Page 157]
  6242. RFC 2616 HTTP/1.1 June 1999
  6243. The Apache Group, Anselm Baird-Smith, author of Jigsaw, and Henrik
  6244. Frystyk implemented RFC 2068 early, and we wish to thank them for the
  6245. discovery of many of the problems that this document attempts to
  6246. rectify.
  6247. 17 References
  6248. [1] Alvestrand, H., "Tags for the Identification of Languages", RFC
  6249. 1766, March 1995.
  6250. [2] Anklesaria, F., McCahill, M., Lindner, P., Johnson, D., Torrey,
  6251. D. and B. Alberti, "The Internet Gopher Protocol (a distributed
  6252. document search and retrieval protocol)", RFC 1436, March 1993.
  6253. [3] Berners-Lee, T., "Universal Resource Identifiers in WWW", RFC
  6254. 1630, June 1994.
  6255. [4] Berners-Lee, T., Masinter, L. and M. McCahill, "Uniform Resource
  6256. Locators (URL)", RFC 1738, December 1994.
  6257. [5] Berners-Lee, T. and D. Connolly, "Hypertext Markup Language -
  6258. 2.0", RFC 1866, November 1995.
  6259. [6] Berners-Lee, T., Fielding, R. and H. Frystyk, "Hypertext Transfer
  6260. Protocol -- HTTP/1.0", RFC 1945, May 1996.
  6261. [7] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
  6262. Extensions (MIME) Part One: Format of Internet Message Bodies",
  6263. RFC 2045, November 1996.
  6264. [8] Braden, R., "Requirements for Internet Hosts -- Communication
  6265. Layers", STD 3, RFC 1123, October 1989.
  6266. [9] Crocker, D., "Standard for The Format of ARPA Internet Text
  6267. Messages", STD 11, RFC 822, August 1982.
  6268. [10] Davis, F., Kahle, B., Morris, H., Salem, J., Shen, T., Wang, R.,
  6269. Sui, J., and M. Grinbaum, "WAIS Interface Protocol Prototype
  6270. Functional Specification," (v1.5), Thinking Machines
  6271. Corporation, April 1990.
  6272. [11] Fielding, R., "Relative Uniform Resource Locators", RFC 1808,
  6273. June 1995.
  6274. [12] Horton, M. and R. Adams, "Standard for Interchange of USENET
  6275. Messages", RFC 1036, December 1987.
  6276. Fielding, et al. Standards Track [Page 158]
  6277. RFC 2616 HTTP/1.1 June 1999
  6278. [13] Kantor, B. and P. Lapsley, "Network News Transfer Protocol", RFC
  6279. 977, February 1986.
  6280. [14] Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part
  6281. Three: Message Header Extensions for Non-ASCII Text", RFC 2047,
  6282. November 1996.
  6283. [15] Nebel, E. and L. Masinter, "Form-based File Upload in HTML", RFC
  6284. 1867, November 1995.
  6285. [16] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC 821,
  6286. August 1982.
  6287. [17] Postel, J., "Media Type Registration Procedure", RFC 1590,
  6288. November 1996.
  6289. [18] Postel, J. and J. Reynolds, "File Transfer Protocol", STD 9, RFC
  6290. 959, October 1985.
  6291. [19] Reynolds, J. and J. Postel, "Assigned Numbers", STD 2, RFC 1700,
  6292. October 1994.
  6293. [20] Sollins, K. and L. Masinter, "Functional Requirements for
  6294. Uniform Resource Names", RFC 1737, December 1994.
  6295. [21] US-ASCII. Coded Character Set - 7-Bit American Standard Code for
  6296. Information Interchange. Standard ANSI X3.4-1986, ANSI, 1986.
  6297. [22] ISO-8859. International Standard -- Information Processing --
  6298. 8-bit Single-Byte Coded Graphic Character Sets --
  6299. Part 1: Latin alphabet No. 1, ISO-8859-1:1987.
  6300. Part 2: Latin alphabet No. 2, ISO-8859-2, 1987.
  6301. Part 3: Latin alphabet No. 3, ISO-8859-3, 1988.
  6302. Part 4: Latin alphabet No. 4, ISO-8859-4, 1988.
  6303. Part 5: Latin/Cyrillic alphabet, ISO-8859-5, 1988.
  6304. Part 6: Latin/Arabic alphabet, ISO-8859-6, 1987.
  6305. Part 7: Latin/Greek alphabet, ISO-8859-7, 1987.
  6306. Part 8: Latin/Hebrew alphabet, ISO-8859-8, 1988.
  6307. Part 9: Latin alphabet No. 5, ISO-8859-9, 1990.
  6308. [23] Meyers, J. and M. Rose, "The Content-MD5 Header Field", RFC
  6309. 1864, October 1995.
  6310. [24] Carpenter, B. and Y. Rekhter, "Renumbering Needs Work", RFC
  6311. 1900, February 1996.
  6312. [25] Deutsch, P., "GZIP file format specification version 4.3", RFC
  6313. 1952, May 1996.
  6314. Fielding, et al. Standards Track [Page 159]
  6315. RFC 2616 HTTP/1.1 June 1999
  6316. [26] Venkata N. Padmanabhan, and Jeffrey C. Mogul. "Improving HTTP
  6317. Latency", Computer Networks and ISDN Systems, v. 28, pp. 25-35,
  6318. Dec. 1995. Slightly revised version of paper in Proc. 2nd
  6319. International WWW Conference '94: Mosaic and the Web, Oct. 1994,
  6320. which is available at
  6321. http://www.ncsa.uiuc.edu/SDG/IT94/Proceedings/DDay/mogul/HTTPLat
  6322. ency.html.
  6323. [27] Joe Touch, John Heidemann, and Katia Obraczka. "Analysis of HTTP
  6324. Performance", <URL: http://www.isi.edu/touch/pubs/http-perf96/>,
  6325. ISI Research Report ISI/RR-98-463, (original report dated Aug.
  6326. 1996), USC/Information Sciences Institute, August 1998.
  6327. [28] Mills, D., "Network Time Protocol (Version 3) Specification,
  6328. Implementation and Analysis", RFC 1305, March 1992.
  6329. [29] Deutsch, P., "DEFLATE Compressed Data Format Specification
  6330. version 1.3", RFC 1951, May 1996.
  6331. [30] S. Spero, "Analysis of HTTP Performance Problems,"
  6332. http://sunsite.unc.edu/mdma-release/http-prob.html.
  6333. [31] Deutsch, P. and J. Gailly, "ZLIB Compressed Data Format
  6334. Specification version 3.3", RFC 1950, May 1996.
  6335. [32] Franks, J., Hallam-Baker, P., Hostetler, J., Leach, P.,
  6336. Luotonen, A., Sink, E. and L. Stewart, "An Extension to HTTP:
  6337. Digest Access Authentication", RFC 2069, January 1997.
  6338. [33] Fielding, R., Gettys, J., Mogul, J., Frystyk, H. and T.
  6339. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC
  6340. 2068, January 1997.
  6341. [34] Bradner, S., "Key words for use in RFCs to Indicate Requirement
  6342. Levels", BCP 14, RFC 2119, March 1997.
  6343. [35] Troost, R. and Dorner, S., "Communicating Presentation
  6344. Information in Internet Messages: The Content-Disposition
  6345. Header", RFC 1806, June 1995.
  6346. [36] Mogul, J., Fielding, R., Gettys, J. and H. Frystyk, "Use and
  6347. Interpretation of HTTP Version Numbers", RFC 2145, May 1997.
  6348. [jg639]
  6349. [37] Palme, J., "Common Internet Message Headers", RFC 2076, February
  6350. 1997. [jg640]
  6351. Fielding, et al. Standards Track [Page 160]
  6352. RFC 2616 HTTP/1.1 June 1999
  6353. [38] Yergeau, F., "UTF-8, a transformation format of Unicode and
  6354. ISO-10646", RFC 2279, January 1998. [jg641]
  6355. [39] Nielsen, H.F., Gettys, J., Baird-Smith, A., Prud'hommeaux, E.,
  6356. Lie, H., and C. Lilley. "Network Performance Effects of
  6357. HTTP/1.1, CSS1, and PNG," Proceedings of ACM SIGCOMM '97, Cannes
  6358. France, September 1997.[jg642]
  6359. [40] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
  6360. Extensions (MIME) Part Two: Media Types", RFC 2046, November
  6361. 1996. [jg643]
  6362. [41] Alvestrand, H., "IETF Policy on Character Sets and Languages",
  6363. BCP 18, RFC 2277, January 1998. [jg644]
  6364. [42] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform Resource
  6365. Identifiers (URI): Generic Syntax and Semantics", RFC 2396,
  6366. August 1998. [jg645]
  6367. [43] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S.,
  6368. Leach, P., Luotonen, A., Sink, E. and L. Stewart, "HTTP
  6369. Authentication: Basic and Digest Access Authentication", RFC
  6370. 2617, June 1999. [jg646]
  6371. [44] Luotonen, A., "Tunneling TCP based protocols through Web proxy
  6372. servers," Work in Progress. [jg647]
  6373. [45] Palme, J. and A. Hopmann, "MIME E-mail Encapsulation of
  6374. Aggregate Documents, such as HTML (MHTML)", RFC 2110, March
  6375. 1997.
  6376. [46] Bradner, S., "The Internet Standards Process -- Revision 3", BCP
  6377. 9, RFC 2026, October 1996.
  6378. [47] Masinter, L., "Hyper Text Coffee Pot Control Protocol
  6379. (HTCPCP/1.0)", RFC 2324, 1 April 1998.
  6380. [48] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
  6381. Extensions (MIME) Part Five: Conformance Criteria and Examples",
  6382. RFC 2049, November 1996.
  6383. [49] Troost, R., Dorner, S. and K. Moore, "Communicating Presentation
  6384. Information in Internet Messages: The Content-Disposition Header
  6385. Field", RFC 2183, August 1997.
  6386. Fielding, et al. Standards Track [Page 161]
  6387. RFC 2616 HTTP/1.1 June 1999
  6388. 18 Authors' Addresses
  6389. Roy T. Fielding
  6390. Information and Computer Science
  6391. University of California, Irvine
  6392. Irvine, CA 92697-3425, USA
  6393. Fax: +1 (949) 824-1715
  6394. EMail: fielding@ics.uci.edu
  6395. James Gettys
  6396. World Wide Web Consortium
  6397. MIT Laboratory for Computer Science
  6398. 545 Technology Square
  6399. Cambridge, MA 02139, USA
  6400. Fax: +1 (617) 258 8682
  6401. EMail: jg@w3.org
  6402. Jeffrey C. Mogul
  6403. Western Research Laboratory
  6404. Compaq Computer Corporation
  6405. 250 University Avenue
  6406. Palo Alto, California, 94305, USA
  6407. EMail: mogul@wrl.dec.com
  6408. Henrik Frystyk Nielsen
  6409. World Wide Web Consortium
  6410. MIT Laboratory for Computer Science
  6411. 545 Technology Square
  6412. Cambridge, MA 02139, USA
  6413. Fax: +1 (617) 258 8682
  6414. EMail: frystyk@w3.org
  6415. Larry Masinter
  6416. Xerox Corporation
  6417. 3333 Coyote Hill Road
  6418. Palo Alto, CA 94034, USA
  6419. EMail: masinter@parc.xerox.com
  6420. Fielding, et al. Standards Track [Page 162]
  6421. RFC 2616 HTTP/1.1 June 1999
  6422. Paul J. Leach
  6423. Microsoft Corporation
  6424. 1 Microsoft Way
  6425. Redmond, WA 98052, USA
  6426. EMail: paulle@microsoft.com
  6427. Tim Berners-Lee
  6428. Director, World Wide Web Consortium
  6429. MIT Laboratory for Computer Science
  6430. 545 Technology Square
  6431. Cambridge, MA 02139, USA
  6432. Fax: +1 (617) 258 8682
  6433. EMail: timbl@w3.org
  6434. Fielding, et al. Standards Track [Page 163]
  6435. RFC 2616 HTTP/1.1 June 1999
  6436. 19 Appendices
  6437. 19.1 Internet Media Type message/http and application/http
  6438. In addition to defining the HTTP/1.1 protocol, this document serves
  6439. as the specification for the Internet media type "message/http" and
  6440. "application/http". The message/http type can be used to enclose a
  6441. single HTTP request or response message, provided that it obeys the
  6442. MIME restrictions for all "message" types regarding line length and
  6443. encodings. The application/http type can be used to enclose a
  6444. pipeline of one or more HTTP request or response messages (not
  6445. intermixed). The following is to be registered with IANA [17].
  6446. Media Type name: message
  6447. Media subtype name: http
  6448. Required parameters: none
  6449. Optional parameters: version, msgtype
  6450. version: The HTTP-Version number of the enclosed message
  6451. (e.g., "1.1"). If not present, the version can be
  6452. determined from the first line of the body.
  6453. msgtype: The message type -- "request" or "response". If not
  6454. present, the type can be determined from the first
  6455. line of the body.
  6456. Encoding considerations: only "7bit", "8bit", or "binary" are
  6457. permitted
  6458. Security considerations: none
  6459. Media Type name: application
  6460. Media subtype name: http
  6461. Required parameters: none
  6462. Optional parameters: version, msgtype
  6463. version: The HTTP-Version number of the enclosed messages
  6464. (e.g., "1.1"). If not present, the version can be
  6465. determined from the first line of the body.
  6466. msgtype: The message type -- "request" or "response". If not
  6467. present, the type can be determined from the first
  6468. line of the body.
  6469. Encoding considerations: HTTP messages enclosed by this type
  6470. are in "binary" format; use of an appropriate
  6471. Content-Transfer-Encoding is required when
  6472. transmitted via E-mail.
  6473. Security considerations: none
  6474. Fielding, et al. Standards Track [Page 164]
  6475. RFC 2616 HTTP/1.1 June 1999
  6476. 19.2 Internet Media Type multipart/byteranges
  6477. When an HTTP 206 (Partial Content) response message includes the
  6478. content of multiple ranges (a response to a request for multiple
  6479. non-overlapping ranges), these are transmitted as a multipart
  6480. message-body. The media type for this purpose is called
  6481. "multipart/byteranges".
  6482. The multipart/byteranges media type includes two or more parts, each
  6483. with its own Content-Type and Content-Range fields. The required
  6484. boundary parameter specifies the boundary string used to separate
  6485. each body-part.
  6486. Media Type name: multipart
  6487. Media subtype name: byteranges
  6488. Required parameters: boundary
  6489. Optional parameters: none
  6490. Encoding considerations: only "7bit", "8bit", or "binary" are
  6491. permitted
  6492. Security considerations: none
  6493. For example:
  6494. HTTP/1.1 206 Partial Content
  6495. Date: Wed, 15 Nov 1995 06:25:24 GMT
  6496. Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
  6497. Content-type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
  6498. --THIS_STRING_SEPARATES
  6499. Content-type: application/pdf
  6500. Content-range: bytes 500-999/8000
  6501. ...the first range...
  6502. --THIS_STRING_SEPARATES
  6503. Content-type: application/pdf
  6504. Content-range: bytes 7000-7999/8000
  6505. ...the second range
  6506. --THIS_STRING_SEPARATES--
  6507. Notes:
  6508. 1) Additional CRLFs may precede the first boundary string in the
  6509. entity.
  6510. Fielding, et al. Standards Track [Page 165]
  6511. RFC 2616 HTTP/1.1 June 1999
  6512. 2) Although RFC 2046 [40] permits the boundary string to be
  6513. quoted, some existing implementations handle a quoted boundary
  6514. string incorrectly.
  6515. 3) A number of browsers and servers were coded to an early draft
  6516. of the byteranges specification to use a media type of
  6517. multipart/x-byteranges, which is almost, but not quite
  6518. compatible with the version documented in HTTP/1.1.
  6519. 19.3 Tolerant Applications
  6520. Although this document specifies the requirements for the generation
  6521. of HTTP/1.1 messages, not all applications will be correct in their
  6522. implementation. We therefore recommend that operational applications
  6523. be tolerant of deviations whenever those deviations can be
  6524. interpreted unambiguously.
  6525. Clients SHOULD be tolerant in parsing the Status-Line and servers
  6526. tolerant when parsing the Request-Line. In particular, they SHOULD
  6527. accept any amount of SP or HT characters between fields, even though
  6528. only a single SP is required.
  6529. The line terminator for message-header fields is the sequence CRLF.
  6530. However, we recommend that applications, when parsing such headers,
  6531. recognize a single LF as a line terminator and ignore the leading CR.
  6532. The character set of an entity-body SHOULD be labeled as the lowest
  6533. common denominator of the character codes used within that body, with
  6534. the exception that not labeling the entity is preferred over labeling
  6535. the entity with the labels US-ASCII or ISO-8859-1. See section 3.7.1
  6536. and 3.4.1.
  6537. Additional rules for requirements on parsing and encoding of dates
  6538. and other potential problems with date encodings include:
  6539. - HTTP/1.1 clients and caches SHOULD assume that an RFC-850 date
  6540. which appears to be more than 50 years in the future is in fact
  6541. in the past (this helps solve the "year 2000" problem).
  6542. - An HTTP/1.1 implementation MAY internally represent a parsed
  6543. Expires date as earlier than the proper value, but MUST NOT
  6544. internally represent a parsed Expires date as later than the
  6545. proper value.
  6546. - All expiration-related calculations MUST be done in GMT. The
  6547. local time zone MUST NOT influence the calculation or comparison
  6548. of an age or expiration time.
  6549. Fielding, et al. Standards Track [Page 166]
  6550. RFC 2616 HTTP/1.1 June 1999
  6551. - If an HTTP header incorrectly carries a date value with a time
  6552. zone other than GMT, it MUST be converted into GMT using the
  6553. most conservative possible conversion.
  6554. 19.4 Differences Between HTTP Entities and RFC 2045 Entities
  6555. HTTP/1.1 uses many of the constructs defined for Internet Mail (RFC
  6556. 822 [9]) and the Multipurpose Internet Mail Extensions (MIME [7]) to
  6557. allow entities to be transmitted in an open variety of
  6558. representations and with extensible mechanisms. However, RFC 2045
  6559. discusses mail, and HTTP has a few features that are different from
  6560. those described in RFC 2045. These differences were carefully chosen
  6561. to optimize performance over binary connections, to allow greater
  6562. freedom in the use of new media types, to make date comparisons
  6563. easier, and to acknowledge the practice of some early HTTP servers
  6564. and clients.
  6565. This appendix describes specific areas where HTTP differs from RFC
  6566. 2045. Proxies and gateways to strict MIME environments SHOULD be
  6567. aware of these differences and provide the appropriate conversions
  6568. where necessary. Proxies and gateways from MIME environments to HTTP
  6569. also need to be aware of the differences because some conversions
  6570. might be required.
  6571. 19.4.1 MIME-Version
  6572. HTTP is not a MIME-compliant protocol. However, HTTP/1.1 messages MAY
  6573. include a single MIME-Version general-header field to indicate what
  6574. version of the MIME protocol was used to construct the message. Use
  6575. of the MIME-Version header field indicates that the message is in
  6576. full compliance with the MIME protocol (as defined in RFC 2045[7]).
  6577. Proxies/gateways are responsible for ensuring full compliance (where
  6578. possible) when exporting HTTP messages to strict MIME environments.
  6579. MIME-Version = "MIME-Version" ":" 1*DIGIT "." 1*DIGIT
  6580. MIME version "1.0" is the default for use in HTTP/1.1. However,
  6581. HTTP/1.1 message parsing and semantics are defined by this document
  6582. and not the MIME specification.
  6583. 19.4.2 Conversion to Canonical Form
  6584. RFC 2045 [7] requires that an Internet mail entity be converted to
  6585. canonical form prior to being transferred, as described in section 4
  6586. of RFC 2049 [48]. Section 3.7.1 of this document describes the forms
  6587. allowed for subtypes of the "text" media type when transmitted over
  6588. HTTP. RFC 2046 requires that content with a type of "text" represent
  6589. line breaks as CRLF and forbids the use of CR or LF outside of line
  6590. Fielding, et al. Standards Track [Page 167]
  6591. RFC 2616 HTTP/1.1 June 1999
  6592. break sequences. HTTP allows CRLF, bare CR, and bare LF to indicate a
  6593. line break within text content when a message is transmitted over
  6594. HTTP.
  6595. Where it is possible, a proxy or gateway from HTTP to a strict MIME
  6596. environment SHOULD translate all line breaks within the text media
  6597. types described in section 3.7.1 of this document to the RFC 2049
  6598. canonical form of CRLF. Note, however, that this might be complicated
  6599. by the presence of a Content-Encoding and by the fact that HTTP
  6600. allows the use of some character sets which do not use octets 13 and
  6601. 10 to represent CR and LF, as is the case for some multi-byte
  6602. character sets.
  6603. Implementors should note that conversion will break any cryptographic
  6604. checksums applied to the original content unless the original content
  6605. is already in canonical form. Therefore, the canonical form is
  6606. recommended for any content that uses such checksums in HTTP.
  6607. 19.4.3 Conversion of Date Formats
  6608. HTTP/1.1 uses a restricted set of date formats (section 3.3.1) to
  6609. simplify the process of date comparison. Proxies and gateways from
  6610. other protocols SHOULD ensure that any Date header field present in a
  6611. message conforms to one of the HTTP/1.1 formats and rewrite the date
  6612. if necessary.
  6613. 19.4.4 Introduction of Content-Encoding
  6614. RFC 2045 does not include any concept equivalent to HTTP/1.1's
  6615. Content-Encoding header field. Since this acts as a modifier on the
  6616. media type, proxies and gateways from HTTP to MIME-compliant
  6617. protocols MUST either change the value of the Content-Type header
  6618. field or decode the entity-body before forwarding the message. (Some
  6619. experimental applications of Content-Type for Internet mail have used
  6620. a media-type parameter of ";conversions=<content-coding>" to perform
  6621. a function equivalent to Content-Encoding. However, this parameter is
  6622. not part of RFC 2045.)
  6623. 19.4.5 No Content-Transfer-Encoding
  6624. HTTP does not use the Content-Transfer-Encoding (CTE) field of RFC
  6625. 2045. Proxies and gateways from MIME-compliant protocols to HTTP MUST
  6626. remove any non-identity CTE ("quoted-printable" or "base64") encoding
  6627. prior to delivering the response message to an HTTP client.
  6628. Proxies and gateways from HTTP to MIME-compliant protocols are
  6629. responsible for ensuring that the message is in the correct format
  6630. and encoding for safe transport on that protocol, where "safe
  6631. Fielding, et al. Standards Track [Page 168]
  6632. RFC 2616 HTTP/1.1 June 1999
  6633. transport" is defined by the limitations of the protocol being used.
  6634. Such a proxy or gateway SHOULD label the data with an appropriate
  6635. Content-Transfer-Encoding if doing so will improve the likelihood of
  6636. safe transport over the destination protocol.
  6637. 19.4.6 Introduction of Transfer-Encoding
  6638. HTTP/1.1 introduces the Transfer-Encoding header field (section
  6639. 14.41). Proxies/gateways MUST remove any transfer-coding prior to
  6640. forwarding a message via a MIME-compliant protocol.
  6641. A process for decoding the "chunked" transfer-coding (section 3.6)
  6642. can be represented in pseudo-code as:
  6643. length := 0
  6644. read chunk-size, chunk-extension (if any) and CRLF
  6645. while (chunk-size > 0) {
  6646. read chunk-data and CRLF
  6647. append chunk-data to entity-body
  6648. length := length + chunk-size
  6649. read chunk-size and CRLF
  6650. }
  6651. read entity-header
  6652. while (entity-header not empty) {
  6653. append entity-header to existing header fields
  6654. read entity-header
  6655. }
  6656. Content-Length := length
  6657. Remove "chunked" from Transfer-Encoding
  6658. 19.4.7 MHTML and Line Length Limitations
  6659. HTTP implementations which share code with MHTML [45] implementations
  6660. need to be aware of MIME line length limitations. Since HTTP does not
  6661. have this limitation, HTTP does not fold long lines. MHTML messages
  6662. being transported by HTTP follow all conventions of MHTML, including
  6663. line length limitations and folding, canonicalization, etc., since
  6664. HTTP transports all message-bodies as payload (see section 3.7.2) and
  6665. does not interpret the content or any MIME header lines that might be
  6666. contained therein.
  6667. 19.5 Additional Features
  6668. RFC 1945 and RFC 2068 document protocol elements used by some
  6669. existing HTTP implementations, but not consistently and correctly
  6670. across most HTTP/1.1 applications. Implementors are advised to be
  6671. aware of these features, but cannot rely upon their presence in, or
  6672. interoperability with, other HTTP/1.1 applications. Some of these
  6673. Fielding, et al. Standards Track [Page 169]
  6674. RFC 2616 HTTP/1.1 June 1999
  6675. describe proposed experimental features, and some describe features
  6676. that experimental deployment found lacking that are now addressed in
  6677. the base HTTP/1.1 specification.
  6678. A number of other headers, such as Content-Disposition and Title,
  6679. from SMTP and MIME are also often implemented (see RFC 2076 [37]).
  6680. 19.5.1 Content-Disposition
  6681. The Content-Disposition response-header field has been proposed as a
  6682. means for the origin server to suggest a default filename if the user
  6683. requests that the content is saved to a file. This usage is derived
  6684. from the definition of Content-Disposition in RFC 1806 [35].
  6685. content-disposition = "Content-Disposition" ":"
  6686. disposition-type *( ";" disposition-parm )
  6687. disposition-type = "attachment" | disp-extension-token
  6688. disposition-parm = filename-parm | disp-extension-parm
  6689. filename-parm = "filename" "=" quoted-string
  6690. disp-extension-token = token
  6691. disp-extension-parm = token "=" ( token | quoted-string )
  6692. An example is
  6693. Content-Disposition: attachment; filename="fname.ext"
  6694. The receiving user agent SHOULD NOT respect any directory path
  6695. information present in the filename-parm parameter, which is the only
  6696. parameter believed to apply to HTTP implementations at this time. The
  6697. filename SHOULD be treated as a terminal component only.
  6698. If this header is used in a response with the application/octet-
  6699. stream content-type, the implied suggestion is that the user agent
  6700. should not display the response, but directly enter a `save response
  6701. as...' dialog.
  6702. See section 15.5 for Content-Disposition security issues.
  6703. 19.6 Compatibility with Previous Versions
  6704. It is beyond the scope of a protocol specification to mandate
  6705. compliance with previous versions. HTTP/1.1 was deliberately
  6706. designed, however, to make supporting previous versions easy. It is
  6707. worth noting that, at the time of composing this specification
  6708. (1996), we would expect commercial HTTP/1.1 servers to:
  6709. - recognize the format of the Request-Line for HTTP/0.9, 1.0, and
  6710. 1.1 requests;
  6711. Fielding, et al. Standards Track [Page 170]
  6712. RFC 2616 HTTP/1.1 June 1999
  6713. - understand any valid request in the format of HTTP/0.9, 1.0, or
  6714. 1.1;
  6715. - respond appropriately with a message in the same major version
  6716. used by the client.
  6717. And we would expect HTTP/1.1 clients to:
  6718. - recognize the format of the Status-Line for HTTP/1.0 and 1.1
  6719. responses;
  6720. - understand any valid response in the format of HTTP/0.9, 1.0, or
  6721. 1.1.
  6722. For most implementations of HTTP/1.0, each connection is established
  6723. by the client prior to the request and closed by the server after
  6724. sending the response. Some implementations implement the Keep-Alive
  6725. version of persistent connections described in section 19.7.1 of RFC
  6726. 2068 [33].
  6727. 19.6.1 Changes from HTTP/1.0
  6728. This section summarizes major differences between versions HTTP/1.0
  6729. and HTTP/1.1.
  6730. 19.6.1.1 Changes to Simplify Multi-homed Web Servers and Conserve IP
  6731. Addresses
  6732. The requirements that clients and servers support the Host request-
  6733. header, report an error if the Host request-header (section 14.23) is
  6734. missing from an HTTP/1.1 request, and accept absolute URIs (section
  6735. 5.1.2) are among the most important changes defined by this
  6736. specification.
  6737. Older HTTP/1.0 clients assumed a one-to-one relationship of IP
  6738. addresses and servers; there was no other established mechanism for
  6739. distinguishing the intended server of a request than the IP address
  6740. to which that request was directed. The changes outlined above will
  6741. allow the Internet, once older HTTP clients are no longer common, to
  6742. support multiple Web sites from a single IP address, greatly
  6743. simplifying large operational Web servers, where allocation of many
  6744. IP addresses to a single host has created serious problems. The
  6745. Internet will also be able to recover the IP addresses that have been
  6746. allocated for the sole purpose of allowing special-purpose domain
  6747. names to be used in root-level HTTP URLs. Given the rate of growth of
  6748. the Web, and the number of servers already deployed, it is extremely
  6749. Fielding, et al. Standards Track [Page 171]
  6750. RFC 2616 HTTP/1.1 June 1999
  6751. important that all implementations of HTTP (including updates to
  6752. existing HTTP/1.0 applications) correctly implement these
  6753. requirements:
  6754. - Both clients and servers MUST support the Host request-header.
  6755. - A client that sends an HTTP/1.1 request MUST send a Host header.
  6756. - Servers MUST report a 400 (Bad Request) error if an HTTP/1.1
  6757. request does not include a Host request-header.
  6758. - Servers MUST accept absolute URIs.
  6759. 19.6.2 Compatibility with HTTP/1.0 Persistent Connections
  6760. Some clients and servers might wish to be compatible with some
  6761. previous implementations of persistent connections in HTTP/1.0
  6762. clients and servers. Persistent connections in HTTP/1.0 are
  6763. explicitly negotiated as they are not the default behavior. HTTP/1.0
  6764. experimental implementations of persistent connections are faulty,
  6765. and the new facilities in HTTP/1.1 are designed to rectify these
  6766. problems. The problem was that some existing 1.0 clients may be
  6767. sending Keep-Alive to a proxy server that doesn't understand
  6768. Connection, which would then erroneously forward it to the next
  6769. inbound server, which would establish the Keep-Alive connection and
  6770. result in a hung HTTP/1.0 proxy waiting for the close on the
  6771. response. The result is that HTTP/1.0 clients must be prevented from
  6772. using Keep-Alive when talking to proxies.
  6773. However, talking to proxies is the most important use of persistent
  6774. connections, so that prohibition is clearly unacceptable. Therefore,
  6775. we need some other mechanism for indicating a persistent connection
  6776. is desired, which is safe to use even when talking to an old proxy
  6777. that ignores Connection. Persistent connections are the default for
  6778. HTTP/1.1 messages; we introduce a new keyword (Connection: close) for
  6779. declaring non-persistence. See section 14.10.
  6780. The original HTTP/1.0 form of persistent connections (the Connection:
  6781. Keep-Alive and Keep-Alive header) is documented in RFC 2068. [33]
  6782. 19.6.3 Changes from RFC 2068
  6783. This specification has been carefully audited to correct and
  6784. disambiguate key word usage; RFC 2068 had many problems in respect to
  6785. the conventions laid out in RFC 2119 [34].
  6786. Clarified which error code should be used for inbound server failures
  6787. (e.g. DNS failures). (Section 10.5.5).
  6788. Fielding, et al. Standards Track [Page 172]
  6789. RFC 2616 HTTP/1.1 June 1999
  6790. CREATE had a race that required an Etag be sent when a resource is
  6791. first created. (Section 10.2.2).
  6792. Content-Base was deleted from the specification: it was not
  6793. implemented widely, and there is no simple, safe way to introduce it
  6794. without a robust extension mechanism. In addition, it is used in a
  6795. similar, but not identical fashion in MHTML [45].
  6796. Transfer-coding and message lengths all interact in ways that
  6797. required fixing exactly when chunked encoding is used (to allow for
  6798. transfer encoding that may not be self delimiting); it was important
  6799. to straighten out exactly how message lengths are computed. (Sections
  6800. 3.6, 4.4, 7.2.2, 13.5.2, 14.13, 14.16)
  6801. A content-coding of "identity" was introduced, to solve problems
  6802. discovered in caching. (section 3.5)
  6803. Quality Values of zero should indicate that "I don't want something"
  6804. to allow clients to refuse a representation. (Section 3.9)
  6805. The use and interpretation of HTTP version numbers has been clarified
  6806. by RFC 2145. Require proxies to upgrade requests to highest protocol
  6807. version they support to deal with problems discovered in HTTP/1.0
  6808. implementations (Section 3.1)
  6809. Charset wildcarding is introduced to avoid explosion of character set
  6810. names in accept headers. (Section 14.2)
  6811. A case was missed in the Cache-Control model of HTTP/1.1; s-maxage
  6812. was introduced to add this missing case. (Sections 13.4, 14.8, 14.9,
  6813. 14.9.3)
  6814. The Cache-Control: max-age directive was not properly defined for
  6815. responses. (Section 14.9.3)
  6816. There are situations where a server (especially a proxy) does not
  6817. know the full length of a response but is capable of serving a
  6818. byterange request. We therefore need a mechanism to allow byteranges
  6819. with a content-range not indicating the full length of the message.
  6820. (Section 14.16)
  6821. Range request responses would become very verbose if all meta-data
  6822. were always returned; by allowing the server to only send needed
  6823. headers in a 206 response, this problem can be avoided. (Section
  6824. 10.2.7, 13.5.3, and 14.27)
  6825. Fielding, et al. Standards Track [Page 173]
  6826. RFC 2616 HTTP/1.1 June 1999
  6827. Fix problem with unsatisfiable range requests; there are two cases:
  6828. syntactic problems, and range doesn't exist in the document. The 416
  6829. status code was needed to resolve this ambiguity needed to indicate
  6830. an error for a byte range request that falls outside of the actual
  6831. contents of a document. (Section 10.4.17, 14.16)
  6832. Rewrite of message transmission requirements to make it much harder
  6833. for implementors to get it wrong, as the consequences of errors here
  6834. can have significant impact on the Internet, and to deal with the
  6835. following problems:
  6836. 1. Changing "HTTP/1.1 or later" to "HTTP/1.1", in contexts where
  6837. this was incorrectly placing a requirement on the behavior of
  6838. an implementation of a future version of HTTP/1.x
  6839. 2. Made it clear that user-agents should retry requests, not
  6840. "clients" in general.
  6841. 3. Converted requirements for clients to ignore unexpected 100
  6842. (Continue) responses, and for proxies to forward 100 responses,
  6843. into a general requirement for 1xx responses.
  6844. 4. Modified some TCP-specific language, to make it clearer that
  6845. non-TCP transports are possible for HTTP.
  6846. 5. Require that the origin server MUST NOT wait for the request
  6847. body before it sends a required 100 (Continue) response.
  6848. 6. Allow, rather than require, a server to omit 100 (Continue) if
  6849. it has already seen some of the request body.
  6850. 7. Allow servers to defend against denial-of-service attacks and
  6851. broken clients.
  6852. This change adds the Expect header and 417 status code. The message
  6853. transmission requirements fixes are in sections 8.2, 10.4.18,
  6854. 8.1.2.2, 13.11, and 14.20.
  6855. Proxies should be able to add Content-Length when appropriate.
  6856. (Section 13.5.2)
  6857. Clean up confusion between 403 and 404 responses. (Section 10.4.4,
  6858. 10.4.5, and 10.4.11)
  6859. Warnings could be cached incorrectly, or not updated appropriately.
  6860. (Section 13.1.2, 13.2.4, 13.5.2, 13.5.3, 14.9.3, and 14.46) Warning
  6861. also needed to be a general header, as PUT or other methods may have
  6862. need for it in requests.
  6863. Fielding, et al. Standards Track [Page 174]
  6864. RFC 2616 HTTP/1.1 June 1999
  6865. Transfer-coding had significant problems, particularly with
  6866. interactions with chunked encoding. The solution is that transfer-
  6867. codings become as full fledged as content-codings. This involves
  6868. adding an IANA registry for transfer-codings (separate from content
  6869. codings), a new header field (TE) and enabling trailer headers in the
  6870. future. Transfer encoding is a major performance benefit, so it was
  6871. worth fixing [39]. TE also solves another, obscure, downward
  6872. interoperability problem that could have occurred due to interactions
  6873. between authentication trailers, chunked encoding and HTTP/1.0
  6874. clients.(Section 3.6, 3.6.1, and 14.39)
  6875. The PATCH, LINK, UNLINK methods were defined but not commonly
  6876. implemented in previous versions of this specification. See RFC 2068
  6877. [33].
  6878. The Alternates, Content-Version, Derived-From, Link, URI, Public and
  6879. Content-Base header fields were defined in previous versions of this
  6880. specification, but not commonly implemented. See RFC 2068 [33].
  6881. 20 Index
  6882. Please see the PostScript version of this RFC for the INDEX.
  6883. Fielding, et al. Standards Track [Page 175]
  6884. RFC 2616 HTTP/1.1 June 1999
  6885. 21. Full Copyright Statement
  6886. Copyright (C) The Internet Society (1999). All Rights Reserved.
  6887. This document and translations of it may be copied and furnished to
  6888. others, and derivative works that comment on or otherwise explain it
  6889. or assist in its implementation may be prepared, copied, published
  6890. and distributed, in whole or in part, without restriction of any
  6891. kind, provided that the above copyright notice and this paragraph are
  6892. included on all such copies and derivative works. However, this
  6893. document itself may not be modified in any way, such as by removing
  6894. the copyright notice or references to the Internet Society or other
  6895. Internet organizations, except as needed for the purpose of
  6896. developing Internet standards in which case the procedures for
  6897. copyrights defined in the Internet Standards process must be
  6898. followed, or as required to translate it into languages other than
  6899. English.
  6900. The limited permissions granted above are perpetual and will not be
  6901. revoked by the Internet Society or its successors or assigns.
  6902. This document and the information contained herein is provided on an
  6903. "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  6904. TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  6905. BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  6906. HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  6907. MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  6908. Acknowledgement
  6909. Funding for the RFC Editor function is currently provided by the
  6910. Internet Society.
  6911. Fielding, et al. Standards Track [Page 176]