reference.qbk 1.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727
  1. [/
  2. Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ]
  6. [section:boost__beast__allocate_stable allocate_stable] [indexterm1 allocate_stable]
  7. Allocate a temporary object to hold stable asynchronous operation state. [heading Synopsis] Defined in header [include_file boost/beast/core/async_base.hpp] ``` template< class State, class __Handler__, class __Executor1__, class __Allocator__, class... Args> State& allocate_stable( stable_async_base< Handler, Executor1, Allocator >& base, Args&&... args); ``` [heading Description]
  8. The object will be destroyed just before the completion handler is invoked, or when the base is destroyed.
  9. [heading Template Parameters] [table [[Type][Description]] [[`State`][
  10. The type of object to allocate. ]] ]
  11. [heading Parameters] [table [[Name][Description]] [[`base`][
  12. The helper to allocate from. ]] [[`args`][
  13. An optional list of parameters to forward to the constructor of the object being allocated. ]] ]
  14. [heading See Also]
  15. [link beast.ref.boost__beast__stable_async_base `stable_async_base`]
  16. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__async_base async_base]
  17. Base class to assist writing composed operations. [heading Synopsis] Defined in header [include_file boost/beast/core/async_base.hpp] ``` template< class __Handler__, class __Executor1__, class __Allocator__ = std::allocator<void>> class async_base ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__async_base.allocator_type [*allocator_type]]] [ The type of allocator associated with this object. ] ] [ [[link beast.ref.boost__beast__async_base.executor_type [*executor_type]]] [ The type of executor associated with this object. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__async_base.async_base [*async_base]]] [ Constructor. Move Constructor. ] ] [ [[link beast.ref.boost__beast__async_base.complete [*complete]]] [ Invoke the final completion handler, maybe using post. ] ] [ [[link beast.ref.boost__beast__async_base.complete_now [*complete_now]]] [ Invoke the final completion handler. ] ] [ [[link beast.ref.boost__beast__async_base.get_allocator [*get_allocator]]] [ Returns the allocator associated with this object. ] ] [ [[link beast.ref.boost__beast__async_base.get_executor [*get_executor]]] [ Returns the executor associated with this object. ] ] [ [[link beast.ref.boost__beast__async_base.handler [*handler]]] [ Returns the handler associated with this object. ] ] [ [[link beast.ref.boost__beast__async_base.operator_eq_ [*operator=]]] [ ] ] [ [[link beast.ref.boost__beast__async_base.release_handler [*release_handler]]] [ Returns ownership of the handler associated with this object. ] ] [ [[link beast.ref.boost__beast__async_base.async_base_dtor_ [*~async_base]]] [ ] ] ] [heading Description]
  18. A function object submitted to intermediate initiating functions during a composed operation may derive from this type to inherit all of the boilerplate to forward the executor, allocator, and legacy customization points associated with the completion handler invoked at the end of the composed operation.
  19. The composed operation must be typical; that is, associated with one executor of an I/O object, and invoking a caller-provided completion handler when the operation is finished. Classes derived from [link beast.ref.boost__beast__async_base `async_base`] will acquire these properties:
  20. * Ownership of the final completion handler provided upon construction.
  21. * If the final handler has an associated allocator, this allocator will be propagated to the composed operation subclass. Otherwise, the associated allocator will be the type specified in the allocator template parameter, or the default of `std::allocator<void>` if the parameter is omitted.
  22. * If the final handler has an associated executor, then it will be used as the executor associated with the composed operation. Otherwise, the specified `Executor1` will be the type of executor associated with the composed operation.
  23. * An instance of `net::executor_work_guard` for the instance of `Executor1` shall be maintained until either the final handler is invoked, or the operation base is destroyed, whichever comes first.
  24. * Calls to the legacy customization points `asio_handler_invoke`, `asio_handler_allocate`, `asio_handler_deallocate`, and `asio_handler_is_continuation`, which use argument-dependent lookup, will be forwarded to the legacy customization points associated with the handler.
  25. [heading Example]
  26. The following code demonstrates how [link beast.ref.boost__beast__async_base `async_base`] may be be used to assist authoring an asynchronous initiating function, by providing all of the boilerplate to manage the final completion handler in a way that maintains the allocator and executor associations:
  27. ``` // Asynchronously read into a buffer until the buffer is full, or an error occurs
  28. template<class AsyncReadStream, class ReadHandler>
  29. typename net::async_result<ReadHandler, void(error_code, std::size_t)>::return_type
  30. async_read(AsyncReadStream& stream, net::mutable_buffer buffer, ReadHandler&& handler)
  31. {
  32. using handler_type = BOOST_ASIO_HANDLER_TYPE(ReadHandler, void(error_code, std::size_t));
  33. using base_type = async_base<handler_type, typename AsyncReadStream::executor_type>;
  34. struct op : base_type
  35. {
  36. AsyncReadStream& stream_;
  37. net::mutable_buffer buffer_;
  38. std::size_t total_bytes_transferred_;
  39. op(
  40. AsyncReadStream& stream,
  41. net::mutable_buffer buffer,
  42. handler_type& handler)
  43. : base_type(std::move(handler), stream.get_executor())
  44. , stream_(stream)
  45. , buffer_(buffer)
  46. , total_bytes_transferred_(0)
  47. {
  48. (*this)({}, 0, false); // start the operation
  49. }
  50. void operator()(error_code ec, std::size_t bytes_transferred, bool is_continuation = true)
  51. {
  52. // Adjust the count of bytes and advance our buffer
  53. total_bytes_transferred_ += bytes_transferred;
  54. buffer_ = buffer_ + bytes_transferred;
  55. // Keep reading until buffer is full or an error occurs
  56. if(! ec && buffer_.size() > 0)
  57. return stream_.async_read_some(buffer_, std::move(*this));
  58. // Call the completion handler with the result. If `is_continuation` is
  59. // false, which happens on the first time through this function, then
  60. // `net::post` will be used to call the completion handler, otherwise
  61. // the completion handler will be invoked directly.
  62. this->complete(is_continuation, ec, total_bytes_transferred_);
  63. }
  64. };
  65. net::async_completion<ReadHandler, void(error_code, std::size_t)> init{handler};
  66. op(stream, buffer, init.completion_handler);
  67. return init.result.get();
  68. }
  69. ```
  70. Data members of composed operations implemented as completion handlers do not have stable addresses, as the composed operation object is move constructed upon each call to an initiating function. For most operations this is not a problem. For complex operations requiring stable temporary storage, the class [link beast.ref.boost__beast__stable_async_base `stable_async_base`] is provided which offers additional functionality:
  71. * The free function [link beast.ref.boost__beast__allocate_stable `allocate_stable`] may be used to allocate one or more temporary objects associated with the composed operation.
  72. * Memory for stable temporary objects is allocated using the allocator associated with the composed operation.
  73. * Stable temporary objects are automatically destroyed, and the memory freed using the associated allocator, either before the final completion handler is invoked (a Networking requirement) or when the composed operation is destroyed, whichever occurs first.
  74. [heading Temporary Storage Example]
  75. The following example demonstrates how a composed operation may store a temporary object.
  76. ``` ```
  77. [heading Template Parameters] [table [[Type][Description]] [[`Handler`][
  78. The type of the completion handler to store. This type must meet the requirements of ['CompletionHandler]. ]] [[`Executor1`][
  79. The type of the executor used when the handler has no associated executor. An instance of this type must be provided upon construction. The implementation will maintain an executor work guard and a copy of this instance. ]] [[`Allocator`][
  80. The allocator type to use if the handler does not have an associated allocator. If this parameter is omitted, then `std::allocator<void>` will be used. If the specified allocator is not default constructible, an instance of the type must be provided upon construction. ]] ]
  81. [heading See Also]
  82. [link beast.ref.boost__beast__stable_async_base `stable_async_base`]
  83. [section:allocator_type async_base::allocator_type] [indexterm2 allocator_type..async_base]
  84. The type of allocator associated with this object. [heading Synopsis] ``` using allocator_type = net::associated_allocator_t< Handler, Allocator >; ``` [heading Description]
  85. If a class derived from [link beast.ref.boost__beast__async_base `async_base`] is a completion handler, then the associated allocator of the derived class will be this type. [endsect] [section:async_base async_base::async_base] [indexterm2 async_base..async_base]
  86. Constructor. ``` template< class __Handler__> ``[link beast.ref.boost__beast__async_base.async_base.overload1 async_base]``( Handler&& handler, Executor1 const& ex1, Allocator const& alloc = Allocator()); ``[''''&raquo;''' [link beast.ref.boost__beast__async_base.async_base.overload1 more...]]`` ```
  87. Move Constructor. ``` ``[link beast.ref.boost__beast__async_base.async_base.overload2 async_base]``( async_base&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__async_base.async_base.overload2 more...]]`` ``[link beast.ref.boost__beast__async_base.async_base.overload3 async_base]``( async_base const&); ``[''''&raquo;''' [link beast.ref.boost__beast__async_base.async_base.overload3 more...]]`` ``` [section:overload1 async_base::async_base (1 of 3 overloads)]
  88. Constructor. [heading Synopsis] ``` template< class __Handler__> async_base( Handler&& handler, Executor1 const& ex1, Allocator const& alloc = Allocator()); ``` [heading Description]
  89. [heading Parameters] [table [[Name][Description]] [[`handler`][
  90. The final completion handler. The type of this object must meet the requirements of ['CompletionHandler]. The implementation takes ownership of the handler by performing a decay-copy. ]] [[`ex1`][
  91. The executor associated with the implied I/O object target of the operation. The implementation shall maintain an executor work guard for the lifetime of the operation, or until the final completion handler is invoked, whichever is shorter. ]] [[`alloc`][
  92. The allocator to be associated with objects derived from this class. If `Allocator` is default-constructible, this parameter is optional and may be omitted. ]] ]
  93. [endsect] [section:overload2 async_base::async_base (2 of 3 overloads)]
  94. Move Constructor. [heading Synopsis] ``` async_base( async_base&& other); ``` [heading Description] [endsect] [section:overload3 async_base::async_base (3 of 3 overloads)] [heading Synopsis] ``` async_base( async_base const&); ``` [heading Description] [endsect] [endsect] [section:complete async_base::complete] [indexterm2 complete..async_base]
  95. Invoke the final completion handler, maybe using post. [heading Synopsis] ``` template< class... Args> void complete( bool is_continuation, Args&&... args); ``` [heading Description]
  96. This invokes the final completion handler with the specified arguments forwarded. It is undefined to call either of [link beast.ref.boost__beast__async_base.complete `async_base::complete`] or [link beast.ref.boost__beast__async_base.complete_now `async_base::complete_now`] more than once.
  97. Any temporary objects allocated with [link beast.ref.boost__beast__allocate_stable `allocate_stable`] will be automatically destroyed before the final completion handler is invoked.
  98. [heading Parameters] [table [[Name][Description]] [[`is_continuation`][
  99. If this value is `false`, then the handler will be submitted to the executor using `net::post`. Otherwise the handler will be invoked as if by calling [link beast.ref.boost__beast__async_base.complete_now `async_base::complete_now`]. ]] [[`args`][
  100. A list of optional parameters to invoke the handler with. The completion handler must be invocable with the parameter list, or else a compilation error will result. ]] ]
  101. [endsect] [section:complete_now async_base::complete_now] [indexterm2 complete_now..async_base]
  102. Invoke the final completion handler. [heading Synopsis] ``` template< class... Args> void complete_now( Args&&... args); ``` [heading Description]
  103. This invokes the final completion handler with the specified arguments forwarded. It is undefined to call either of [link beast.ref.boost__beast__async_base.complete `async_base::complete`] or [link beast.ref.boost__beast__async_base.complete_now `async_base::complete_now`] more than once.
  104. Any temporary objects allocated with [link beast.ref.boost__beast__allocate_stable `allocate_stable`] will be automatically destroyed before the final completion handler is invoked.
  105. [heading Parameters] [table [[Name][Description]] [[`args`][
  106. A list of optional parameters to invoke the handler with. The completion handler must be invocable with the parameter list, or else a compilation error will result. ]] ]
  107. [endsect] [section:executor_type async_base::executor_type] [indexterm2 executor_type..async_base]
  108. The type of executor associated with this object. [heading Synopsis] ``` using executor_type = net::associated_executor_t< Handler, Executor1 >; ``` [heading Description]
  109. If a class derived from [link beast.ref.boost__beast__async_base `async_base`] is a completion handler, then the associated executor of the derived class will be this type. [endsect] [section:get_allocator async_base::get_allocator] [indexterm2 get_allocator..async_base]
  110. Returns the allocator associated with this object. [heading Synopsis] ``` allocator_type get_allocator() const; ``` [heading Description]
  111. If a class derived from [link beast.ref.boost__beast__async_base `async_base`] is a completion handler, then the object returned from this function will be used as the associated allocator of the derived class. [endsect] [section:get_executor async_base::get_executor] [indexterm2 get_executor..async_base]
  112. Returns the executor associated with this object. [heading Synopsis] ``` executor_type get_executor() const; ``` [heading Description]
  113. If a class derived from [link beast.ref.boost__beast__async_base `async_base`] is a completion handler, then the object returned from this function will be used as the associated executor of the derived class. [endsect] [section:handler async_base::handler] [indexterm2 handler..async_base]
  114. Returns the handler associated with this object. [heading Synopsis] ``` Handler const & handler() const; ``` [heading Description] [endsect] [section:operator_eq_ async_base::operator=] [indexterm2 operator=..async_base] [heading Synopsis] ``` async_base& operator=( async_base const&); ``` [heading Description] [endsect] [section:release_handler async_base::release_handler] [indexterm2 release_handler..async_base]
  115. Returns ownership of the handler associated with this object. [heading Synopsis] ``` Handler release_handler(); ``` [heading Description]
  116. This function is used to transfer ownership of the handler to the caller, by move-construction. After the move, the only valid operations on the base object are move construction and destruction. [endsect] [section:async_base_dtor_ async_base::~async_base] [indexterm2 ~async_base..async_base] [heading Synopsis] ``` virtual ~async_base(); ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__async_detect_ssl async_detect_ssl] [indexterm1 async_detect_ssl]
  117. Detect a TLS/SSL handshake asynchronously on a stream. [heading Synopsis] Defined in header [include_file boost/beast/core/detect_ssl.hpp] ``` template< class __AsyncReadStream__, class __DynamicBuffer__, class __CompletionToken__ = net::default_completion_token_t<beast::executor_type<AsyncReadStream>>> ``__deduced__`` async_detect_ssl( AsyncReadStream& stream, DynamicBuffer& buffer, CompletionToken&& token = net::default_completion_token_t< beast::executor_type< AsyncReadStream >>{}); ``` [heading Description]
  118. This function reads asynchronously from a stream to determine if a client handshake message is being received.
  119. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  120. * A TLS client opening handshake is detected,
  121. * The received data is invalid for a TLS client handshake, or
  122. * An error occurs.
  123. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_read_some` function. The program must ensure that no other calls to `async_read_some` are performed until this operation completes.
  124. Bytes read from the stream will be stored in the passed dynamic buffer, which may be used to perform the TLS handshake if the detector returns true, or be otherwise consumed by the caller based on the expected protocol.
  125. [heading Parameters] [table [[Name][Description]] [[`stream`][
  126. The stream to read from. This type must meet the requirements of ['AsyncReadStream]. ]] [[`buffer`][
  127. The dynamic buffer to use. This type must meet the requirements of ['DynamicBuffer]. ]] [[`token`][
  128. The completion token used to determine the method used to provide the result of the asynchronous operation. If this is a completion handler, the implementation takes ownership of the handler by performing a decay-copy, and the equivalent function signature of the handler must be: ``` void handler(
  129. error_code const& error, // Set to the error, if any
  130. bool result // The result of the detector
  131. );
  132. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  133. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__async_teardown async_teardown] [indexterm1 async_teardown]
  134. Start tearing down a `net::ssl::stream`. [heading Synopsis] Defined in header [include_file boost/beast/websocket/ssl.hpp] ``` template< class __AsyncStream__, class TeardownHandler> void async_teardown( role_type role, net::ssl::stream< AsyncStream >& stream, TeardownHandler&& handler); ``` [heading Description]
  135. This begins tearing down a connection asynchronously. The implementation will call the overload of this function based on the `Stream` parameter used to consruct the socket. When `Stream` is a user defined type, and not a `net::ip::tcp::socket` or any `net::ssl::stream`, callers are responsible for providing a suitable overload of this function.
  136. [heading Parameters] [table [[Name][Description]] [[`role`][
  137. The role of the local endpoint ]] [[`stream`][
  138. The stream to tear down. ]] [[`handler`][
  139. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  140. error_code const& error // result of operation
  141. );
  142. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  143. Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__basic_flat_buffer basic_flat_buffer]
  144. A dynamic buffer providing buffer sequences of length one. [heading Synopsis] Defined in header [include_file boost/beast/core/flat_buffer.hpp] ``` template< class __Allocator__> class basic_flat_buffer ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_flat_buffer.allocator_type [*allocator_type]]] [ The type of allocator used. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.const_buffers_type [*const_buffers_type]]] [ The ConstBufferSequence used to represent the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.mutable_buffers_type [*mutable_buffers_type]]] [ The MutableBufferSequence used to represent the writable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.mutable_data_type [*mutable_data_type]]] [ The MutableBufferSequence used to represent the readable bytes. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer [*basic_flat_buffer]]] [ Constructor. Move Constructor. Copy Constructor. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.capacity [*capacity]]] [ Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.cdata [*cdata]]] [ Returns a constant buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.clear [*clear]]] [ Set the size of the readable and writable bytes to zero. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.commit [*commit]]] [ Append writable bytes to the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.consume [*consume]]] [ Remove bytes from beginning of the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.data [*data]]] [ Returns a constant buffer sequence representing the readable bytes. Returns a mutable buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.get_allocator [*get_allocator]]] [ Returns a copy of the allocator used. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.max_size [*max_size]]] [ Set the maximum allowed capacity. Return the maximum number of bytes, both readable and writable, that can ever be held. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.operator_eq_ [*operator=]]] [ Move Assignment. Copy Assignment. Copy assignment. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.prepare [*prepare]]] [ Returns a mutable buffer sequence representing writable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.reserve [*reserve]]] [ Guarantee a minimum capacity. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.shrink_to_fit [*shrink_to_fit]]] [ Reallocate the buffer to fit the readable bytes exactly. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.size [*size]]] [ Returns the number of readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer_dtor_ [*~basic_flat_buffer]]] [ Destructor. ] ] ] [heading Friends] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_flat_buffer.swap [*swap]]] [ Exchange two dynamic buffers. ] ] ] [heading Description]
  145. A dynamic buffer encapsulates memory storage that may be automatically resized as required, where the memory is divided into two regions: readable bytes followed by writable bytes. These memory regions are internal to the dynamic buffer, but direct access to the elements is provided to permit them to be efficiently used with I/O operations.
  146. Objects of this type meet the requirements of ['DynamicBuffer] and have the following additional properties:
  147. * A mutable buffer sequence representing the readable bytes is returned by [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] when `this` is non-const.
  148. * A configurable maximum buffer size may be set upon construction. Attempts to exceed the buffer size will throw `std::length_error`.
  149. * Buffer sequences representing the readable and writable bytes, returned by [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] and [link beast.ref.boost__beast__basic_flat_buffer.prepare `basic_flat_buffer::prepare`], will have length one.
  150. Upon construction, a maximum size for the buffer may be specified. If this limit is exceeded, the `std::length_error` exception will be thrown.
  151. [heading Remarks]
  152. This class is designed for use with algorithms that take dynamic buffers as parameters, and are optimized for the case where the input sequence or output sequence is stored in a single contiguous buffer.
  153. [section:allocator_type basic_flat_buffer::allocator_type] [indexterm2 allocator_type..basic_flat_buffer]
  154. The type of allocator used. [heading Synopsis] ``` using allocator_type = Allocator; ``` [heading Description] [endsect] [section:basic_flat_buffer basic_flat_buffer::basic_flat_buffer] [indexterm2 basic_flat_buffer..basic_flat_buffer]
  155. Constructor. ``` ``[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload1 basic_flat_buffer]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload1 more...]]`` explicit ``[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload2 basic_flat_buffer]``( std::size_t limit); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload2 more...]]`` explicit ``[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload3 basic_flat_buffer]``( Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload3 more...]]`` ``[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload4 basic_flat_buffer]``( std::size_t limit, Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload4 more...]]`` ```
  156. Move Constructor. ``` ``[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload5 basic_flat_buffer]``( basic_flat_buffer&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload5 more...]]`` ``[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload6 basic_flat_buffer]``( basic_flat_buffer&& other, Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload6 more...]]`` ```
  157. Copy Constructor. ``` ``[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload7 basic_flat_buffer]``( basic_flat_buffer const& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload7 more...]]`` ``[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload8 basic_flat_buffer]``( basic_flat_buffer const& other, Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload8 more...]]`` template< class OtherAlloc> ``[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload9 basic_flat_buffer]``( basic_flat_buffer< OtherAlloc > const& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload9 more...]]`` template< class OtherAlloc> ``[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload10 basic_flat_buffer]``( basic_flat_buffer< OtherAlloc > const& other, Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer.overload10 more...]]`` ``` [section:overload1 basic_flat_buffer::basic_flat_buffer (1 of 10 overloads)]
  158. Constructor. [heading Synopsis] ``` basic_flat_buffer(); ``` [heading Description]
  159. After construction, [link beast.ref.boost__beast__basic_flat_buffer.capacity `basic_flat_buffer::capacity`] will return zero, and [link beast.ref.boost__beast__basic_flat_buffer.max_size `basic_flat_buffer::max_size`] will return the largest value which may be passed to the allocator's `allocate` function. [endsect] [section:overload2 basic_flat_buffer::basic_flat_buffer (2 of 10 overloads)]
  160. Constructor. [heading Synopsis] ``` basic_flat_buffer( std::size_t limit); ``` [heading Description]
  161. After construction, [link beast.ref.boost__beast__basic_flat_buffer.capacity `basic_flat_buffer::capacity`] will return zero, and [link beast.ref.boost__beast__basic_flat_buffer.max_size `basic_flat_buffer::max_size`] will return the specified value of `limit`.
  162. [heading Parameters] [table [[Name][Description]] [[`limit`][
  163. The desired maximum size. ]] ]
  164. [endsect] [section:overload3 basic_flat_buffer::basic_flat_buffer (3 of 10 overloads)]
  165. Constructor. [heading Synopsis] ``` basic_flat_buffer( Allocator const& alloc); ``` [heading Description]
  166. After construction, [link beast.ref.boost__beast__basic_flat_buffer.capacity `basic_flat_buffer::capacity`] will return zero, and [link beast.ref.boost__beast__basic_flat_buffer.max_size `basic_flat_buffer::max_size`] will return the largest value which may be passed to the allocator's `allocate` function.
  167. [heading Parameters] [table [[Name][Description]] [[`alloc`][
  168. The allocator to use for the object. ]] ]
  169. [heading Exception Safety]
  170. No-throw guarantee. [endsect] [section:overload4 basic_flat_buffer::basic_flat_buffer (4 of 10 overloads)]
  171. Constructor. [heading Synopsis] ``` basic_flat_buffer( std::size_t limit, Allocator const& alloc); ``` [heading Description]
  172. After construction, [link beast.ref.boost__beast__basic_flat_buffer.capacity `basic_flat_buffer::capacity`] will return zero, and [link beast.ref.boost__beast__basic_flat_buffer.max_size `basic_flat_buffer::max_size`] will return the specified value of `limit`.
  173. [heading Parameters] [table [[Name][Description]] [[`limit`][
  174. The desired maximum size. ]] [[`alloc`][
  175. The allocator to use for the object. ]] ]
  176. [heading Exception Safety]
  177. No-throw guarantee. [endsect] [section:overload5 basic_flat_buffer::basic_flat_buffer (5 of 10 overloads)]
  178. Move Constructor. [heading Synopsis] ``` basic_flat_buffer( basic_flat_buffer&& other); ``` [heading Description]
  179. The container is constructed with the contents of `other` using move semantics. The maximum size will be the same as the moved-from object.
  180. Buffer sequences previously obtained from `other` using [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] or [link beast.ref.boost__beast__basic_flat_buffer.prepare `basic_flat_buffer::prepare`] remain valid after the move.
  181. [heading Parameters] [table [[Name][Description]] [[`other`][
  182. The object to move from. After the move, the moved-from object will have zero capacity, zero readable bytes, and zero writable bytes. ]] ]
  183. [heading Exception Safety]
  184. No-throw guarantee. [endsect] [section:overload6 basic_flat_buffer::basic_flat_buffer (6 of 10 overloads)]
  185. Move Constructor. [heading Synopsis] ``` basic_flat_buffer( basic_flat_buffer&& other, Allocator const& alloc); ``` [heading Description]
  186. Using `alloc` as the allocator for the new container, the contents of `other` are moved. If `alloc != other.get_allocator()`, this results in a copy. The maximum size will be the same as the moved-from object.
  187. Buffer sequences previously obtained from `other` using [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] or [link beast.ref.boost__beast__basic_flat_buffer.prepare `basic_flat_buffer::prepare`] become invalid after the move.
  188. [heading Parameters] [table [[Name][Description]] [[`other`][
  189. The object to move from. After the move, the moved-from object will have zero capacity, zero readable bytes, and zero writable bytes. ]] [[`alloc`][
  190. The allocator to use for the object. ]] ]
  191. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  192. if `other.size()` exceeds the maximum allocation size of `alloc`. ]] ]
  193. [endsect] [section:overload7 basic_flat_buffer::basic_flat_buffer (7 of 10 overloads)]
  194. Copy Constructor. [heading Synopsis] ``` basic_flat_buffer( basic_flat_buffer const& other); ``` [heading Description]
  195. This container is constructed with the contents of `other` using copy semantics. The maximum size will be the same as the copied object.
  196. [heading Parameters] [table [[Name][Description]] [[`other`][
  197. The object to copy from. ]] ]
  198. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  199. if `other.size()` exceeds the maximum allocation size of the allocator. ]] ]
  200. [endsect] [section:overload8 basic_flat_buffer::basic_flat_buffer (8 of 10 overloads)]
  201. Copy Constructor. [heading Synopsis] ``` basic_flat_buffer( basic_flat_buffer const& other, Allocator const& alloc); ``` [heading Description]
  202. This container is constructed with the contents of `other` using copy semantics and the specified allocator. The maximum size will be the same as the copied object.
  203. [heading Parameters] [table [[Name][Description]] [[`other`][
  204. The object to copy from. ]] [[`alloc`][
  205. The allocator to use for the object. ]] ]
  206. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  207. if `other.size()` exceeds the maximum allocation size of `alloc`. ]] ]
  208. [endsect] [section:overload9 basic_flat_buffer::basic_flat_buffer (9 of 10 overloads)]
  209. Copy Constructor. [heading Synopsis] ``` template< class OtherAlloc> basic_flat_buffer( basic_flat_buffer< OtherAlloc > const& other); ``` [heading Description]
  210. This container is constructed with the contents of `other` using copy semantics. The maximum size will be the same as the copied object.
  211. [heading Parameters] [table [[Name][Description]] [[`other`][
  212. The object to copy from. ]] ]
  213. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  214. if `other.size()` exceeds the maximum allocation size of the allocator. ]] ]
  215. [endsect] [section:overload10 basic_flat_buffer::basic_flat_buffer (10 of 10 overloads)]
  216. Copy Constructor. [heading Synopsis] ``` template< class OtherAlloc> basic_flat_buffer( basic_flat_buffer< OtherAlloc > const& other, Allocator const& alloc); ``` [heading Description]
  217. This container is constructed with the contents of `other` using copy semantics. The maximum size will be the same as the copied object.
  218. [heading Parameters] [table [[Name][Description]] [[`other`][
  219. The object to copy from. ]] [[`alloc`][
  220. The allocator to use for the object. ]] ]
  221. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  222. if `other.size()` exceeds the maximum allocation size of `alloc`. ]] ]
  223. [endsect] [endsect] [section:capacity basic_flat_buffer::capacity] [indexterm2 capacity..basic_flat_buffer]
  224. Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. [heading Synopsis] ``` std::size_t capacity() const; ``` [heading Description] [endsect] [section:cdata basic_flat_buffer::cdata] [indexterm2 cdata..basic_flat_buffer]
  225. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type cdata() const; ``` [heading Description] [endsect] [section:clear basic_flat_buffer::clear] [indexterm2 clear..basic_flat_buffer]
  226. Set the size of the readable and writable bytes to zero. [heading Synopsis] ``` void clear(); ``` [heading Description]
  227. This clears the buffer without changing capacity. Buffer sequences previously obtained using [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] or [link beast.ref.boost__beast__basic_flat_buffer.prepare `basic_flat_buffer::prepare`] become invalid.
  228. [heading Exception Safety]
  229. No-throw guarantee. [endsect] [section:commit basic_flat_buffer::commit] [indexterm2 commit..basic_flat_buffer]
  230. Append writable bytes to the readable bytes. [heading Synopsis] ``` void commit( std::size_t n); ``` [heading Description]
  231. Appends n bytes from the start of the writable bytes to the end of the readable bytes. The remainder of the writable bytes are discarded. If n is greater than the number of writable bytes, all writable bytes are appended to the readable bytes.
  232. All buffers sequences previously obtained using [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] or [link beast.ref.boost__beast__basic_flat_buffer.prepare `basic_flat_buffer::prepare`] become invalid.
  233. [heading Parameters] [table [[Name][Description]] [[`n`][
  234. The number of bytes to append. If this number is greater than the number of writable bytes, all writable bytes are appended. ]] ]
  235. [heading Exception Safety]
  236. No-throw guarantee. [endsect] [section:const_buffers_type basic_flat_buffer::const_buffers_type] [indexterm2 const_buffers_type..basic_flat_buffer]
  237. The ConstBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using const_buffers_type = net::const_buffer; ``` [heading Description] [endsect] [section:consume basic_flat_buffer::consume] [indexterm2 consume..basic_flat_buffer]
  238. Remove bytes from beginning of the readable bytes. [heading Synopsis] ``` void consume( std::size_t n); ``` [heading Description]
  239. Removes n bytes from the beginning of the readable bytes.
  240. All buffers sequences previously obtained using [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] or [link beast.ref.boost__beast__basic_flat_buffer.prepare `basic_flat_buffer::prepare`] become invalid.
  241. [heading Parameters] [table [[Name][Description]] [[`n`][
  242. The number of bytes to remove. If this number is greater than the number of readable bytes, all readable bytes are removed. ]] ]
  243. [heading Exception Safety]
  244. No-throw guarantee. [endsect] [section:data basic_flat_buffer::data] [indexterm2 data..basic_flat_buffer]
  245. Returns a constant buffer sequence representing the readable bytes. ``` const_buffers_type ``[link beast.ref.boost__beast__basic_flat_buffer.data.overload1 data]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.data.overload1 more...]]`` ```
  246. Returns a mutable buffer sequence representing the readable bytes. ``` mutable_data_type ``[link beast.ref.boost__beast__basic_flat_buffer.data.overload2 data]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.data.overload2 more...]]`` ``` [section:overload1 basic_flat_buffer::data (1 of 2 overloads)]
  247. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type data() const; ``` [heading Description] [endsect] [section:overload2 basic_flat_buffer::data (2 of 2 overloads)]
  248. Returns a mutable buffer sequence representing the readable bytes. [heading Synopsis] ``` mutable_data_type data(); ``` [heading Description] [endsect] [endsect] [section:get_allocator basic_flat_buffer::get_allocator] [indexterm2 get_allocator..basic_flat_buffer]
  249. Returns a copy of the allocator used. [heading Synopsis] ``` allocator_type get_allocator() const; ``` [heading Description] [endsect] [section:max_size basic_flat_buffer::max_size] [indexterm2 max_size..basic_flat_buffer]
  250. Set the maximum allowed capacity. ``` void ``[link beast.ref.boost__beast__basic_flat_buffer.max_size.overload1 max_size]``( std::size_t n); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.max_size.overload1 more...]]`` ```
  251. Return the maximum number of bytes, both readable and writable, that can ever be held. ``` std::size_t ``[link beast.ref.boost__beast__basic_flat_buffer.max_size.overload2 max_size]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.max_size.overload2 more...]]`` ``` [section:overload1 basic_flat_buffer::max_size (1 of 2 overloads)]
  252. Set the maximum allowed capacity. [heading Synopsis] ``` void max_size( std::size_t n); ``` [heading Description]
  253. This function changes the currently configured upper limit on capacity to the specified value.
  254. [heading Parameters] [table [[Name][Description]] [[`n`][
  255. The maximum number of bytes ever allowed for capacity. ]] ]
  256. [heading Exception Safety]
  257. No-throw guarantee. [endsect] [section:overload2 basic_flat_buffer::max_size (2 of 2 overloads)]
  258. Return the maximum number of bytes, both readable and writable, that can ever be held. [heading Synopsis] ``` std::size_t max_size() const; ``` [heading Description] [endsect] [endsect] [section:mutable_buffers_type basic_flat_buffer::mutable_buffers_type] [indexterm2 mutable_buffers_type..basic_flat_buffer]
  259. The MutableBufferSequence used to represent the writable bytes. [heading Synopsis] ``` using mutable_buffers_type = net::mutable_buffer; ``` [heading Description] [endsect] [section:mutable_data_type basic_flat_buffer::mutable_data_type] [indexterm2 mutable_data_type..basic_flat_buffer]
  260. The MutableBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using mutable_data_type = net::mutable_buffer; ``` [heading Description] [endsect] [section:operator_eq_ basic_flat_buffer::operator=] [indexterm2 operator=..basic_flat_buffer]
  261. Move Assignment. ``` basic_flat_buffer& ``[link beast.ref.boost__beast__basic_flat_buffer.operator_eq_.overload1 operator=]``( basic_flat_buffer&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.operator_eq_.overload1 more...]]`` ```
  262. Copy Assignment. ``` basic_flat_buffer& ``[link beast.ref.boost__beast__basic_flat_buffer.operator_eq_.overload2 operator=]``( basic_flat_buffer const& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.operator_eq_.overload2 more...]]`` ```
  263. Copy assignment. ``` template< class OtherAlloc> basic_flat_buffer& ``[link beast.ref.boost__beast__basic_flat_buffer.operator_eq_.overload3 operator=]``( basic_flat_buffer< OtherAlloc > const& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_flat_buffer.operator_eq_.overload3 more...]]`` ``` [section:overload1 basic_flat_buffer::operator= (1 of 3 overloads)]
  264. Move Assignment. [heading Synopsis] ``` basic_flat_buffer& operator=( basic_flat_buffer&& other); ``` [heading Description]
  265. The container is assigned with the contents of `other` using move semantics. The maximum size will be the same as the moved-from object.
  266. Buffer sequences previously obtained from `other` using [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] or [link beast.ref.boost__beast__basic_flat_buffer.prepare `basic_flat_buffer::prepare`] remain valid after the move.
  267. [heading Parameters] [table [[Name][Description]] [[`other`][
  268. The object to move from. After the move, the moved-from object will have zero capacity, zero readable bytes, and zero writable bytes. ]] ]
  269. [heading Exception Safety]
  270. No-throw guarantee. [endsect] [section:overload2 basic_flat_buffer::operator= (2 of 3 overloads)]
  271. Copy Assignment. [heading Synopsis] ``` basic_flat_buffer& operator=( basic_flat_buffer const& other); ``` [heading Description]
  272. The container is assigned with the contents of `other` using copy semantics. The maximum size will be the same as the copied object.
  273. After the copy, `this` will have zero writable bytes.
  274. [heading Parameters] [table [[Name][Description]] [[`other`][
  275. The object to copy from. ]] ]
  276. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  277. if `other.size()` exceeds the maximum allocation size of the allocator. ]] ]
  278. [endsect] [section:overload3 basic_flat_buffer::operator= (3 of 3 overloads)]
  279. Copy assignment. [heading Synopsis] ``` template< class OtherAlloc> basic_flat_buffer& operator=( basic_flat_buffer< OtherAlloc > const& other); ``` [heading Description]
  280. The container is assigned with the contents of `other` using copy semantics. The maximum size will be the same as the copied object.
  281. After the copy, `this` will have zero writable bytes.
  282. [heading Parameters] [table [[Name][Description]] [[`other`][
  283. The object to copy from. ]] ]
  284. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  285. if `other.size()` exceeds the maximum allocation size of the allocator. ]] ]
  286. [endsect] [endsect] [section:prepare basic_flat_buffer::prepare] [indexterm2 prepare..basic_flat_buffer]
  287. Returns a mutable buffer sequence representing writable bytes. [heading Synopsis] ``` mutable_buffers_type prepare( std::size_t n); ``` [heading Description]
  288. Returns a mutable buffer sequence representing the writable bytes containing exactly `n` bytes of storage. Memory may be reallocated as needed.
  289. All buffers sequences previously obtained using [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] or [link beast.ref.boost__beast__basic_flat_buffer.prepare `basic_flat_buffer::prepare`] become invalid.
  290. [heading Parameters] [table [[Name][Description]] [[`n`][
  291. The desired number of bytes in the returned buffer sequence. ]] ]
  292. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  293. if `size() + n` exceeds either `max_size()` or the allocator's maximum allocation size. ]] ]
  294. [heading Exception Safety]
  295. Strong guarantee. [endsect] [section:reserve basic_flat_buffer::reserve] [indexterm2 reserve..basic_flat_buffer]
  296. Guarantee a minimum capacity. [heading Synopsis] ``` void reserve( std::size_t n); ``` [heading Description]
  297. This function adjusts the internal storage (if necessary) to guarantee space for at least `n` bytes.
  298. Buffer sequences previously obtained using [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] or [link beast.ref.boost__beast__basic_flat_buffer.prepare `basic_flat_buffer::prepare`] become invalid.
  299. [heading Parameters] [table [[Name][Description]] [[`n`][
  300. The minimum number of byte for the new capacity. If this value is greater than the maximum size, then the maximum size will be adjusted upwards to this value. ]] ]
  301. [heading Exception Safety]
  302. Basic guarantee.
  303. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  304. if n is larger than the maximum allocation size of the allocator. ]] ]
  305. [endsect] [section:shrink_to_fit basic_flat_buffer::shrink_to_fit] [indexterm2 shrink_to_fit..basic_flat_buffer]
  306. Reallocate the buffer to fit the readable bytes exactly. [heading Synopsis] ``` void shrink_to_fit(); ``` [heading Description]
  307. Buffer sequences previously obtained using [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] or [link beast.ref.boost__beast__basic_flat_buffer.prepare `basic_flat_buffer::prepare`] become invalid.
  308. [heading Exception Safety]
  309. Strong guarantee. [endsect] [section:size basic_flat_buffer::size] [indexterm2 size..basic_flat_buffer]
  310. Returns the number of readable bytes. [heading Synopsis] ``` std::size_t size() const; ``` [heading Description] [endsect] [section:swap basic_flat_buffer::swap] [indexterm2 swap..basic_flat_buffer]
  311. Exchange two dynamic buffers. [heading Synopsis] Defined in header [include_file boost/beast/core/flat_buffer.hpp] ``` template< class Alloc> friend void swap( basic_flat_buffer< Alloc >&, basic_flat_buffer< Alloc >&); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:basic_flat_buffer_dtor_ basic_flat_buffer::~basic_flat_buffer] [indexterm2 ~basic_flat_buffer..basic_flat_buffer]
  312. Destructor. [heading Synopsis] ``` ~basic_flat_buffer(); ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__basic_multi_buffer basic_multi_buffer]
  313. A dynamic buffer providing sequences of variable length. [heading Synopsis] Defined in header [include_file boost/beast/core/multi_buffer.hpp] ``` template< class __Allocator__> class basic_multi_buffer ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_multi_buffer.allocator_type [*allocator_type]]] [ The type of allocator used. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.const_buffers_type [*const_buffers_type]]] [ The ConstBufferSequence used to represent the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.mutable_buffers_type [*mutable_buffers_type]]] [ The MutableBufferSequence used to represent the writable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.mutable_data_type [*mutable_data_type]]] [ The MutableBufferSequence used to represent the readable bytes. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer [*basic_multi_buffer]]] [ Constructor. Move Constructor. Copy Constructor. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.capacity [*capacity]]] [ Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.cdata [*cdata]]] [ Returns a constant buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.clear [*clear]]] [ Set the size of the readable and writable bytes to zero. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.commit [*commit]]] [ Append writable bytes to the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.consume [*consume]]] [ Remove bytes from beginning of the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.data [*data]]] [ Returns a constant buffer sequence representing the readable bytes. Returns a mutable buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.get_allocator [*get_allocator]]] [ Returns a copy of the allocator used. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.max_size [*max_size]]] [ Set the maximum allowed capacity. Return the maximum number of bytes, both readable and writable, that can ever be held. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.operator_eq_ [*operator=]]] [ Move Assignment. Copy Assignment. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.prepare [*prepare]]] [ Returns a mutable buffer sequence representing writable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.reserve [*reserve]]] [ Guarantee a minimum capacity. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.shrink_to_fit [*shrink_to_fit]]] [ Reallocate the buffer to fit the readable bytes exactly. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.size [*size]]] [ Returns the number of readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer_dtor_ [*~basic_multi_buffer]]] [ Destructor. ] ] ] [heading Friends] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_multi_buffer.swap [*swap]]] [ Exchange two dynamic buffers. ] ] ] [heading Description]
  314. A dynamic buffer encapsulates memory storage that may be automatically resized as required, where the memory is divided into two regions: readable bytes followed by writable bytes. These memory regions are internal to the dynamic buffer, but direct access to the elements is provided to permit them to be efficiently used with I/O operations.
  315. The implementation uses a sequence of one or more byte arrays of varying sizes to represent the readable and writable bytes. Additional byte array objects are appended to the sequence to accommodate changes in the desired size. The behavior and implementation of this container is most similar to `std::deque`.
  316. Objects of this type meet the requirements of ['DynamicBuffer] and have the following additional properties:
  317. * A mutable buffer sequence representing the readable bytes is returned by [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] when `this` is non-const.
  318. * Buffer sequences representing the readable and writable bytes, returned by [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] and [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`], may have length greater than one.
  319. * A configurable maximum size may be set upon construction and adjusted afterwards. Calls to [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] that would exceed this size will throw `std::length_error`.
  320. * Sequences previously obtained using [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] remain valid after calls to [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] or [link beast.ref.boost__beast__basic_multi_buffer.commit `basic_multi_buffer::commit`].
  321. [heading Template Parameters] [table [[Type][Description]] [[`Allocator`][
  322. The allocator to use for managing memory. ]] ]
  323. [section:allocator_type basic_multi_buffer::allocator_type] [indexterm2 allocator_type..basic_multi_buffer]
  324. The type of allocator used. [heading Synopsis] ``` using allocator_type = Allocator; ``` [heading Description] [endsect] [section:basic_multi_buffer basic_multi_buffer::basic_multi_buffer] [indexterm2 basic_multi_buffer..basic_multi_buffer]
  325. Constructor. ``` ``[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload1 basic_multi_buffer]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload1 more...]]`` explicit ``[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload2 basic_multi_buffer]``( std::size_t limit); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload2 more...]]`` explicit ``[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload3 basic_multi_buffer]``( Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload3 more...]]`` ``[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload4 basic_multi_buffer]``( std::size_t limit, Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload4 more...]]`` ```
  326. Move Constructor. ``` ``[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload5 basic_multi_buffer]``( basic_multi_buffer&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload5 more...]]`` ``[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload6 basic_multi_buffer]``( basic_multi_buffer&& other, Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload6 more...]]`` ```
  327. Copy Constructor. ``` ``[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload7 basic_multi_buffer]``( basic_multi_buffer const& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload7 more...]]`` ``[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload8 basic_multi_buffer]``( basic_multi_buffer const& other, Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload8 more...]]`` template< class OtherAlloc> ``[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload9 basic_multi_buffer]``( basic_multi_buffer< OtherAlloc > const& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload9 more...]]`` template< class OtherAlloc> ``[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload10 basic_multi_buffer]``( basic_multi_buffer< OtherAlloc > const& other, allocator_type const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer.overload10 more...]]`` ``` [section:overload1 basic_multi_buffer::basic_multi_buffer (1 of 10 overloads)]
  328. Constructor. [heading Synopsis] ``` basic_multi_buffer(); ``` [heading Description]
  329. After construction, [link beast.ref.boost__beast__basic_multi_buffer.capacity `basic_multi_buffer::capacity`] will return zero, and [link beast.ref.boost__beast__basic_multi_buffer.max_size `basic_multi_buffer::max_size`] will return the largest value which may be passed to the allocator's `allocate` function. [endsect] [section:overload2 basic_multi_buffer::basic_multi_buffer (2 of 10 overloads)]
  330. Constructor. [heading Synopsis] ``` basic_multi_buffer( std::size_t limit); ``` [heading Description]
  331. After construction, [link beast.ref.boost__beast__basic_multi_buffer.capacity `basic_multi_buffer::capacity`] will return zero, and [link beast.ref.boost__beast__basic_multi_buffer.max_size `basic_multi_buffer::max_size`] will return the specified value of `limit`.
  332. [heading Parameters] [table [[Name][Description]] [[`limit`][
  333. The desired maximum size. ]] ]
  334. [endsect] [section:overload3 basic_multi_buffer::basic_multi_buffer (3 of 10 overloads)]
  335. Constructor. [heading Synopsis] ``` basic_multi_buffer( Allocator const& alloc); ``` [heading Description]
  336. After construction, [link beast.ref.boost__beast__basic_multi_buffer.capacity `basic_multi_buffer::capacity`] will return zero, and [link beast.ref.boost__beast__basic_multi_buffer.max_size `basic_multi_buffer::max_size`] will return the largest value which may be passed to the allocator's `allocate` function.
  337. [heading Parameters] [table [[Name][Description]] [[`alloc`][
  338. The allocator to use for the object. ]] ]
  339. [heading Exception Safety]
  340. No-throw guarantee. [endsect] [section:overload4 basic_multi_buffer::basic_multi_buffer (4 of 10 overloads)]
  341. Constructor. [heading Synopsis] ``` basic_multi_buffer( std::size_t limit, Allocator const& alloc); ``` [heading Description]
  342. After construction, [link beast.ref.boost__beast__basic_multi_buffer.capacity `basic_multi_buffer::capacity`] will return zero, and [link beast.ref.boost__beast__basic_multi_buffer.max_size `basic_multi_buffer::max_size`] will return the specified value of `limit`.
  343. [heading Parameters] [table [[Name][Description]] [[`limit`][
  344. The desired maximum size. ]] [[`alloc`][
  345. The allocator to use for the object. ]] ]
  346. [heading Exception Safety]
  347. No-throw guarantee. [endsect] [section:overload5 basic_multi_buffer::basic_multi_buffer (5 of 10 overloads)]
  348. Move Constructor. [heading Synopsis] ``` basic_multi_buffer( basic_multi_buffer&& other); ``` [heading Description]
  349. The container is constructed with the contents of `other` using move semantics. The maximum size will be the same as the moved-from object.
  350. Buffer sequences previously obtained from `other` using [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] or [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] remain valid after the move.
  351. [heading Parameters] [table [[Name][Description]] [[`other`][
  352. The object to move from. After the move, the moved-from object will have zero capacity, zero readable bytes, and zero writable bytes. ]] ]
  353. [heading Exception Safety]
  354. No-throw guarantee. [endsect] [section:overload6 basic_multi_buffer::basic_multi_buffer (6 of 10 overloads)]
  355. Move Constructor. [heading Synopsis] ``` basic_multi_buffer( basic_multi_buffer&& other, Allocator const& alloc); ``` [heading Description]
  356. Using `alloc` as the allocator for the new container, the contents of `other` are moved. If `alloc != other.get_allocator()`, this results in a copy. The maximum size will be the same as the moved-from object.
  357. Buffer sequences previously obtained from `other` using [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] or [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] become invalid after the move.
  358. [heading Parameters] [table [[Name][Description]] [[`other`][
  359. The object to move from. After the move, the moved-from object will have zero capacity, zero readable bytes, and zero writable bytes. ]] [[`alloc`][
  360. The allocator to use for the object. ]] ]
  361. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  362. if `other.size()` exceeds the maximum allocation size of `alloc`. ]] ]
  363. [endsect] [section:overload7 basic_multi_buffer::basic_multi_buffer (7 of 10 overloads)]
  364. Copy Constructor. [heading Synopsis] ``` basic_multi_buffer( basic_multi_buffer const& other); ``` [heading Description]
  365. This container is constructed with the contents of `other` using copy semantics. The maximum size will be the same as the copied object.
  366. [heading Parameters] [table [[Name][Description]] [[`other`][
  367. The object to copy from. ]] ]
  368. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  369. if `other.size()` exceeds the maximum allocation size of the allocator. ]] ]
  370. [endsect] [section:overload8 basic_multi_buffer::basic_multi_buffer (8 of 10 overloads)]
  371. Copy Constructor. [heading Synopsis] ``` basic_multi_buffer( basic_multi_buffer const& other, Allocator const& alloc); ``` [heading Description]
  372. This container is constructed with the contents of `other` using copy semantics and the specified allocator. The maximum size will be the same as the copied object.
  373. [heading Parameters] [table [[Name][Description]] [[`other`][
  374. The object to copy from. ]] [[`alloc`][
  375. The allocator to use for the object. ]] ]
  376. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  377. if `other.size()` exceeds the maximum allocation size of `alloc`. ]] ]
  378. [endsect] [section:overload9 basic_multi_buffer::basic_multi_buffer (9 of 10 overloads)]
  379. Copy Constructor. [heading Synopsis] ``` template< class OtherAlloc> basic_multi_buffer( basic_multi_buffer< OtherAlloc > const& other); ``` [heading Description]
  380. This container is constructed with the contents of `other` using copy semantics. The maximum size will be the same as the copied object.
  381. [heading Parameters] [table [[Name][Description]] [[`other`][
  382. The object to copy from. ]] ]
  383. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  384. if `other.size()` exceeds the maximum allocation size of the allocator. ]] ]
  385. [endsect] [section:overload10 basic_multi_buffer::basic_multi_buffer (10 of 10 overloads)]
  386. Copy Constructor. [heading Synopsis] ``` template< class OtherAlloc> basic_multi_buffer( basic_multi_buffer< OtherAlloc > const& other, allocator_type const& alloc); ``` [heading Description]
  387. This container is constructed with the contents of `other` using copy semantics. The maximum size will be the same as the copied object.
  388. [heading Parameters] [table [[Name][Description]] [[`other`][
  389. The object to copy from. ]] [[`alloc`][
  390. The allocator to use for the object. ]] ]
  391. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  392. if `other.size()` exceeds the maximum allocation size of `alloc`. ]] ]
  393. [endsect] [endsect] [section:capacity basic_multi_buffer::capacity] [indexterm2 capacity..basic_multi_buffer]
  394. Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. [heading Synopsis] ``` std::size_t capacity() const; ``` [heading Description] [endsect] [section:cdata basic_multi_buffer::cdata] [indexterm2 cdata..basic_multi_buffer]
  395. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type cdata() const; ``` [heading Description]
  396. [heading Remarks]
  397. The sequence may contain multiple contiguous memory regions.
  398. [endsect] [section:clear basic_multi_buffer::clear] [indexterm2 clear..basic_multi_buffer]
  399. Set the size of the readable and writable bytes to zero. [heading Synopsis] ``` void clear(); ``` [heading Description]
  400. This clears the buffer without changing capacity. Buffer sequences previously obtained using [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] or [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] become invalid.
  401. [heading Exception Safety]
  402. No-throw guarantee. [endsect] [section:commit basic_multi_buffer::commit] [indexterm2 commit..basic_multi_buffer]
  403. Append writable bytes to the readable bytes. [heading Synopsis] ``` void commit( size_type n); ``` [heading Description]
  404. Appends n bytes from the start of the writable bytes to the end of the readable bytes. The remainder of the writable bytes are discarded. If n is greater than the number of writable bytes, all writable bytes are appended to the readable bytes.
  405. All buffer sequences previously obtained using [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] are invalidated. Buffer sequences previously obtained using [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] remain valid.
  406. [heading Parameters] [table [[Name][Description]] [[`n`][
  407. The number of bytes to append. If this number is greater than the number of writable bytes, all writable bytes are appended. ]] ]
  408. [heading Exception Safety]
  409. No-throw guarantee. [endsect] [section:const_buffers_type basic_multi_buffer::const_buffers_type] [indexterm2 const_buffers_type..basic_multi_buffer]
  410. The ConstBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using const_buffers_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:consume basic_multi_buffer::consume] [indexterm2 consume..basic_multi_buffer]
  411. Remove bytes from beginning of the readable bytes. [heading Synopsis] ``` void consume( size_type n); ``` [heading Description]
  412. Removes n bytes from the beginning of the readable bytes.
  413. All buffers sequences previously obtained using [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] or [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] are invalidated.
  414. [heading Parameters] [table [[Name][Description]] [[`n`][
  415. The number of bytes to remove. If this number is greater than the number of readable bytes, all readable bytes are removed. ]] ]
  416. [heading Exception Safety]
  417. No-throw guarantee. [endsect] [section:data basic_multi_buffer::data] [indexterm2 data..basic_multi_buffer]
  418. Returns a constant buffer sequence representing the readable bytes. ``` const_buffers_type ``[link beast.ref.boost__beast__basic_multi_buffer.data.overload1 data]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.data.overload1 more...]]`` ```
  419. Returns a mutable buffer sequence representing the readable bytes. ``` mutable_data_type ``[link beast.ref.boost__beast__basic_multi_buffer.data.overload2 data]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.data.overload2 more...]]`` ``` [section:overload1 basic_multi_buffer::data (1 of 2 overloads)]
  420. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type data() const; ``` [heading Description]
  421. [heading Remarks]
  422. The sequence may contain multiple contiguous memory regions.
  423. [endsect] [section:overload2 basic_multi_buffer::data (2 of 2 overloads)]
  424. Returns a mutable buffer sequence representing the readable bytes. [heading Synopsis] ``` mutable_data_type data(); ``` [heading Description]
  425. [heading Remarks]
  426. The sequence may contain multiple contiguous memory regions.
  427. [endsect] [endsect] [section:get_allocator basic_multi_buffer::get_allocator] [indexterm2 get_allocator..basic_multi_buffer]
  428. Returns a copy of the allocator used. [heading Synopsis] ``` allocator_type get_allocator() const; ``` [heading Description] [endsect] [section:max_size basic_multi_buffer::max_size] [indexterm2 max_size..basic_multi_buffer]
  429. Set the maximum allowed capacity. ``` void ``[link beast.ref.boost__beast__basic_multi_buffer.max_size.overload1 max_size]``( std::size_t n); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.max_size.overload1 more...]]`` ```
  430. Return the maximum number of bytes, both readable and writable, that can ever be held. ``` size_type ``[link beast.ref.boost__beast__basic_multi_buffer.max_size.overload2 max_size]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.max_size.overload2 more...]]`` ``` [section:overload1 basic_multi_buffer::max_size (1 of 2 overloads)]
  431. Set the maximum allowed capacity. [heading Synopsis] ``` void max_size( std::size_t n); ``` [heading Description]
  432. This function changes the currently configured upper limit on capacity to the specified value.
  433. [heading Parameters] [table [[Name][Description]] [[`n`][
  434. The maximum number of bytes ever allowed for capacity. ]] ]
  435. [heading Exception Safety]
  436. No-throw guarantee. [endsect] [section:overload2 basic_multi_buffer::max_size (2 of 2 overloads)]
  437. Return the maximum number of bytes, both readable and writable, that can ever be held. [heading Synopsis] ``` size_type max_size() const; ``` [heading Description] [endsect] [endsect] [section:mutable_buffers_type basic_multi_buffer::mutable_buffers_type] [indexterm2 mutable_buffers_type..basic_multi_buffer]
  438. The MutableBufferSequence used to represent the writable bytes. [heading Synopsis] ``` using mutable_buffers_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:mutable_data_type basic_multi_buffer::mutable_data_type] [indexterm2 mutable_data_type..basic_multi_buffer]
  439. The MutableBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using mutable_data_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:operator_eq_ basic_multi_buffer::operator=] [indexterm2 operator=..basic_multi_buffer]
  440. Move Assignment. ``` basic_multi_buffer& ``[link beast.ref.boost__beast__basic_multi_buffer.operator_eq_.overload1 operator=]``( basic_multi_buffer&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.operator_eq_.overload1 more...]]`` ```
  441. Copy Assignment. ``` basic_multi_buffer& ``[link beast.ref.boost__beast__basic_multi_buffer.operator_eq_.overload2 operator=]``( basic_multi_buffer const& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.operator_eq_.overload2 more...]]`` template< class OtherAlloc> basic_multi_buffer& ``[link beast.ref.boost__beast__basic_multi_buffer.operator_eq_.overload3 operator=]``( basic_multi_buffer< OtherAlloc > const& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer.operator_eq_.overload3 more...]]`` ``` [section:overload1 basic_multi_buffer::operator= (1 of 3 overloads)]
  442. Move Assignment. [heading Synopsis] ``` basic_multi_buffer& operator=( basic_multi_buffer&& other); ``` [heading Description]
  443. The container is assigned with the contents of `other` using move semantics. The maximum size will be the same as the moved-from object.
  444. Buffer sequences previously obtained from `other` using [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] or [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] remain valid after the move.
  445. [heading Parameters] [table [[Name][Description]] [[`other`][
  446. The object to move from. After the move, the moved-from object will have zero capacity, zero readable bytes, and zero writable bytes. ]] ]
  447. [endsect] [section:overload2 basic_multi_buffer::operator= (2 of 3 overloads)]
  448. Copy Assignment. [heading Synopsis] ``` basic_multi_buffer& operator=( basic_multi_buffer const& other); ``` [heading Description]
  449. The container is assigned with the contents of `other` using copy semantics. The maximum size will be the same as the copied object.
  450. After the copy, `this` will have zero writable bytes.
  451. [heading Parameters] [table [[Name][Description]] [[`other`][
  452. The object to copy from. ]] ]
  453. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  454. if `other.size()` exceeds the maximum allocation size of the allocator. ]] ]
  455. [endsect] [section:overload3 basic_multi_buffer::operator= (3 of 3 overloads)]
  456. Copy Assignment. [heading Synopsis] ``` template< class OtherAlloc> basic_multi_buffer& operator=( basic_multi_buffer< OtherAlloc > const& other); ``` [heading Description]
  457. The container is assigned with the contents of `other` using copy semantics. The maximum size will be the same as the copied object.
  458. After the copy, `this` will have zero writable bytes.
  459. [heading Parameters] [table [[Name][Description]] [[`other`][
  460. The object to copy from. ]] ]
  461. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  462. if `other.size()` exceeds the maximum allocation size of the allocator. ]] ]
  463. [endsect] [endsect] [section:prepare basic_multi_buffer::prepare] [indexterm2 prepare..basic_multi_buffer]
  464. Returns a mutable buffer sequence representing writable bytes. [heading Synopsis] ``` mutable_buffers_type prepare( size_type n); ``` [heading Description]
  465. Returns a mutable buffer sequence representing the writable bytes containing exactly `n` bytes of storage. Memory may be reallocated as needed.
  466. All buffer sequences previously obtained using [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] are invalidated. Buffer sequences previously obtained using [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] remain valid.
  467. [heading Parameters] [table [[Name][Description]] [[`n`][
  468. The desired number of bytes in the returned buffer sequence. ]] ]
  469. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  470. if `size() + n` exceeds `max_size()`. ]] ]
  471. [heading Exception Safety]
  472. Strong guarantee. [endsect] [section:reserve basic_multi_buffer::reserve] [indexterm2 reserve..basic_multi_buffer]
  473. Guarantee a minimum capacity. [heading Synopsis] ``` void reserve( std::size_t n); ``` [heading Description]
  474. This function adjusts the internal storage (if necessary) to guarantee space for at least `n` bytes.
  475. Buffer sequences previously obtained using [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] remain valid, while buffer sequences previously obtained using [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] become invalid.
  476. [heading Parameters] [table [[Name][Description]] [[`n`][
  477. The minimum number of byte for the new capacity. If this value is greater than the maximum size, then the maximum size will be adjusted upwards to this value. ]] ]
  478. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  479. if n is larger than the maximum allocation size of the allocator. ]] ]
  480. [heading Exception Safety]
  481. Strong guarantee. [endsect] [section:shrink_to_fit basic_multi_buffer::shrink_to_fit] [indexterm2 shrink_to_fit..basic_multi_buffer]
  482. Reallocate the buffer to fit the readable bytes exactly. [heading Synopsis] ``` void shrink_to_fit(); ``` [heading Description]
  483. Buffer sequences previously obtained using [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] or [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] become invalid.
  484. [heading Exception Safety]
  485. Strong guarantee. [endsect] [section:size basic_multi_buffer::size] [indexterm2 size..basic_multi_buffer]
  486. Returns the number of readable bytes. [heading Synopsis] ``` size_type size() const; ``` [heading Description] [endsect] [section:swap basic_multi_buffer::swap] [indexterm2 swap..basic_multi_buffer]
  487. Exchange two dynamic buffers. [heading Synopsis] Defined in header [include_file boost/beast/core/multi_buffer.hpp] ``` template< class Alloc> friend void swap( basic_multi_buffer< Alloc >& lhs, basic_multi_buffer< Alloc >& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:basic_multi_buffer_dtor_ basic_multi_buffer::~basic_multi_buffer] [indexterm2 ~basic_multi_buffer..basic_multi_buffer]
  488. Destructor. [heading Synopsis] ``` ~basic_multi_buffer(); ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__basic_multi_buffer__element basic_multi_buffer::element] [heading Synopsis] Defined in header [include_file boost/beast/core/multi_buffer.hpp] ``` class element : public boost::intrusive::list_base_hook< boost::intrusive::link_mode< boost::intrusive::normal_link > > ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_multi_buffer__element.data [*data]]] [ ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer__element.element [*element]]] [ ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer__element.size [*size]]] [ ] ] ] [heading Description] [section:data basic_multi_buffer::element::data] [indexterm2 data..basic_multi_buffer::element] [heading Synopsis] ``` char* data() const; ``` [heading Description] [endsect] [section:element basic_multi_buffer::element::element] [indexterm2 element..basic_multi_buffer::element] ``` ``[link beast.ref.boost__beast__basic_multi_buffer__element.element.overload1 element]``( element const&); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer__element.element.overload1 more...]]`` explicit ``[link beast.ref.boost__beast__basic_multi_buffer__element.element.overload2 element]``( size_type n); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_multi_buffer__element.element.overload2 more...]]`` ``` [section:overload1 basic_multi_buffer::element::element (1 of 2 overloads)] [heading Synopsis] ``` element( element const&); ``` [heading Description] [endsect] [section:overload2 basic_multi_buffer::element::element (2 of 2 overloads)] [heading Synopsis] ``` element( size_type n); ``` [heading Description] [endsect] [endsect] [section:size basic_multi_buffer::element::size] [indexterm2 size..basic_multi_buffer::element] [heading Synopsis] ``` size_type size() const; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__basic_multi_buffer__readable_bytes basic_multi_buffer::readable_bytes] [heading Synopsis] Defined in header [include_file boost/beast/core/multi_buffer.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2]> class readable_bytes ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__basic_stream basic_stream]
  489. A stream socket wrapper with timeouts, an executor, and a rate limit policy. [heading Synopsis] Defined in header [include_file boost/beast/core/basic_stream.hpp] ``` template< class __Protocol__, class __Executor__ = net::executor, class __RatePolicy__ = unlimited_rate_policy> class basic_stream ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_stream__rebind_executor [*rebind_executor]]] [ Rebinds the stream type to another executor. ] ] [ [[link beast.ref.boost__beast__basic_stream.endpoint_type [*endpoint_type]]] [ The endpoint type. ] ] [ [[link beast.ref.boost__beast__basic_stream.executor_type [*executor_type]]] [ The type of the executor associated with the stream. ] ] [ [[link beast.ref.boost__beast__basic_stream.protocol_type [*protocol_type]]] [ The protocol type. ] ] [ [[link beast.ref.boost__beast__basic_stream.socket_type [*socket_type]]] [ The type of the underlying socket. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_stream.async_connect [*async_connect]]] [ Connect the stream to the specified endpoint asynchronously. Establishes a connection by trying each endpoint in a sequence asynchronously. ] ] [ [[link beast.ref.boost__beast__basic_stream.async_read_some [*async_read_some]]] [ Read some data asynchronously. ] ] [ [[link beast.ref.boost__beast__basic_stream.async_write_some [*async_write_some]]] [ Write some data asynchronously. ] ] [ [[link beast.ref.boost__beast__basic_stream.basic_stream [*basic_stream]]] [ Constructor. Move constructor. ] ] [ [[link beast.ref.boost__beast__basic_stream.cancel [*cancel]]] [ Cancel all asynchronous operations associated with the socket. ] ] [ [[link beast.ref.boost__beast__basic_stream.close [*close]]] [ Close the timed stream. ] ] [ [[link beast.ref.boost__beast__basic_stream.connect [*connect]]] [ Connect the stream to the specified endpoint. Establishes a connection by trying each endpoint in a sequence. ] ] [ [[link beast.ref.boost__beast__basic_stream.expires_after [*expires_after]]] [ Set the timeout for the next logical operation. ] ] [ [[link beast.ref.boost__beast__basic_stream.expires_at [*expires_at]]] [ Set the timeout for the next logical operation. ] ] [ [[link beast.ref.boost__beast__basic_stream.expires_never [*expires_never]]] [ Disable the timeout for the next logical operation. ] ] [ [[link beast.ref.boost__beast__basic_stream.get_executor [*get_executor]]] [ Get the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__basic_stream.operator_eq_ [*operator=]]] [ Move assignment (deleted). ] ] [ [[link beast.ref.boost__beast__basic_stream.rate_policy [*rate_policy]]] [ Returns the rate policy associated with the object. ] ] [ [[link beast.ref.boost__beast__basic_stream.read_some [*read_some]]] [ Read some data. ] ] [ [[link beast.ref.boost__beast__basic_stream.release_socket [*release_socket]]] [ Release ownership of the underlying socket. ] ] [ [[link beast.ref.boost__beast__basic_stream.socket [*socket]]] [ Return a reference to the underlying socket. ] ] [ [[link beast.ref.boost__beast__basic_stream.write_some [*write_some]]] [ Write some data. ] ] [ [[link beast.ref.boost__beast__basic_stream.basic_stream_dtor_ [*~basic_stream]]] [ Destructor. ] ] ] [heading Description]
  490. This stream wraps a `net::basic_stream_socket` to provide the following features:
  491. * An ['Executor] may be associated with the stream, which will be used to invoke any completion handlers which do not already have an associated executor. This achieves support for [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1322r0.html [P1322R0] Networking TS enhancement to enable custom I/O executors].
  492. * Timeouts may be specified for each logical asynchronous operation performing any reading, writing, or connecting.
  493. * A ['RatePolicy] may be associated with the stream, to implement rate limiting through the policy's interface.
  494. Although the stream supports multiple concurrent outstanding asynchronous operations, the stream object is not thread-safe. The caller is responsible for ensuring that the stream is accessed from only one thread at a time. This includes the times when the stream, and its underlying socket, are accessed by the networking implementation. To meet this thread safety requirement, all asynchronous operations must be performed by the stream within the same implicit strand (only one thread `net::io_context::run`) or within the same explicit strand, such as an instance of `net::strand`.
  495. Completion handlers with explicit associated executors (such as those arising from use of `net::bind_executor`) will be invoked by the stream using the associated executor. Otherwise, the completion handler will be invoked by the executor associated with the stream upon construction. The type of executor used with this stream must meet the following requirements:
  496. * Function objects submitted to the executor shall never run concurrently with each other.
  497. The executor type `net::strand` meets these requirements. Use of a strand as the executor in the stream class template offers an additional notational convenience: the strand does not need to be specified in each individual initiating function call.
  498. Unlike other stream wrappers, the underlying socket is accessed through the [link beast.ref.boost__beast__basic_stream.socket `basic_stream::socket`] member function instead of `next_layer`. This causes the [link beast.ref.boost__beast__basic_stream `basic_stream`] to be returned in calls to [link beast.ref.boost__beast__get_lowest_layer `get_lowest_layer`].
  499. [heading Usage]
  500. To use this stream declare an instance of the class. Then, before each logical operation for which a timeout is desired, call [link beast.ref.boost__beast__basic_stream.expires_after `basic_stream::expires_after`] with a duration, or call [link beast.ref.boost__beast__basic_stream.expires_at `basic_stream::expires_at`] with a time point. Alternatively, call [link beast.ref.boost__beast__basic_stream.expires_never `basic_stream::expires_never`] to disable the timeout for subsequent logical operations. A logical operation is any series of one or more direct or indirect calls to the timeout stream's asynchronous read, asynchronous write, or asynchronous connect functions.
  501. When a timeout is set and a mixed operation is performed (one that includes both reads and writes, for example) the timeout applies to all of the intermediate asynchronous operations used in the enclosing operation. This allows timeouts to be applied to stream algorithms which were not written specifically to allow for timeouts, when those algorithms are passed a timeout stream with a timeout set.
  502. When a timeout occurs the socket will be closed, canceling any pending I/O operations. The completion handlers for these canceled operations will be invoked with the error [link beast.ref.boost__beast__error `timeout`].
  503. [heading Examples]
  504. This function reads an HTTP request with a timeout, then sends the HTTP response with a different timeout.
  505. ``` void process_http_1 (tcp_stream& stream, net::yield_context yield)
  506. {
  507. flat_buffer buffer;
  508. http::request<http::empty_body> req;
  509. // Read the request, with a 15 second timeout
  510. stream.expires_after(std::chrono::seconds(15));
  511. http::async_read(stream, buffer, req, yield);
  512. // Calculate the response
  513. http::response<http::string_body> res = make_response(req);
  514. // Send the response, with a 30 second timeout.
  515. stream.expires_after (std::chrono::seconds(30));
  516. http::async_write (stream, res, yield);
  517. }
  518. ```
  519. The example above could be expressed using a single timeout with a simple modification. The function that follows first reads an HTTP request then sends the HTTP response, with a single timeout that applies to the entire combined operation of reading and writing:
  520. ``` void process_http_2 (tcp_stream& stream, net::yield_context yield)
  521. {
  522. flat_buffer buffer;
  523. http::request<http::empty_body> req;
  524. // Require that the read and write combined take no longer than 30 seconds
  525. stream.expires_after(std::chrono::seconds(30));
  526. http::async_read(stream, buffer, req, yield);
  527. http::response<http::string_body> res = make_response(req);
  528. http::async_write (stream, res, yield);
  529. }
  530. ```
  531. Some stream algorithms, such as `ssl::stream::async_handshake` perform both reads and writes. A timeout set before calling the initiating function of such composite stream algorithms will apply to the entire composite operation. For example, a timeout may be set on performing the SSL handshake thusly:
  532. ``` void do_ssl_handshake (net::ssl::stream<tcp_stream>& stream, net::yield_context yield)
  533. {
  534. // Require that the SSL handshake take no longer than 10 seconds
  535. stream.expires_after(std::chrono::seconds(10));
  536. stream.async_handshake(net::ssl::stream_base::client, yield);
  537. }
  538. ```
  539. [heading Blocking I/O]
  540. Synchronous functions behave identically as that of the wrapped `net::basic_stream_socket`. Timeouts are not available when performing blocking calls.
  541. [heading Template Parameters] [table [[Type][Description]] [[`Protocol`][
  542. A type meeting the requirements of ['Protocol] representing the protocol the protocol to use for the basic stream socket. A common choice is `net::ip::tcp`. ]] [[`Executor`][
  543. A type meeting the requirements of ['Executor] to be used for submitting all completion handlers which do not already have an associated executor. If this type is omitted, the default of `net::executor` will be used. ]] ]
  544. [heading Thread Safety]
  545. ['Distinct objects]: Safe. ['Shared objects]: Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
  546. [heading See Also]
  547. * [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1322r0.html [P1322R0] Networking TS enhancement to enable custom I/O executors].
  548. [section:async_connect basic_stream::async_connect] [indexterm2 async_connect..basic_stream]
  549. Connect the stream to the specified endpoint asynchronously. ``` template< class __ConnectHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__basic_stream.async_connect.overload1 async_connect]``( endpoint_type const& ep, ConnectHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.async_connect.overload1 more...]]`` ```
  550. Establishes a connection by trying each endpoint in a sequence asynchronously. ``` template< class __EndpointSequence__, class __RangeConnectHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__basic_stream.async_connect.overload2 async_connect]``( EndpointSequence const& endpoints, RangeConnectHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.async_connect.overload2 more...]]`` template< class __EndpointSequence__, class __ConnectCondition__, class __RangeConnectHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__basic_stream.async_connect.overload3 async_connect]``( EndpointSequence const& endpoints, ConnectCondition connect_condition, RangeConnectHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.async_connect.overload3 more...]]`` template< class Iterator, class __IteratorConnectHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__basic_stream.async_connect.overload4 async_connect]``( Iterator begin, Iterator end, IteratorConnectHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.async_connect.overload4 more...]]`` template< class Iterator, class __ConnectCondition__, class __IteratorConnectHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__basic_stream.async_connect.overload5 async_connect]``( Iterator begin, Iterator end, ConnectCondition connect_condition, IteratorConnectHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.async_connect.overload5 more...]]`` ``` [section:overload1 basic_stream::async_connect (1 of 5 overloads)]
  551. Connect the stream to the specified endpoint asynchronously. [heading Synopsis] ``` template< class __ConnectHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_connect( endpoint_type const& ep, ConnectHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  552. This function is used to asynchronously connect the underlying socket to the specified remote endpoint. The function call always returns immediately. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  553. If the timeout timer expires while the operation is outstanding, the operation will be canceled and the completion handler will be invoked with the error [link beast.ref.boost__beast__error `timeout`].
  554. [heading Parameters] [table [[Name][Description]] [[`ep`][
  555. The remote endpoint to which the underlying socket will be connected. Copies will be made of the endpoint object as required. ]] [[`handler`][
  556. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  557. error_code ec // Result of operation
  558. );
  559. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  560. [heading See Also]
  561. [link beast.ref.boost__beast__basic_stream.async_connect `basic_stream::async_connect`]
  562. [endsect] [section:overload2 basic_stream::async_connect (2 of 5 overloads)]
  563. Establishes a connection by trying each endpoint in a sequence asynchronously. [heading Synopsis] ``` template< class __EndpointSequence__, class __RangeConnectHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_connect( EndpointSequence const& endpoints, RangeConnectHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  564. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  565. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the underlying socket's `async_connect` function.
  566. If the timeout timer expires while the operation is outstanding, the current connection attempt will be canceled and the completion handler will be invoked with the error [link beast.ref.boost__beast__error `timeout`].
  567. [heading Parameters] [table [[Name][Description]] [[`endpoints`][
  568. A sequence of endpoints. This this object must meet the requirements of ['EndpointSequence]. ]] [[`handler`][
  569. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  570. // Result of operation. if the sequence is empty, set to
  571. // net::error::not_found. Otherwise, contains the
  572. // error from the last connection attempt.
  573. error_code const& error,
  574. // On success, the successfully connected endpoint.
  575. // Otherwise, a default-constructed endpoint.
  576. typename Protocol::endpoint const& endpoint
  577. );
  578. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  579. [endsect] [section:overload3 basic_stream::async_connect (3 of 5 overloads)]
  580. Establishes a connection by trying each endpoint in a sequence asynchronously. [heading Synopsis] ``` template< class __EndpointSequence__, class __ConnectCondition__, class __RangeConnectHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_connect( EndpointSequence const& endpoints, ConnectCondition connect_condition, RangeConnectHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  581. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  582. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the underlying socket's `async_connect` function.
  583. If the timeout timer expires while the operation is outstanding, the current connection attempt will be canceled and the completion handler will be invoked with the error [link beast.ref.boost__beast__error `timeout`].
  584. [heading Parameters] [table [[Name][Description]] [[`endpoints`][
  585. A sequence of endpoints. This this object must meet the requirements of ['EndpointSequence]. ]] [[`connect_condition`][
  586. A function object that is called prior to each connection attempt. The signature of the function object must be: ``` bool connect_condition(
  587. error_code const& ec,
  588. typename Protocol::endpoint const& next);
  589. ``` The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped. ]] [[`handler`][
  590. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  591. // Result of operation. if the sequence is empty, set to
  592. // net::error::not_found. Otherwise, contains the
  593. // error from the last connection attempt.
  594. error_code const& error,
  595. // On success, the successfully connected endpoint.
  596. // Otherwise, a default-constructed endpoint.
  597. typename Protocol::endpoint const& endpoint
  598. );
  599. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  600. [heading Example]
  601. The following connect condition function object can be used to output information about the individual connection attempts: ``` struct my_connect_condition
  602. {
  603. bool operator()(
  604. error_code const& ec,
  605. net::ip::tcp::endpoint const& next)
  606. {
  607. if (ec)
  608. std::cout << "Error: " << ec.message() << std::endl;
  609. std::cout << "Trying: " << next << std::endl;
  610. return true;
  611. }
  612. };
  613. ```
  614. [endsect] [section:overload4 basic_stream::async_connect (4 of 5 overloads)]
  615. Establishes a connection by trying each endpoint in a sequence asynchronously. [heading Synopsis] ``` template< class Iterator, class __IteratorConnectHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_connect( Iterator begin, Iterator end, IteratorConnectHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  616. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  617. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the underlying socket's `async_connect` function.
  618. If the timeout timer expires while the operation is outstanding, the current connection attempt will be canceled and the completion handler will be invoked with the error [link beast.ref.boost__beast__error `timeout`].
  619. [heading Parameters] [table [[Name][Description]] [[`begin`][
  620. An iterator pointing to the start of a sequence of endpoints. ]] [[`end`][
  621. An iterator pointing to the end of a sequence of endpoints. ]] [[`handler`][
  622. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  623. // Result of operation. if the sequence is empty, set to
  624. // net::error::not_found. Otherwise, contains the
  625. // error from the last connection attempt.
  626. error_code const& error,
  627. // On success, an iterator denoting the successfully
  628. // connected endpoint. Otherwise, the end iterator.
  629. Iterator iterator
  630. );
  631. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  632. [endsect] [section:overload5 basic_stream::async_connect (5 of 5 overloads)]
  633. Establishes a connection by trying each endpoint in a sequence asynchronously. [heading Synopsis] ``` template< class Iterator, class __ConnectCondition__, class __IteratorConnectHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_connect( Iterator begin, Iterator end, ConnectCondition connect_condition, IteratorConnectHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  634. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the underlying socket's `async_connect` function.
  635. If the timeout timer expires while the operation is outstanding, the current connection attempt will be canceled and the completion handler will be invoked with the error [link beast.ref.boost__beast__error `timeout`].
  636. [heading Parameters] [table [[Name][Description]] [[`begin`][
  637. An iterator pointing to the start of a sequence of endpoints. ]] [[`end`][
  638. An iterator pointing to the end of a sequence of endpoints. ]] [[`connect_condition`][
  639. A function object that is called prior to each connection attempt. The signature of the function object must be: ``` bool connect_condition(
  640. error_code const& ec,
  641. Iterator next);
  642. ``` ]] [[`handler`][
  643. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  644. // Result of operation. if the sequence is empty, set to
  645. // net::error::not_found. Otherwise, contains the
  646. // error from the last connection attempt.
  647. error_code const& error,
  648. // On success, an iterator denoting the successfully
  649. // connected endpoint. Otherwise, the end iterator.
  650. Iterator iterator
  651. );
  652. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  653. [endsect] [endsect] [section:async_read_some basic_stream::async_read_some] [indexterm2 async_read_some..basic_stream]
  654. Read some data asynchronously. [heading Synopsis] ``` template< class __MutableBufferSequence__, class __ReadHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_read_some( MutableBufferSequence const& buffers, ReadHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  655. This function is used to asynchronously read data from the stream.
  656. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  657. * One or more bytes are read from the stream.
  658. * An error occurs.
  659. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_read_some` function. The program must ensure that no other calls to [link beast.ref.boost__beast__basic_stream.read_some `basic_stream::read_some`] or [link beast.ref.boost__beast__basic_stream.async_read_some `basic_stream::async_read_some`] are performed until this operation completes.
  660. If the timeout timer expires while the operation is outstanding, the operation will be canceled and the completion handler will be invoked with the error [link beast.ref.boost__beast__error `timeout`].
  661. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  662. The buffers into which the data will be read. If the size of the buffers is zero bytes, the operation always completes immediately with no error. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  663. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  664. error_code error, // Result of operation.
  665. std::size_t bytes_transferred // Number of bytes read.
  666. );
  667. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  668. [heading Remarks]
  669. The `async_read_some` operation may not receive all of the requested number of bytes. Consider using the function `net::async_read` if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
  670. [endsect] [section:async_write_some basic_stream::async_write_some] [indexterm2 async_write_some..basic_stream]
  671. Write some data asynchronously. [heading Synopsis] ``` template< class __ConstBufferSequence__, class __WriteHandler__ = net::default_completion_token_t<Executor>> ``__deduced__`` async_write_some( ConstBufferSequence const& buffers, WriteHandler&& handler = net::default_completion_token_t< Executor >{}); ``` [heading Description]
  672. This function is used to asynchronously write data to the underlying socket.
  673. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  674. * One or more bytes are written to the stream.
  675. * An error occurs.
  676. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_write_some` function. The program must ensure that no other calls to [link beast.ref.boost__beast__basic_stream.async_write_some `basic_stream::async_write_some`] are performed until this operation completes.
  677. If the timeout timer expires while the operation is outstanding, the operation will be canceled and the completion handler will be invoked with the error [link beast.ref.boost__beast__error `timeout`].
  678. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  679. The buffers from which the data will be written. If the size of the buffers is zero bytes, the operation always completes immediately with no error. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  680. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  681. error_code error, // Result of operation.
  682. std::size_t bytes_transferred // Number of bytes written.
  683. );
  684. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  685. [heading Remarks]
  686. The `async_write_some` operation may not transmit all of the requested number of bytes. Consider using the function `net::async_write` if you need to ensure that the requested amount of data is sent before the asynchronous operation completes.
  687. [endsect] [section:basic_stream basic_stream::basic_stream] [indexterm2 basic_stream..basic_stream]
  688. Constructor. ``` template< class... Args> explicit ``[link beast.ref.boost__beast__basic_stream.basic_stream.overload1 basic_stream]``( Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.basic_stream.overload1 more...]]`` template< class RatePolicy_, class... Args> explicit ``[link beast.ref.boost__beast__basic_stream.basic_stream.overload2 basic_stream]``( RatePolicy_&& policy, Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.basic_stream.overload2 more...]]`` ```
  689. Move constructor. ``` ``[link beast.ref.boost__beast__basic_stream.basic_stream.overload3 basic_stream]``( basic_stream&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.basic_stream.overload3 more...]]`` ``` [section:overload1 basic_stream::basic_stream (1 of 3 overloads)]
  690. Constructor. [heading Synopsis] ``` template< class... Args> basic_stream( Args&&... args); ``` [heading Description]
  691. This constructor creates the stream by forwarding all arguments to the underlying socket. The socket then needs to be open and connected or accepted before data can be sent or received on it.
  692. [heading Parameters] [table [[Name][Description]] [[`args`][
  693. A list of parameters forwarded to the constructor of the underlying socket. ]] ]
  694. [endsect] [section:overload2 basic_stream::basic_stream (2 of 3 overloads)]
  695. Constructor. [heading Synopsis] ``` template< class RatePolicy_, class... Args> basic_stream( RatePolicy_&& policy, Args&&... args); ``` [heading Description]
  696. This constructor creates the stream with the specified rate policy, and forwards all remaining arguments to the underlying socket. The socket then needs to be open and connected or accepted before data can be sent or received on it.
  697. [heading Parameters] [table [[Name][Description]] [[`policy`][
  698. The rate policy object to use. The stream will take ownership of this object by decay-copy. ]] [[`args`][
  699. A list of parameters forwarded to the constructor of the underlying socket. ]] ]
  700. [endsect] [section:overload3 basic_stream::basic_stream (3 of 3 overloads)]
  701. Move constructor. [heading Synopsis] ``` basic_stream( basic_stream&& other); ``` [heading Description]
  702. [heading Parameters] [table [[Name][Description]] [[`other`][
  703. The other object from which the move will occur. ]] ]
  704. [heading Remarks]
  705. Following the move, the moved-from object is in the same state as if newly constructed.
  706. [endsect] [endsect] [section:cancel basic_stream::cancel] [indexterm2 cancel..basic_stream]
  707. Cancel all asynchronous operations associated with the socket. [heading Synopsis] ``` void cancel(); ``` [heading Description]
  708. This function causes all outstanding asynchronous connect, read, and write operations to finish immediately. Completion handlers for cancelled operations will receive the error `net::error::operation_aborted`. Completion handlers not yet invoked whose operations have completed, will receive the error corresponding to the result of the operation (which may indicate success). [endsect] [section:close basic_stream::close] [indexterm2 close..basic_stream]
  709. Close the timed stream. [heading Synopsis] ``` void close(); ``` [heading Description]
  710. This cancels all of the outstanding asynchronous operations as if by calling [link beast.ref.boost__beast__basic_stream.cancel `basic_stream::cancel`], and closes the underlying socket. [endsect] [section:connect basic_stream::connect] [indexterm2 connect..basic_stream]
  711. Connect the stream to the specified endpoint. ``` void ``[link beast.ref.boost__beast__basic_stream.connect.overload1 connect]``( endpoint_type const& ep); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.connect.overload1 more...]]`` void ``[link beast.ref.boost__beast__basic_stream.connect.overload2 connect]``( endpoint_type const& ep, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.connect.overload2 more...]]`` ```
  712. Establishes a connection by trying each endpoint in a sequence. ``` template< class __EndpointSequence__> Protocol::endpoint ``[link beast.ref.boost__beast__basic_stream.connect.overload3 connect]``( EndpointSequence const& endpoints); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.connect.overload3 more...]]`` template< class __EndpointSequence__> Protocol::endpoint ``[link beast.ref.boost__beast__basic_stream.connect.overload4 connect]``( EndpointSequence const& endpoints, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.connect.overload4 more...]]`` template< class Iterator> Iterator ``[link beast.ref.boost__beast__basic_stream.connect.overload5 connect]``( Iterator begin, Iterator end); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.connect.overload5 more...]]`` template< class Iterator> Iterator ``[link beast.ref.boost__beast__basic_stream.connect.overload6 connect]``( Iterator begin, Iterator end, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.connect.overload6 more...]]`` template< class __EndpointSequence__, class __ConnectCondition__> Protocol::endpoint ``[link beast.ref.boost__beast__basic_stream.connect.overload7 connect]``( EndpointSequence const& endpoints, ConnectCondition connect_condition); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.connect.overload7 more...]]`` template< class __EndpointSequence__, class __ConnectCondition__> Protocol::endpoint ``[link beast.ref.boost__beast__basic_stream.connect.overload8 connect]``( EndpointSequence const& endpoints, ConnectCondition connect_condition, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.connect.overload8 more...]]`` template< class Iterator, class __ConnectCondition__> Iterator ``[link beast.ref.boost__beast__basic_stream.connect.overload9 connect]``( Iterator begin, Iterator end, ConnectCondition connect_condition); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.connect.overload9 more...]]`` template< class Iterator, class __ConnectCondition__> Iterator ``[link beast.ref.boost__beast__basic_stream.connect.overload10 connect]``( Iterator begin, Iterator end, ConnectCondition connect_condition, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.connect.overload10 more...]]`` ``` [section:overload1 basic_stream::connect (1 of 10 overloads)]
  713. Connect the stream to the specified endpoint. [heading Synopsis] ``` void connect( endpoint_type const& ep); ``` [heading Description]
  714. This function is used to connect the underlying socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  715. [heading Parameters] [table [[Name][Description]] [[`ep`][
  716. The remote endpoint to connect to. ]] ]
  717. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  718. Thrown on failure. ]] ]
  719. [heading See Also]
  720. [link beast.ref.boost__beast__basic_stream.connect `basic_stream::connect`]
  721. [endsect] [section:overload2 basic_stream::connect (2 of 10 overloads)]
  722. Connect the stream to the specified endpoint. [heading Synopsis] ``` void connect( endpoint_type const& ep, error_code& ec); ``` [heading Description]
  723. This function is used to connect the underlying socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  724. [heading Parameters] [table [[Name][Description]] [[`ep`][
  725. The remote endpoint to connect to. ]] [[`ec`][
  726. Set to indicate what error occurred, if any. ]] ]
  727. [heading See Also]
  728. [link beast.ref.boost__beast__basic_stream.connect `basic_stream::connect`]
  729. [endsect] [section:overload3 basic_stream::connect (3 of 10 overloads)]
  730. Establishes a connection by trying each endpoint in a sequence. [heading Synopsis] ``` template< class __EndpointSequence__> Protocol::endpoint connect( EndpointSequence const& endpoints); ``` [heading Description]
  731. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  732. The algorithm, known as a ['composed operation], is implemented in terms of calls to the underlying socket's `connect` function.
  733. [heading Parameters] [table [[Name][Description]] [[`endpoints`][
  734. A sequence of endpoints. ]] ]
  735. [heading Return Value]
  736. The successfully connected endpoint.
  737. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  738. Thrown on failure. If the sequence is empty, the associated error code is `net::error::not_found`. Otherwise, contains the error from the last connection attempt. ]] ]
  739. [endsect] [section:overload4 basic_stream::connect (4 of 10 overloads)]
  740. Establishes a connection by trying each endpoint in a sequence. [heading Synopsis] ``` template< class __EndpointSequence__> Protocol::endpoint connect( EndpointSequence const& endpoints, error_code& ec); ``` [heading Description]
  741. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  742. The algorithm, known as a ['composed operation], is implemented in terms of calls to the underlying socket's `connect` function.
  743. [heading Parameters] [table [[Name][Description]] [[`endpoints`][
  744. A sequence of endpoints. ]] [[`ec`][
  745. Set to indicate what error occurred, if any. If the sequence is empty, set to `net::error::not_found`. Otherwise, contains the error from the last connection attempt. ]] ]
  746. [heading Return Value]
  747. On success, the successfully connected endpoint. Otherwise, a default-constructed endpoint.
  748. [endsect] [section:overload5 basic_stream::connect (5 of 10 overloads)]
  749. Establishes a connection by trying each endpoint in a sequence. [heading Synopsis] ``` template< class Iterator> Iterator connect( Iterator begin, Iterator end); ``` [heading Description]
  750. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  751. The algorithm, known as a ['composed operation], is implemented in terms of calls to the underlying socket's `connect` function.
  752. [heading Parameters] [table [[Name][Description]] [[`begin`][
  753. An iterator pointing to the start of a sequence of endpoints. ]] [[`end`][
  754. An iterator pointing to the end of a sequence of endpoints. ]] ]
  755. [heading Return Value]
  756. An iterator denoting the successfully connected endpoint.
  757. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  758. Thrown on failure. If the sequence is empty, the associated error code is `net::error::not_found`. Otherwise, contains the error from the last connection attempt. ]] ]
  759. [endsect] [section:overload6 basic_stream::connect (6 of 10 overloads)]
  760. Establishes a connection by trying each endpoint in a sequence. [heading Synopsis] ``` template< class Iterator> Iterator connect( Iterator begin, Iterator end, error_code& ec); ``` [heading Description]
  761. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  762. The algorithm, known as a ['composed operation], is implemented in terms of calls to the underlying socket's `connect` function.
  763. [heading Parameters] [table [[Name][Description]] [[`begin`][
  764. An iterator pointing to the start of a sequence of endpoints. ]] [[`end`][
  765. An iterator pointing to the end of a sequence of endpoints. ]] [[`ec`][
  766. Set to indicate what error occurred, if any. If the sequence is empty, set to boost::asio::error::not\_found. Otherwise, contains the error from the last connection attempt. ]] ]
  767. [heading Return Value]
  768. On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
  769. [endsect] [section:overload7 basic_stream::connect (7 of 10 overloads)]
  770. Establishes a connection by trying each endpoint in a sequence. [heading Synopsis] ``` template< class __EndpointSequence__, class __ConnectCondition__> Protocol::endpoint connect( EndpointSequence const& endpoints, ConnectCondition connect_condition); ``` [heading Description]
  771. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  772. The algorithm, known as a ['composed operation], is implemented in terms of calls to the underlying socket's `connect` function.
  773. [heading Parameters] [table [[Name][Description]] [[`endpoints`][
  774. A sequence of endpoints. ]] [[`connect_condition`][
  775. A function object that is called prior to each connection attempt. The signature of the function object must be: ``` bool connect_condition(
  776. error_code const& ec,
  777. typename Protocol::endpoint const& next);
  778. ``` The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped. ]] ]
  779. [heading Return Value]
  780. The successfully connected endpoint.
  781. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  782. Thrown on failure. If the sequence is empty, the associated error code is `net::error::not_found`. Otherwise, contains the error from the last connection attempt. ]] ]
  783. [endsect] [section:overload8 basic_stream::connect (8 of 10 overloads)]
  784. Establishes a connection by trying each endpoint in a sequence. [heading Synopsis] ``` template< class __EndpointSequence__, class __ConnectCondition__> Protocol::endpoint connect( EndpointSequence const& endpoints, ConnectCondition connect_condition, error_code& ec); ``` [heading Description]
  785. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  786. The algorithm, known as a ['composed operation], is implemented in terms of calls to the underlying socket's `connect` function.
  787. [heading Parameters] [table [[Name][Description]] [[`endpoints`][
  788. A sequence of endpoints. ]] [[`connect_condition`][
  789. A function object that is called prior to each connection attempt. The signature of the function object must be: ``` bool connect_condition(
  790. error_code const& ec,
  791. typename Protocol::endpoint const& next);
  792. ``` The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped. ]] [[`ec`][
  793. Set to indicate what error occurred, if any. If the sequence is empty, set to `net::error::not_found`. Otherwise, contains the error from the last connection attempt. ]] ]
  794. [heading Return Value]
  795. On success, the successfully connected endpoint. Otherwise, a default-constructed endpoint.
  796. [endsect] [section:overload9 basic_stream::connect (9 of 10 overloads)]
  797. Establishes a connection by trying each endpoint in a sequence. [heading Synopsis] ``` template< class Iterator, class __ConnectCondition__> Iterator connect( Iterator begin, Iterator end, ConnectCondition connect_condition); ``` [heading Description]
  798. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  799. The algorithm, known as a ['composed operation], is implemented in terms of calls to the underlying socket's `connect` function.
  800. [heading Parameters] [table [[Name][Description]] [[`begin`][
  801. An iterator pointing to the start of a sequence of endpoints. ]] [[`end`][
  802. An iterator pointing to the end of a sequence of endpoints. ]] [[`connect_condition`][
  803. A function object that is called prior to each connection attempt. The signature of the function object must be: ``` bool connect_condition(
  804. error_code const& ec,
  805. typename Protocol::endpoint const& next);
  806. ``` The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped. ]] ]
  807. [heading Return Value]
  808. An iterator denoting the successfully connected endpoint.
  809. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  810. Thrown on failure. If the sequence is empty, the associated `error_code` is `net::error::not_found`. Otherwise, contains the error from the last connection attempt. ]] ]
  811. [endsect] [section:overload10 basic_stream::connect (10 of 10 overloads)]
  812. Establishes a connection by trying each endpoint in a sequence. [heading Synopsis] ``` template< class Iterator, class __ConnectCondition__> Iterator connect( Iterator begin, Iterator end, ConnectCondition connect_condition, error_code& ec); ``` [heading Description]
  813. This function attempts to connect the stream to one of a sequence of endpoints by trying each endpoint until a connection is successfully established. The underlying socket is automatically opened if needed. An automatically opened socket is not returned to the closed state upon failure.
  814. The algorithm, known as a ['composed operation], is implemented in terms of calls to the underlying socket's `connect` function.
  815. [heading Parameters] [table [[Name][Description]] [[`begin`][
  816. An iterator pointing to the start of a sequence of endpoints. ]] [[`end`][
  817. An iterator pointing to the end of a sequence of endpoints. ]] [[`connect_condition`][
  818. A function object that is called prior to each connection attempt. The signature of the function object must be: ``` bool connect_condition(
  819. error_code const& ec,
  820. typename Protocol::endpoint const& next);
  821. ``` The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped. ]] [[`ec`][
  822. Set to indicate what error occurred, if any. If the sequence is empty, set to `net::error::not_found`. Otherwise, contains the error from the last connection attempt. ]] ]
  823. [heading Return Value]
  824. On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
  825. [endsect] [endsect] [section:endpoint_type basic_stream::endpoint_type] [indexterm2 endpoint_type..basic_stream]
  826. The endpoint type. [heading Synopsis] ``` using endpoint_type = typename Protocol::endpoint; ``` [heading Description] [endsect] [section:executor_type basic_stream::executor_type] [indexterm2 executor_type..basic_stream]
  827. The type of the executor associated with the stream. [heading Synopsis] ``` using executor_type = beast::executor_type< socket_type >; ``` [heading Description]
  828. This will be the type of executor used to invoke completion handlers which do not have an explicit associated executor. [endsect] [section:expires_after basic_stream::expires_after] [indexterm2 expires_after..basic_stream]
  829. Set the timeout for the next logical operation. [heading Synopsis] ``` void expires_after( std::chrono::nanoseconds expiry_time); ``` [heading Description]
  830. This sets either the read timer, the write timer, or both timers to expire after the specified amount of time has elapsed. If a timer expires when the corresponding asynchronous operation is outstanding, the stream will be closed and any outstanding operations will complete with the error [link beast.ref.boost__beast__error `timeout`]. Otherwise, if the timer expires while no operations are outstanding, and the expiraton is not set again, the next operation will time out immediately.
  831. The timer applies collectively to any asynchronous reads or writes initiated after the expiration is set, until the expiration is set again. A call to [link beast.ref.boost__beast__basic_stream.async_connect `basic_stream::async_connect`] counts as both a read and a write.
  832. [heading Parameters] [table [[Name][Description]] [[`expiry_time`][
  833. The amount of time after which a logical operation should be considered timed out. ]] ]
  834. [endsect] [section:expires_at basic_stream::expires_at] [indexterm2 expires_at..basic_stream]
  835. Set the timeout for the next logical operation. [heading Synopsis] ``` void expires_at( net::steady_timer::time_point expiry_time); ``` [heading Description]
  836. This sets either the read timer, the write timer, or both timers to expire at the specified time point. If a timer expires when the corresponding asynchronous operation is outstanding, the stream will be closed and any outstanding operations will complete with the error [link beast.ref.boost__beast__error `timeout`]. Otherwise, if the timer expires while no operations are outstanding, and the expiraton is not set again, the next operation will time out immediately.
  837. The timer applies collectively to any asynchronous reads or writes initiated after the expiration is set, until the expiration is set again. A call to [link beast.ref.boost__beast__basic_stream.async_connect `basic_stream::async_connect`] counts as both a read and a write.
  838. [heading Parameters] [table [[Name][Description]] [[`expiry_time`][
  839. The time point after which a logical operation should be considered timed out. ]] ]
  840. [endsect] [section:expires_never basic_stream::expires_never] [indexterm2 expires_never..basic_stream]
  841. Disable the timeout for the next logical operation. [heading Synopsis] ``` void expires_never(); ``` [heading Description] [endsect] [section:get_executor basic_stream::get_executor] [indexterm2 get_executor..basic_stream]
  842. Get the executor associated with the object. [heading Synopsis] ``` executor_type get_executor(); ``` [heading Description]
  843. This function may be used to obtain the executor object that the stream uses to dispatch completion handlers without an assocaited executor.
  844. [heading Return Value]
  845. A copy of the executor that stream will use to dispatch handlers.
  846. [endsect] [section:operator_eq_ basic_stream::operator=] [indexterm2 operator=..basic_stream]
  847. Move assignment (deleted). [heading Synopsis] ``` basic_stream& operator=( basic_stream&&); ``` [heading Description] [endsect] [section:protocol_type basic_stream::protocol_type] [indexterm2 protocol_type..basic_stream]
  848. The protocol type. [heading Synopsis] ``` using protocol_type = Protocol; ``` [heading Description] [endsect] [section:rate_policy basic_stream::rate_policy] [indexterm2 rate_policy..basic_stream]
  849. Returns the rate policy associated with the object. ``` RatePolicy& ``[link beast.ref.boost__beast__basic_stream.rate_policy.overload1 rate_policy]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.rate_policy.overload1 more...]]`` RatePolicy const & ``[link beast.ref.boost__beast__basic_stream.rate_policy.overload2 rate_policy]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.rate_policy.overload2 more...]]`` ``` [section:overload1 basic_stream::rate_policy (1 of 2 overloads)]
  850. Returns the rate policy associated with the object. [heading Synopsis] ``` RatePolicy& rate_policy(); ``` [heading Description] [endsect] [section:overload2 basic_stream::rate_policy (2 of 2 overloads)]
  851. Returns the rate policy associated with the object. [heading Synopsis] ``` RatePolicy const & rate_policy() const; ``` [heading Description] [endsect] [endsect] [section:read_some basic_stream::read_some] [indexterm2 read_some..basic_stream]
  852. Read some data. ``` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__basic_stream.read_some.overload1 read_some]``( MutableBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.read_some.overload1 more...]]`` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__basic_stream.read_some.overload2 read_some]``( MutableBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.read_some.overload2 more...]]`` ``` [section:overload1 basic_stream::read_some (1 of 2 overloads)]
  853. Read some data. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers); ``` [heading Description]
  854. This function is used to read some data from the stream.
  855. The call blocks until one of the following is true:
  856. * One or more bytes are read from the stream.
  857. * An error occurs.
  858. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  859. The buffers into which the data will be read. If the size of the buffers is zero bytes, the call always returns immediately with no error. ]] ]
  860. [heading Return Value]
  861. The number of bytes read.
  862. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  863. Thrown on failure. ]] ]
  864. [heading Remarks]
  865. The `read_some` operation may not receive all of the requested number of bytes. Consider using the function `net::read` if you need to ensure that the requested amount of data is read before the blocking operation completes.
  866. [endsect] [section:overload2 basic_stream::read_some (2 of 2 overloads)]
  867. Read some data. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  868. This function is used to read some data from the underlying socket.
  869. The call blocks until one of the following is true:
  870. * One or more bytes are read from the stream.
  871. * An error occurs.
  872. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  873. The buffers into which the data will be read. If the size of the buffers is zero bytes, the call always returns immediately with no error. ]] [[`ec`][
  874. Set to indicate what error occurred, if any. ]] ]
  875. [heading Return Value]
  876. The number of bytes read.
  877. [heading Remarks]
  878. The `read_some` operation may not receive all of the requested number of bytes. Consider using the function `net::read` if you need to ensure that the requested amount of data is read before the blocking operation completes.
  879. [endsect] [endsect] [section:release_socket basic_stream::release_socket] [indexterm2 release_socket..basic_stream]
  880. Release ownership of the underlying socket. [heading Synopsis] ``` socket_type release_socket(); ``` [heading Description]
  881. This function causes all outstanding asynchronous connect, read, and write operations to be canceled as if by a call to [link beast.ref.boost__beast__basic_stream.cancel `basic_stream::cancel`]. Ownership of the underlying socket is then transferred to the caller. [endsect] [section:socket basic_stream::socket] [indexterm2 socket..basic_stream]
  882. Return a reference to the underlying socket. ``` socket_type& ``[link beast.ref.boost__beast__basic_stream.socket.overload1 socket]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.socket.overload1 more...]]`` socket_type const & ``[link beast.ref.boost__beast__basic_stream.socket.overload2 socket]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.socket.overload2 more...]]`` ``` [section:overload1 basic_stream::socket (1 of 2 overloads)]
  883. Return a reference to the underlying socket. [heading Synopsis] ``` socket_type& socket(); ``` [heading Description] [endsect] [section:overload2 basic_stream::socket (2 of 2 overloads)]
  884. Return a reference to the underlying socket. [heading Synopsis] ``` socket_type const & socket() const; ``` [heading Description] [endsect] [endsect] [section:socket_type basic_stream::socket_type] [indexterm2 socket_type..basic_stream]
  885. The type of the underlying socket. [heading Synopsis] ``` using socket_type = net::basic_stream_socket< Protocol, Executor >; ``` [heading Description] [endsect] [section:write_some basic_stream::write_some] [indexterm2 write_some..basic_stream]
  886. Write some data. ``` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__basic_stream.write_some.overload1 write_some]``( ConstBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.write_some.overload1 more...]]`` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__basic_stream.write_some.overload2 write_some]``( ConstBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream.write_some.overload2 more...]]`` ``` [section:overload1 basic_stream::write_some (1 of 2 overloads)]
  887. Write some data. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers); ``` [heading Description]
  888. This function is used to write some data to the stream.
  889. The call blocks until one of the following is true:
  890. * One or more bytes are written to the stream.
  891. * An error occurs.
  892. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  893. The buffers from which the data will be written. If the size of the buffers is zero bytes, the call always returns immediately with no error. ]] ]
  894. [heading Return Value]
  895. The number of bytes written.
  896. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  897. Thrown on failure. ]] ]
  898. [heading Remarks]
  899. The `write_some` operation may not transmit all of the requested number of bytes. Consider using the function `net::write` if you need to ensure that the requested amount of data is written before the blocking operation completes.
  900. [endsect] [section:overload2 basic_stream::write_some (2 of 2 overloads)]
  901. Write some data. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  902. This function is used to write some data to the stream.
  903. The call blocks until one of the following is true:
  904. * One or more bytes are written to the stream.
  905. * An error occurs.
  906. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  907. The buffers from which the data will be written. If the size of the buffers is zero bytes, the call always returns immediately with no error. ]] [[`ec`][
  908. Set to indicate what error occurred, if any. ]] ]
  909. [heading Return Value]
  910. The number of bytes written.
  911. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  912. Thrown on failure. ]] ]
  913. [heading Remarks]
  914. The `write_some` operation may not transmit all of the requested number of bytes. Consider using the function `net::write` if you need to ensure that the requested amount of data is written before the blocking operation completes.
  915. [endsect] [endsect] [section:basic_stream_dtor_ basic_stream::~basic_stream] [indexterm2 ~basic_stream..basic_stream]
  916. Destructor. [heading Synopsis] ``` ~basic_stream(); ``` [heading Description]
  917. This function destroys the stream, cancelling any outstanding asynchronous operations associated with the socket as if by calling cancel. [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__basic_stream__impl_type basic_stream::impl_type] [heading Synopsis] Defined in header [include_file boost/beast/core/basic_stream.hpp] ``` struct impl_type : public boost::enable_shared_from_this< impl_type >, public boost::empty_value< RatePolicy > ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_stream__impl_type.close [*close]]] [ ] ] [ [[link beast.ref.boost__beast__basic_stream__impl_type.ex [*ex]]] [ ] ] [ [[link beast.ref.boost__beast__basic_stream__impl_type.impl_type [*impl_type]]] [ ] ] [ [[link beast.ref.boost__beast__basic_stream__impl_type.on_timer [*on_timer]]] [ ] ] [ [[link beast.ref.boost__beast__basic_stream__impl_type.operator_eq_ [*operator=]]] [ ] ] [ [[link beast.ref.boost__beast__basic_stream__impl_type.policy [*policy]]] [ ] ] [ [[link beast.ref.boost__beast__basic_stream__impl_type.reset [*reset]]] [ ] ] ] [heading Data Members] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_stream__impl_type.read [*read]]] [ ] ] [ [[link beast.ref.boost__beast__basic_stream__impl_type.socket [*socket]]] [ ] ] [ [[link beast.ref.boost__beast__basic_stream__impl_type.timer [*timer]]] [ ] ] [ [[link beast.ref.boost__beast__basic_stream__impl_type.waiting [*waiting]]] [ ] ] [ [[link beast.ref.boost__beast__basic_stream__impl_type.write [*write]]] [ ] ] ] [heading Description] [section:close basic_stream::impl_type::close] [indexterm2 close..basic_stream::impl_type] [heading Synopsis] ``` void close(); ``` [heading Description] [endsect] [section:ex basic_stream::impl_type::ex] [indexterm2 ex..basic_stream::impl_type] [heading Synopsis] ``` beast::executor_type< socket_type > ex(); ``` [heading Description] [endsect] [section:impl_type basic_stream::impl_type::impl_type] [indexterm2 impl_type..basic_stream::impl_type] ``` ``[link beast.ref.boost__beast__basic_stream__impl_type.impl_type.overload1 impl_type]``( impl_type&&); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream__impl_type.impl_type.overload1 more...]]`` template< class... Args> explicit ``[link beast.ref.boost__beast__basic_stream__impl_type.impl_type.overload2 impl_type]``( std::false_type, Args&& ...); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream__impl_type.impl_type.overload2 more...]]`` template< class RatePolicy_, class... Args> explicit ``[link beast.ref.boost__beast__basic_stream__impl_type.impl_type.overload3 impl_type]``( std::true_type, RatePolicy_&& policy, Args&& ...); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream__impl_type.impl_type.overload3 more...]]`` ``` [section:overload1 basic_stream::impl_type::impl_type (1 of 3 overloads)] [heading Synopsis] ``` impl_type( impl_type&&); ``` [heading Description] [endsect] [section:overload2 basic_stream::impl_type::impl_type (2 of 3 overloads)] [heading Synopsis] ``` template< class... Args> impl_type( std::false_type, Args&& ...); ``` [heading Description] [endsect] [section:overload3 basic_stream::impl_type::impl_type (3 of 3 overloads)] [heading Synopsis] ``` template< class RatePolicy_, class... Args> impl_type( std::true_type, RatePolicy_&& policy, Args&& ...); ``` [heading Description] [endsect] [endsect] [section:on_timer basic_stream::impl_type::on_timer] [indexterm2 on_timer..basic_stream::impl_type] [heading Synopsis] ``` template< class __Executor2__> void on_timer( Executor2 const& ex2); ``` [heading Description] [endsect] [section:operator_eq_ basic_stream::impl_type::operator=] [indexterm2 operator=..basic_stream::impl_type] [heading Synopsis] ``` impl_type& operator=( impl_type&&); ``` [heading Description] [endsect] [section:policy basic_stream::impl_type::policy] [indexterm2 policy..basic_stream::impl_type] ``` RatePolicy& ``[link beast.ref.boost__beast__basic_stream__impl_type.policy.overload1 policy]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream__impl_type.policy.overload1 more...]]`` RatePolicy const & ``[link beast.ref.boost__beast__basic_stream__impl_type.policy.overload2 policy]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__basic_stream__impl_type.policy.overload2 more...]]`` ``` [section:overload1 basic_stream::impl_type::policy (1 of 2 overloads)] [heading Synopsis] ``` RatePolicy& policy(); ``` [heading Description] [endsect] [section:overload2 basic_stream::impl_type::policy (2 of 2 overloads)] [heading Synopsis] ``` RatePolicy const & policy() const; ``` [heading Description] [endsect] [endsect] [section:read basic_stream::impl_type::read] [indexterm2 read..basic_stream::impl_type] [heading Synopsis] ``` op_state read; ``` [heading Description] [endsect] [section:reset basic_stream::impl_type::reset] [indexterm2 reset..basic_stream::impl_type] [heading Synopsis] ``` void reset(); ``` [heading Description] [endsect] [section:socket basic_stream::impl_type::socket] [indexterm2 socket..basic_stream::impl_type] [heading Synopsis] ``` net::basic_stream_socket< Protocol, Executor > socket; ``` [heading Description] [endsect] [section:timer basic_stream::impl_type::timer] [indexterm2 timer..basic_stream::impl_type] [heading Synopsis] ``` net::steady_timer timer; ``` [heading Description] [endsect] [section:waiting basic_stream::impl_type::waiting] [indexterm2 waiting..basic_stream::impl_type] [heading Synopsis] ``` int waiting = 0; ``` [heading Description] [endsect] [section:write basic_stream::impl_type::write] [indexterm2 write..basic_stream::impl_type] [heading Synopsis] ``` op_state write; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__basic_stream__rebind_executor basic_stream::rebind_executor]
  918. Rebinds the stream type to another executor. [heading Synopsis] Defined in header [include_file boost/beast/core/basic_stream.hpp] ``` template< class __Executor1__> struct rebind_executor ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_stream__rebind_executor.other [*other]]] [ The stream type when rebound to the specified executor. ] ] ] [heading Description] [section:other basic_stream::rebind_executor::other] [indexterm2 other..basic_stream::rebind_executor]
  919. The stream type when rebound to the specified executor. [heading Synopsis] ``` using other = basic_stream< Protocol, Executor1, RatePolicy >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_stream__rebind_executor [*rebind_executor]]] [ Rebinds the stream type to another executor. ] ] [ [[link beast.ref.boost__beast__basic_stream.endpoint_type [*endpoint_type]]] [ The endpoint type. ] ] [ [[link beast.ref.boost__beast__basic_stream.executor_type [*executor_type]]] [ The type of the executor associated with the stream. ] ] [ [[link beast.ref.boost__beast__basic_stream.protocol_type [*protocol_type]]] [ The protocol type. ] ] [ [[link beast.ref.boost__beast__basic_stream.socket_type [*socket_type]]] [ The type of the underlying socket. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_stream.async_connect [*async_connect]]] [ Connect the stream to the specified endpoint asynchronously. Establishes a connection by trying each endpoint in a sequence asynchronously. ] ] [ [[link beast.ref.boost__beast__basic_stream.async_read_some [*async_read_some]]] [ Read some data asynchronously. ] ] [ [[link beast.ref.boost__beast__basic_stream.async_write_some [*async_write_some]]] [ Write some data asynchronously. ] ] [ [[link beast.ref.boost__beast__basic_stream.basic_stream [*basic_stream]]] [ Constructor. Move constructor. ] ] [ [[link beast.ref.boost__beast__basic_stream.cancel [*cancel]]] [ Cancel all asynchronous operations associated with the socket. ] ] [ [[link beast.ref.boost__beast__basic_stream.close [*close]]] [ Close the timed stream. ] ] [ [[link beast.ref.boost__beast__basic_stream.connect [*connect]]] [ Connect the stream to the specified endpoint. Establishes a connection by trying each endpoint in a sequence. ] ] [ [[link beast.ref.boost__beast__basic_stream.expires_after [*expires_after]]] [ Set the timeout for the next logical operation. ] ] [ [[link beast.ref.boost__beast__basic_stream.expires_at [*expires_at]]] [ Set the timeout for the next logical operation. ] ] [ [[link beast.ref.boost__beast__basic_stream.expires_never [*expires_never]]] [ Disable the timeout for the next logical operation. ] ] [ [[link beast.ref.boost__beast__basic_stream.get_executor [*get_executor]]] [ Get the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__basic_stream.operator_eq_ [*operator=]]] [ Move assignment (deleted). ] ] [ [[link beast.ref.boost__beast__basic_stream.rate_policy [*rate_policy]]] [ Returns the rate policy associated with the object. ] ] [ [[link beast.ref.boost__beast__basic_stream.read_some [*read_some]]] [ Read some data. ] ] [ [[link beast.ref.boost__beast__basic_stream.release_socket [*release_socket]]] [ Release ownership of the underlying socket. ] ] [ [[link beast.ref.boost__beast__basic_stream.socket [*socket]]] [ Return a reference to the underlying socket. ] ] [ [[link beast.ref.boost__beast__basic_stream.write_some [*write_some]]] [ Write some data. ] ] [ [[link beast.ref.boost__beast__basic_stream.basic_stream_dtor_ [*~basic_stream]]] [ Destructor. ] ] ]
  920. This stream wraps a `net::basic_stream_socket` to provide the following features:
  921. * An ['Executor] may be associated with the stream, which will be used to invoke any completion handlers which do not already have an associated executor. This achieves support for [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1322r0.html [P1322R0] Networking TS enhancement to enable custom I/O executors].
  922. * Timeouts may be specified for each logical asynchronous operation performing any reading, writing, or connecting.
  923. * A ['RatePolicy] may be associated with the stream, to implement rate limiting through the policy's interface.
  924. Although the stream supports multiple concurrent outstanding asynchronous operations, the stream object is not thread-safe. The caller is responsible for ensuring that the stream is accessed from only one thread at a time. This includes the times when the stream, and its underlying socket, are accessed by the networking implementation. To meet this thread safety requirement, all asynchronous operations must be performed by the stream within the same implicit strand (only one thread `net::io_context::run`) or within the same explicit strand, such as an instance of `net::strand`.
  925. Completion handlers with explicit associated executors (such as those arising from use of `net::bind_executor`) will be invoked by the stream using the associated executor. Otherwise, the completion handler will be invoked by the executor associated with the stream upon construction. The type of executor used with this stream must meet the following requirements:
  926. * Function objects submitted to the executor shall never run concurrently with each other.
  927. The executor type `net::strand` meets these requirements. Use of a strand as the executor in the stream class template offers an additional notational convenience: the strand does not need to be specified in each individual initiating function call.
  928. Unlike other stream wrappers, the underlying socket is accessed through the [link beast.ref.boost__beast__basic_stream.socket `basic_stream::socket`] member function instead of `next_layer`. This causes the [link beast.ref.boost__beast__basic_stream `basic_stream`] to be returned in calls to [link beast.ref.boost__beast__get_lowest_layer `get_lowest_layer`].
  929. [heading Usage]
  930. To use this stream declare an instance of the class. Then, before each logical operation for which a timeout is desired, call [link beast.ref.boost__beast__basic_stream.expires_after `basic_stream::expires_after`] with a duration, or call [link beast.ref.boost__beast__basic_stream.expires_at `basic_stream::expires_at`] with a time point. Alternatively, call [link beast.ref.boost__beast__basic_stream.expires_never `basic_stream::expires_never`] to disable the timeout for subsequent logical operations. A logical operation is any series of one or more direct or indirect calls to the timeout stream's asynchronous read, asynchronous write, or asynchronous connect functions.
  931. When a timeout is set and a mixed operation is performed (one that includes both reads and writes, for example) the timeout applies to all of the intermediate asynchronous operations used in the enclosing operation. This allows timeouts to be applied to stream algorithms which were not written specifically to allow for timeouts, when those algorithms are passed a timeout stream with a timeout set.
  932. When a timeout occurs the socket will be closed, canceling any pending I/O operations. The completion handlers for these canceled operations will be invoked with the error [link beast.ref.boost__beast__error `timeout`].
  933. [heading Examples]
  934. This function reads an HTTP request with a timeout, then sends the HTTP response with a different timeout.
  935. ``` void process_http_1 (tcp_stream& stream, net::yield_context yield)
  936. {
  937. flat_buffer buffer;
  938. http::request<http::empty_body> req;
  939. // Read the request, with a 15 second timeout
  940. stream.expires_after(std::chrono::seconds(15));
  941. http::async_read(stream, buffer, req, yield);
  942. // Calculate the response
  943. http::response<http::string_body> res = make_response(req);
  944. // Send the response, with a 30 second timeout.
  945. stream.expires_after (std::chrono::seconds(30));
  946. http::async_write (stream, res, yield);
  947. }
  948. ```
  949. The example above could be expressed using a single timeout with a simple modification. The function that follows first reads an HTTP request then sends the HTTP response, with a single timeout that applies to the entire combined operation of reading and writing:
  950. ``` void process_http_2 (tcp_stream& stream, net::yield_context yield)
  951. {
  952. flat_buffer buffer;
  953. http::request<http::empty_body> req;
  954. // Require that the read and write combined take no longer than 30 seconds
  955. stream.expires_after(std::chrono::seconds(30));
  956. http::async_read(stream, buffer, req, yield);
  957. http::response<http::string_body> res = make_response(req);
  958. http::async_write (stream, res, yield);
  959. }
  960. ```
  961. Some stream algorithms, such as `ssl::stream::async_handshake` perform both reads and writes. A timeout set before calling the initiating function of such composite stream algorithms will apply to the entire composite operation. For example, a timeout may be set on performing the SSL handshake thusly:
  962. ``` void do_ssl_handshake (net::ssl::stream<tcp_stream>& stream, net::yield_context yield)
  963. {
  964. // Require that the SSL handshake take no longer than 10 seconds
  965. stream.expires_after(std::chrono::seconds(10));
  966. stream.async_handshake(net::ssl::stream_base::client, yield);
  967. }
  968. ```
  969. [heading Blocking I/O]
  970. Synchronous functions behave identically as that of the wrapped `net::basic_stream_socket`. Timeouts are not available when performing blocking calls.
  971. [heading Template Parameters] [table [[Type][Description]] [[`Protocol`][
  972. A type meeting the requirements of ['Protocol] representing the protocol the protocol to use for the basic stream socket. A common choice is `net::ip::tcp`. ]] [[`Executor`][
  973. A type meeting the requirements of ['Executor] to be used for submitting all completion handlers which do not already have an associated executor. If this type is omitted, the default of `net::executor` will be used. ]] ]
  974. [heading Thread Safety]
  975. ['Distinct objects]: Safe. ['Shared objects]: Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
  976. [heading See Also]
  977. * [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1322r0.html [P1322R0] Networking TS enhancement to enable custom I/O executors].
  978. [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__basic_stream__timeout_handler basic_stream::timeout_handler] [heading Synopsis] Defined in header [include_file boost/beast/core/basic_stream.hpp] ``` template< class __Executor2__> struct timeout_handler ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__basic_string_view basic_string_view] [indexterm1 basic_string_view]
  979. The type of `basic_string_view` used by the library. [heading Synopsis] Defined in header [include_file boost/beast/core/string_type.hpp] ``` template< class CharT, class Traits> using basic_string_view = boost::basic_string_view< CharT, Traits >; ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__beast_close_socket beast_close_socket] [indexterm1 beast_close_socket]
  980. Default socket close function. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class __Protocol__, class __Executor__> void beast_close_socket( net::basic_socket< Protocol, Executor >& sock); ``` [heading Description]
  981. This function is not meant to be called directly. Instead, it is called automatically when using [link beast.ref.boost__beast__close_socket `close_socket`]. To enable closure of user-defined types or classes derived from a particular user-defined type, this function should be overloaded in the corresponding namespace for the type in question.
  982. [heading See Also]
  983. [link beast.ref.boost__beast__close_socket `close_socket`]
  984. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__bind_front_handler bind_front_handler] [indexterm1 bind_front_handler]
  985. Bind parameters to a completion handler, creating a new handler. [heading Synopsis] Defined in header [include_file boost/beast/core/bind_handler.hpp] ``` template< class __Handler__, class... Args> ``['implementation-defined]`` bind_front_handler( Handler&& handler, Args&&... args); ``` [heading Description]
  986. This function creates a new handler which, when invoked, calls the original handler with the list of bound arguments. Any parameters passed in the invocation will be forwarded in the parameter list after the bound arguments.
  987. The passed handler and arguments are forwarded into the returned handler, whose associated allocator and associated executor will will be the same as those of the original handler.
  988. [heading Example]
  989. This function posts the invocation of the specified completion handler with bound arguments:
  990. ``` template <class AsyncReadStream, class ReadHandler>
  991. void
  992. signal_eof (AsyncReadStream& stream, ReadHandler&& handler)
  993. {
  994. net::post(
  995. stream.get_executor(),
  996. bind_front_handler (std::forward<ReadHandler> (handler),
  997. net::error::eof, 0));
  998. }
  999. ```
  1000. [heading Parameters] [table [[Name][Description]] [[`handler`][
  1001. The handler to wrap. The implementation takes ownership of the handler by performing a decay-copy. ]] [[`args`][
  1002. A list of arguments to bind to the handler. The arguments are forwarded into the returned object. ]] ]
  1003. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__bind_handler bind_handler] [indexterm1 bind_handler]
  1004. Bind parameters to a completion handler, creating a new handler. [heading Synopsis] Defined in header [include_file boost/beast/core/bind_handler.hpp] ``` template< class __Handler__, class... Args> ``['implementation-defined]`` bind_handler( Handler&& handler, Args&&... args); ``` [heading Description]
  1005. This function creates a new handler which, when invoked, calls the original handler with the list of bound arguments. Any parameters passed in the invocation will be substituted for placeholders present in the list of bound arguments. Parameters which are not matched to placeholders are silently discarded.
  1006. The passed handler and arguments are forwarded into the returned handler, whose associated allocator and associated executor will will be the same as those of the original handler.
  1007. [heading Example]
  1008. This function posts the invocation of the specified completion handler with bound arguments:
  1009. ``` template <class AsyncReadStream, class ReadHandler>
  1010. void
  1011. signal_aborted (AsyncReadStream& stream, ReadHandler&& handler)
  1012. {
  1013. net::post(
  1014. stream.get_executor(),
  1015. bind_handler (std::forward <ReadHandler> (handler),
  1016. net::error::operation_aborted, 0));
  1017. }
  1018. ```
  1019. [heading Parameters] [table [[Name][Description]] [[`handler`][
  1020. The handler to wrap. The implementation takes ownership of the handler by performing a decay-copy. ]] [[`args`][
  1021. A list of arguments to bind to the handler. The arguments are forwarded into the returned object. These arguments may include placeholders, which will operate in a fashion identical to a call to `std::bind`. ]] ]
  1022. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffer_bytes buffer_bytes] [indexterm1 buffer_bytes]
  1023. Return the total number of bytes in a buffer or buffer sequence. [heading Synopsis] Defined in header [include_file boost/beast/core/buffer_traits.hpp] ``` template< class __BufferSequence__> std::size_t buffer_bytes( BufferSequence const& buffers); ``` [heading Description]
  1024. This function returns the total number of bytes in a buffer, buffer sequence, or object convertible to a buffer. Specifically it may be passed:
  1025. * A ['ConstBufferSequence] or ['MutableBufferSequence]
  1026. * A `net::const_buffer` or `net::mutable_buffer`
  1027. * An object convertible to `net::const_buffer`
  1028. This function is designed as an easier-to-use replacement for `net::buffer_size`. It recognizes customization points found through argument-dependent lookup. The call `beast::buffer_bytes(b)` is equivalent to performing: ``` using namespace net;
  1029. buffer_bytes(b);
  1030. ``` In addition this handles types which are convertible to `net::const_buffer`; these are not handled by `net::buffer_size`.
  1031. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1032. The buffer or buffer sequence to calculate the size of. ]] ]
  1033. [heading Return Value]
  1034. The total number of bytes in the buffer or sequence.
  1035. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffered_read_stream buffered_read_stream]
  1036. A ['Stream] with attached ['DynamicBuffer] to buffer reads. [heading Synopsis] Defined in header [include_file boost/beast/core/buffered_read_stream.hpp] ``` template< class __Stream__, class __DynamicBuffer__> class buffered_read_stream ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__buffered_read_stream.buffer_type [*buffer_type]]] [ The type of the internal buffer. ] ] [ [[link beast.ref.boost__beast__buffered_read_stream.executor_type [*executor_type]]] [ ] ] [ [[link beast.ref.boost__beast__buffered_read_stream.next_layer_type [*next_layer_type]]] [ The type of the next layer. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__buffered_read_stream.async_read_some [*async_read_some]]] [ Start an asynchronous read. ] ] [ [[link beast.ref.boost__beast__buffered_read_stream.async_write_some [*async_write_some]]] [ Start an asynchronous write. ] ] [ [[link beast.ref.boost__beast__buffered_read_stream.buffer [*buffer]]] [ Access the internal buffer. ] ] [ [[link beast.ref.boost__beast__buffered_read_stream.buffered_read_stream [*buffered_read_stream]]] [ Move constructor. Construct the wrapping stream. ] ] [ [[link beast.ref.boost__beast__buffered_read_stream.capacity [*capacity]]] [ Set the maximum buffer size. ] ] [ [[link beast.ref.boost__beast__buffered_read_stream.get_executor [*get_executor]]] [ Get the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__buffered_read_stream.next_layer [*next_layer]]] [ Get a reference to the next layer. Get a const reference to the next layer. ] ] [ [[link beast.ref.boost__beast__buffered_read_stream.operator_eq_ [*operator=]]] [ Move assignment. ] ] [ [[link beast.ref.boost__beast__buffered_read_stream.read_some [*read_some]]] [ Read some data from the stream. ] ] [ [[link beast.ref.boost__beast__buffered_read_stream.write_some [*write_some]]] [ Write some data to the stream. ] ] ] [heading Description]
  1037. This wraps a ['Stream] implementation so that calls to write are passed through to the underlying stream, while calls to read will first consume the input sequence stored in a ['DynamicBuffer] which is part of the object.
  1038. The use-case for this class is different than that of the `net::buffered_read_stream`. It is designed to facilitate the use of `net::read_until`, and to allow buffers acquired during detection of handshakes to be made transparently available to callers. A hypothetical implementation of the buffered version of `net::ssl::stream::async_handshake` could make use of this wrapper.
  1039. Uses:
  1040. * Transparently leave untouched input acquired in calls to `net::read_until` behind for subsequent callers.
  1041. * "Preload" a stream with handshake input data acquired from other sources.
  1042. Example: ``` // Process the next HTTP header on the stream,
  1043. // leaving excess bytes behind for the next call.
  1044. //
  1045. template<class Stream, class DynamicBuffer>
  1046. void process_http_message(
  1047. buffered_read_stream<Stream, DynamicBuffer>& stream)
  1048. {
  1049. // Read up to and including the end of the HTTP
  1050. // header, leaving the sequence in the stream's
  1051. // buffer. read_until may read past the end of the
  1052. // headers; the return value will include only the
  1053. // part up to the end of the delimiter.
  1054. //
  1055. std::size_t bytes_transferred =
  1056. net::read_until(
  1057. stream.next_layer(), stream.buffer(), "\r\n\r\n");
  1058. // Use buffers_prefix() to limit the input
  1059. // sequence to only the data up to and including
  1060. // the trailing "\r\n\r\n".
  1061. //
  1062. auto header_buffers = buffers_prefix(
  1063. bytes_transferred, stream.buffer().data());
  1064. ...
  1065. // Discard the portion of the input corresponding
  1066. // to the HTTP headers.
  1067. //
  1068. stream.buffer().consume(bytes_transferred);
  1069. // Everything we read from the stream
  1070. // is part of the content-body.
  1071. }
  1072. ```
  1073. [heading Template Parameters] [table [[Type][Description]] [[`Stream`][
  1074. The type of stream to wrap. ]] [[`DynamicBuffer`][
  1075. The type of stream buffer to use. ]] ]
  1076. [section:async_read_some buffered_read_stream::async_read_some] [indexterm2 async_read_some..buffered_read_stream]
  1077. Start an asynchronous read. [heading Synopsis] ``` template< class __MutableBufferSequence__, class __ReadHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_read_some( MutableBufferSequence const& buffers, ReadHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  1078. This function is used to asynchronously read data from the stream. The function call always returns immediately.
  1079. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1080. One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  1081. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  1082. error_code const& error, // result of operation
  1083. std::size_t bytes_transferred // number of bytes transferred
  1084. );
  1085. ``` ]] ]
  1086. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. [endsect] [section:async_write_some buffered_read_stream::async_write_some] [indexterm2 async_write_some..buffered_read_stream]
  1087. Start an asynchronous write. [heading Synopsis] ``` template< class __ConstBufferSequence__, class __WriteHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_write_some( ConstBufferSequence const& buffers, WriteHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  1088. This function is used to asynchronously write data from the stream. The function call always returns immediately.
  1089. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1090. One or more data buffers to be written to the stream. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  1091. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  1092. error_code const& error, // result of operation
  1093. std::size_t bytes_transferred // number of bytes transferred
  1094. );
  1095. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  1096. [endsect] [section:buffer buffered_read_stream::buffer] [indexterm2 buffer..buffered_read_stream]
  1097. Access the internal buffer. ``` DynamicBuffer& ``[link beast.ref.boost__beast__buffered_read_stream.buffer.overload1 buffer]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__buffered_read_stream.buffer.overload1 more...]]`` DynamicBuffer const & ``[link beast.ref.boost__beast__buffered_read_stream.buffer.overload2 buffer]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__buffered_read_stream.buffer.overload2 more...]]`` ``` [section:overload1 buffered_read_stream::buffer (1 of 2 overloads)]
  1098. Access the internal buffer. [heading Synopsis] ``` DynamicBuffer& buffer(); ``` [heading Description]
  1099. The internal buffer is returned. It is possible for the caller to break invariants with this function. For example, by causing the internal buffer size to increase beyond the caller defined maximum. [endsect] [section:overload2 buffered_read_stream::buffer (2 of 2 overloads)]
  1100. Access the internal buffer. [heading Synopsis] ``` DynamicBuffer const & buffer() const; ``` [heading Description] [endsect] [endsect] [section:buffer_type buffered_read_stream::buffer_type] [indexterm2 buffer_type..buffered_read_stream]
  1101. The type of the internal buffer. [heading Synopsis] ``` using buffer_type = DynamicBuffer; ``` [heading Description] [endsect] [section:buffered_read_stream buffered_read_stream::buffered_read_stream] [indexterm2 buffered_read_stream..buffered_read_stream]
  1102. Move constructor. ``` ``[link beast.ref.boost__beast__buffered_read_stream.buffered_read_stream.overload1 buffered_read_stream]``( buffered_read_stream&&); ``[''''&raquo;''' [link beast.ref.boost__beast__buffered_read_stream.buffered_read_stream.overload1 more...]]`` ```
  1103. Construct the wrapping stream. ``` template< class... Args> explicit ``[link beast.ref.boost__beast__buffered_read_stream.buffered_read_stream.overload2 buffered_read_stream]``( Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__buffered_read_stream.buffered_read_stream.overload2 more...]]`` ``` [section:overload1 buffered_read_stream::buffered_read_stream (1 of 2 overloads)]
  1104. Move constructor. [heading Synopsis] ``` buffered_read_stream( buffered_read_stream&&); ``` [heading Description]
  1105. [heading Remarks]
  1106. The behavior of move assignment on or from streams with active or pending operations is undefined.
  1107. [endsect] [section:overload2 buffered_read_stream::buffered_read_stream (2 of 2 overloads)]
  1108. Construct the wrapping stream. [heading Synopsis] ``` template< class... Args> buffered_read_stream( Args&&... args); ``` [heading Description]
  1109. [heading Parameters] [table [[Name][Description]] [[`args`][
  1110. Parameters forwarded to the `Stream` constructor. ]] ]
  1111. [endsect] [endsect] [section:capacity buffered_read_stream::capacity] [indexterm2 capacity..buffered_read_stream]
  1112. Set the maximum buffer size. [heading Synopsis] ``` void capacity( std::size_t size); ``` [heading Description]
  1113. This changes the maximum size of the internal buffer used to hold read data. No bytes are discarded by this call. If the buffer size is set to zero, no more data will be buffered.
  1114. Thread safety: The caller is responsible for making sure the call is made from the same implicit or explicit strand.
  1115. [heading Parameters] [table [[Name][Description]] [[`size`][
  1116. The number of bytes in the read buffer. ]] ]
  1117. [heading Remarks]
  1118. This is a soft limit. If the new maximum size is smaller than the amount of data in the buffer, no bytes are discarded.
  1119. [endsect] [section:executor_type buffered_read_stream::executor_type] [indexterm2 executor_type..buffered_read_stream] [heading Synopsis] ``` using executor_type = beast::executor_type< next_layer_type >; ``` [heading Description] [endsect] [section:get_executor buffered_read_stream::get_executor] [indexterm2 get_executor..buffered_read_stream]
  1120. Get the executor associated with the object. [heading Synopsis] ``` executor_type get_executor(); ``` [heading Description]
  1121. This function may be used to obtain the executor object that the stream uses to dispatch handlers for asynchronous operations.
  1122. [heading Return Value]
  1123. A copy of the executor that stream will use to dispatch handlers.
  1124. [endsect] [section:next_layer buffered_read_stream::next_layer] [indexterm2 next_layer..buffered_read_stream]
  1125. Get a reference to the next layer. ``` next_layer_type& ``[link beast.ref.boost__beast__buffered_read_stream.next_layer.overload1 next_layer]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__buffered_read_stream.next_layer.overload1 more...]]`` ```
  1126. Get a const reference to the next layer. ``` next_layer_type const & ``[link beast.ref.boost__beast__buffered_read_stream.next_layer.overload2 next_layer]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__buffered_read_stream.next_layer.overload2 more...]]`` ``` [section:overload1 buffered_read_stream::next_layer (1 of 2 overloads)]
  1127. Get a reference to the next layer. [heading Synopsis] ``` next_layer_type& next_layer(); ``` [heading Description] [endsect] [section:overload2 buffered_read_stream::next_layer (2 of 2 overloads)]
  1128. Get a const reference to the next layer. [heading Synopsis] ``` next_layer_type const & next_layer() const; ``` [heading Description] [endsect] [endsect] [section:next_layer_type buffered_read_stream::next_layer_type] [indexterm2 next_layer_type..buffered_read_stream]
  1129. The type of the next layer. [heading Synopsis] ``` using next_layer_type = typename std::remove_reference< Stream >::type; ``` [heading Description] [endsect] [section:operator_eq_ buffered_read_stream::operator=] [indexterm2 operator=..buffered_read_stream]
  1130. Move assignment. [heading Synopsis] ``` buffered_read_stream& operator=( buffered_read_stream&&); ``` [heading Description]
  1131. [heading Remarks]
  1132. The behavior of move assignment on or from streams with active or pending operations is undefined.
  1133. [endsect] [section:read_some buffered_read_stream::read_some] [indexterm2 read_some..buffered_read_stream]
  1134. Read some data from the stream. ``` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__buffered_read_stream.read_some.overload1 read_some]``( MutableBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__buffered_read_stream.read_some.overload1 more...]]`` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__buffered_read_stream.read_some.overload2 read_some]``( MutableBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__buffered_read_stream.read_some.overload2 more...]]`` ``` [section:overload1 buffered_read_stream::read_some (1 of 2 overloads)]
  1135. Read some data from the stream. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers); ``` [heading Description]
  1136. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  1137. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1138. One or more buffers into which the data will be read. ]] ]
  1139. [heading Return Value]
  1140. The number of bytes read.
  1141. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  1142. Thrown on failure. ]] ]
  1143. [endsect] [section:overload2 buffered_read_stream::read_some (2 of 2 overloads)]
  1144. Read some data from the stream. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  1145. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  1146. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1147. One or more buffers into which the data will be read. ]] [[`ec`][
  1148. Set to the error, if any occurred. ]] ]
  1149. [heading Return Value]
  1150. The number of bytes read, or 0 on error.
  1151. [endsect] [endsect] [section:write_some buffered_read_stream::write_some] [indexterm2 write_some..buffered_read_stream]
  1152. Write some data to the stream. ``` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__buffered_read_stream.write_some.overload1 write_some]``( ConstBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__buffered_read_stream.write_some.overload1 more...]]`` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__buffered_read_stream.write_some.overload2 write_some]``( ConstBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__buffered_read_stream.write_some.overload2 more...]]`` ``` [section:overload1 buffered_read_stream::write_some (1 of 2 overloads)]
  1153. Write some data to the stream. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers); ``` [heading Description]
  1154. This function is used to write data to the stream. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  1155. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1156. One or more data buffers to be written to the stream. ]] ]
  1157. [heading Return Value]
  1158. The number of bytes written.
  1159. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  1160. Thrown on failure. ]] ]
  1161. [endsect] [section:overload2 buffered_read_stream::write_some (2 of 2 overloads)]
  1162. Write some data to the stream. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  1163. This function is used to write data to the stream. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  1164. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1165. One or more data buffers to be written to the stream. ]] [[`ec`][
  1166. Set to the error, if any occurred. ]] ]
  1167. [heading Return Value]
  1168. The number of bytes written.
  1169. [endsect] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers buffers] [indexterm1 buffers] [heading Synopsis] Defined in header [include_file boost/beast/core/ostream.hpp] ``` template< class T> void buffers( T const&); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_adaptor buffers_adaptor]
  1170. Adapts a ['MutableBufferSequence] into a ['DynamicBuffer]. [heading Synopsis] Defined in header [include_file boost/beast/core/buffers_adaptor.hpp] ``` template< class __MutableBufferSequence__> class buffers_adaptor ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__buffers_adaptor.const_buffers_type [*const_buffers_type]]] [ The ConstBufferSequence used to represent the readable bytes. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.mutable_buffers_type [*mutable_buffers_type]]] [ The MutableBufferSequence used to represent the writable bytes. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.mutable_data_type [*mutable_data_type]]] [ The MutableBufferSequence used to represent the readable bytes. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.value_type [*value_type]]] [ The type of the underlying mutable buffer sequence. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__buffers_adaptor.buffers_adaptor [*buffers_adaptor]]] [ Construct a buffers adaptor. Constructor. Copy Constructor. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.capacity [*capacity]]] [ Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.cdata [*cdata]]] [ Returns a constant buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.commit [*commit]]] [ Append writable bytes to the readable bytes. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.consume [*consume]]] [ Remove bytes from beginning of the readable bytes. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.data [*data]]] [ Returns a constant buffer sequence representing the readable bytes. Returns a mutable buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.max_size [*max_size]]] [ Return the maximum number of bytes, both readable and writable, that can ever be held. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.operator_eq_ [*operator=]]] [ Copy Assignment. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.prepare [*prepare]]] [ Returns a mutable buffer sequence representing writable bytes. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.size [*size]]] [ Returns the number of readable bytes. ] ] [ [[link beast.ref.boost__beast__buffers_adaptor.value [*value]]] [ Returns the original mutable buffer sequence. ] ] ] [heading Description]
  1171. This class wraps a ['MutableBufferSequence] to meet the requirements of ['DynamicBuffer]. Upon construction the input and output sequences are empty. A copy of the mutable buffer sequence object is stored; however, ownership of the underlying memory is not transferred. The caller is responsible for making sure that referenced memory remains valid for the duration of any operations.
  1172. The size of the mutable buffer sequence determines the maximum number of bytes which may be prepared and committed.
  1173. [heading Template Parameters] [table [[Type][Description]] [[`MutableBufferSequence`][
  1174. The type of mutable buffer sequence to adapt. ]] ]
  1175. [section:buffers_adaptor buffers_adaptor::buffers_adaptor] [indexterm2 buffers_adaptor..buffers_adaptor]
  1176. Construct a buffers adaptor. ``` explicit ``[link beast.ref.boost__beast__buffers_adaptor.buffers_adaptor.overload1 buffers_adaptor]``( MutableBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_adaptor.buffers_adaptor.overload1 more...]]`` ```
  1177. Constructor. ``` template< class... Args> explicit ``[link beast.ref.boost__beast__buffers_adaptor.buffers_adaptor.overload2 buffers_adaptor]``( boost::in_place_init_t, Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_adaptor.buffers_adaptor.overload2 more...]]`` ```
  1178. Copy Constructor. ``` ``[link beast.ref.boost__beast__buffers_adaptor.buffers_adaptor.overload3 buffers_adaptor]``( buffers_adaptor const& other); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_adaptor.buffers_adaptor.overload3 more...]]`` ``` [section:overload1 buffers_adaptor::buffers_adaptor (1 of 3 overloads)]
  1179. Construct a buffers adaptor. [heading Synopsis] ``` buffers_adaptor( MutableBufferSequence const& buffers); ``` [heading Description]
  1180. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1181. The mutable buffer sequence to wrap. A copy of the object will be made, but ownership of the memory is not transferred. ]] ]
  1182. [endsect] [section:overload2 buffers_adaptor::buffers_adaptor (2 of 3 overloads)]
  1183. Constructor. [heading Synopsis] ``` template< class... Args> buffers_adaptor( boost::in_place_init_t, Args&&... args); ``` [heading Description]
  1184. This constructs the buffer adaptor in-place from a list of arguments.
  1185. [heading Parameters] [table [[Name][Description]] [[`args`][
  1186. Arguments forwarded to the buffers constructor. ]] ]
  1187. [endsect] [section:overload3 buffers_adaptor::buffers_adaptor (3 of 3 overloads)]
  1188. Copy Constructor. [heading Synopsis] ``` buffers_adaptor( buffers_adaptor const& other); ``` [heading Description] [endsect] [endsect] [section:capacity buffers_adaptor::capacity] [indexterm2 capacity..buffers_adaptor]
  1189. Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. [heading Synopsis] ``` std::size_t capacity() const; ``` [heading Description] [endsect] [section:cdata buffers_adaptor::cdata] [indexterm2 cdata..buffers_adaptor]
  1190. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type cdata() const; ``` [heading Description] [endsect] [section:commit buffers_adaptor::commit] [indexterm2 commit..buffers_adaptor]
  1191. Append writable bytes to the readable bytes. [heading Synopsis] ``` void commit( std::size_t n); ``` [heading Description]
  1192. Appends n bytes from the start of the writable bytes to the end of the readable bytes. The remainder of the writable bytes are discarded. If n is greater than the number of writable bytes, all writable bytes are appended to the readable bytes.
  1193. All buffer sequences previously obtained using [link beast.ref.boost__beast__buffers_adaptor.prepare `buffers_adaptor::prepare`] are invalidated. Buffer sequences previously obtained using [link beast.ref.boost__beast__buffers_adaptor.data `buffers_adaptor::data`] remain valid.
  1194. [heading Parameters] [table [[Name][Description]] [[`n`][
  1195. The number of bytes to append. If this number is greater than the number of writable bytes, all writable bytes are appended. ]] ]
  1196. [heading Exception Safety]
  1197. No-throw guarantee. [endsect] [section:const_buffers_type buffers_adaptor::const_buffers_type] [indexterm2 const_buffers_type..buffers_adaptor]
  1198. The ConstBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using const_buffers_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:consume buffers_adaptor::consume] [indexterm2 consume..buffers_adaptor]
  1199. Remove bytes from beginning of the readable bytes. [heading Synopsis] ``` void consume( std::size_t n); ``` [heading Description]
  1200. Removes n bytes from the beginning of the readable bytes.
  1201. All buffers sequences previously obtained using [link beast.ref.boost__beast__buffers_adaptor.data `buffers_adaptor::data`] or [link beast.ref.boost__beast__buffers_adaptor.prepare `buffers_adaptor::prepare`] are invalidated.
  1202. [heading Parameters] [table [[Name][Description]] [[`n`][
  1203. The number of bytes to remove. If this number is greater than the number of readable bytes, all readable bytes are removed. ]] ]
  1204. [heading Exception Safety]
  1205. No-throw guarantee. [endsect] [section:data buffers_adaptor::data] [indexterm2 data..buffers_adaptor]
  1206. Returns a constant buffer sequence representing the readable bytes. ``` const_buffers_type ``[link beast.ref.boost__beast__buffers_adaptor.data.overload1 data]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_adaptor.data.overload1 more...]]`` ```
  1207. Returns a mutable buffer sequence representing the readable bytes. ``` mutable_data_type ``[link beast.ref.boost__beast__buffers_adaptor.data.overload2 data]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_adaptor.data.overload2 more...]]`` ``` [section:overload1 buffers_adaptor::data (1 of 2 overloads)]
  1208. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type data() const; ``` [heading Description] [endsect] [section:overload2 buffers_adaptor::data (2 of 2 overloads)]
  1209. Returns a mutable buffer sequence representing the readable bytes. [heading Synopsis] ``` mutable_data_type data(); ``` [heading Description] [endsect] [endsect] [section:max_size buffers_adaptor::max_size] [indexterm2 max_size..buffers_adaptor]
  1210. Return the maximum number of bytes, both readable and writable, that can ever be held. [heading Synopsis] ``` std::size_t max_size() const; ``` [heading Description] [endsect] [section:mutable_buffers_type buffers_adaptor::mutable_buffers_type] [indexterm2 mutable_buffers_type..buffers_adaptor]
  1211. The MutableBufferSequence used to represent the writable bytes. [heading Synopsis] ``` using mutable_buffers_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:mutable_data_type buffers_adaptor::mutable_data_type] [indexterm2 mutable_data_type..buffers_adaptor]
  1212. The MutableBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using mutable_data_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:operator_eq_ buffers_adaptor::operator=] [indexterm2 operator=..buffers_adaptor]
  1213. Copy Assignment. [heading Synopsis] ``` buffers_adaptor& operator=( buffers_adaptor const&); ``` [heading Description] [endsect] [section:prepare buffers_adaptor::prepare] [indexterm2 prepare..buffers_adaptor]
  1214. Returns a mutable buffer sequence representing writable bytes. [heading Synopsis] ``` mutable_buffers_type prepare( std::size_t n); ``` [heading Description]
  1215. Returns a mutable buffer sequence representing the writable bytes containing exactly `n` bytes of storage. This function does not allocate memory. Instead, the storage comes from the underlying mutable buffer sequence.
  1216. All buffer sequences previously obtained using [link beast.ref.boost__beast__buffers_adaptor.prepare `buffers_adaptor::prepare`] are invalidated. Buffer sequences previously obtained using [link beast.ref.boost__beast__buffers_adaptor.data `buffers_adaptor::data`] remain valid.
  1217. [heading Parameters] [table [[Name][Description]] [[`n`][
  1218. The desired number of bytes in the returned buffer sequence. ]] ]
  1219. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  1220. if `size() + n` exceeds `max_size()`. ]] ]
  1221. [heading Exception Safety]
  1222. Strong guarantee. [endsect] [section:size buffers_adaptor::size] [indexterm2 size..buffers_adaptor]
  1223. Returns the number of readable bytes. [heading Synopsis] ``` std::size_t size() const; ``` [heading Description] [endsect] [section:value buffers_adaptor::value] [indexterm2 value..buffers_adaptor]
  1224. Returns the original mutable buffer sequence. [heading Synopsis] ``` value_type const & value() const; ``` [heading Description] [endsect] [section:value_type buffers_adaptor::value_type] [indexterm2 value_type..buffers_adaptor]
  1225. The type of the underlying mutable buffer sequence. [heading Synopsis] ``` using value_type = MutableBufferSequence; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_adaptor__readable_bytes buffers_adaptor::readable_bytes] [heading Synopsis] Defined in header [include_file boost/beast/core/buffers_adaptor.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2]> class readable_bytes ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_cat buffers_cat] [indexterm1 buffers_cat]
  1226. Concatenate 1 or more buffer sequences. [heading Synopsis] Defined in header [include_file boost/beast/core/buffers_cat.hpp] ``` template< class... __BufferSequence__> buffers_cat_view< BufferSequence... > buffers_cat( BufferSequence const&... buffers); ``` [heading Description]
  1227. This function returns a constant or mutable buffer sequence which, when iterated, efficiently concatenates the input buffer sequences. Copies of the arguments passed will be made; however, the returned object does not take ownership of the underlying memory. The application is still responsible for managing the lifetime of the referenced memory. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1228. The list of buffer sequences to concatenate. ]] ]
  1229. [heading Return Value]
  1230. A new buffer sequence that represents the concatenation of the input buffer sequences. This buffer sequence will be a ['MutableBufferSequence] if each of the passed buffer sequences is also a ['MutableBufferSequence]; otherwise the returned buffer sequence will be a ['ConstBufferSequence].
  1231. [heading See Also]
  1232. [link beast.ref.boost__beast__buffers_cat_view `buffers_cat_view`]
  1233. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_cat_view buffers_cat_view]
  1234. A buffer sequence representing a concatenation of buffer sequences. [heading Synopsis] Defined in header [include_file boost/beast/core/buffers_cat.hpp] ``` template< class... Buffers> class buffers_cat_view ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__buffers_cat_view.value_type [*value_type]]] [ The type of buffer returned when dereferencing an iterator. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__buffers_cat_view.begin [*begin]]] [ Returns an iterator to the first buffer in the sequence. ] ] [ [[link beast.ref.boost__beast__buffers_cat_view.buffers_cat_view [*buffers_cat_view]]] [ Copy Constructor. Constructor. ] ] [ [[link beast.ref.boost__beast__buffers_cat_view.end [*end]]] [ Returns an iterator to one past the last buffer in the sequence. ] ] [ [[link beast.ref.boost__beast__buffers_cat_view.operator_eq_ [*operator=]]] [ Copy Assignment. ] ] ] [heading Description]
  1235. [heading See Also]
  1236. [link beast.ref.boost__beast__buffers_cat `buffers_cat`]
  1237. [section:begin buffers_cat_view::begin] [indexterm2 begin..buffers_cat_view]
  1238. Returns an iterator to the first buffer in the sequence. [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:buffers_cat_view buffers_cat_view::buffers_cat_view] [indexterm2 buffers_cat_view..buffers_cat_view]
  1239. Copy Constructor. ``` ``[link beast.ref.boost__beast__buffers_cat_view.buffers_cat_view.overload1 buffers_cat_view]``( buffers_cat_view const&); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_cat_view.buffers_cat_view.overload1 more...]]`` ```
  1240. Constructor. ``` explicit ``[link beast.ref.boost__beast__buffers_cat_view.buffers_cat_view.overload2 buffers_cat_view]``( Buffers const&... buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_cat_view.buffers_cat_view.overload2 more...]]`` ``` [section:overload1 buffers_cat_view::buffers_cat_view (1 of 2 overloads)]
  1241. Copy Constructor. [heading Synopsis] ``` buffers_cat_view( buffers_cat_view const&); ``` [heading Description] [endsect] [section:overload2 buffers_cat_view::buffers_cat_view (2 of 2 overloads)]
  1242. Constructor. [heading Synopsis] ``` buffers_cat_view( Buffers const&... buffers); ``` [heading Description]
  1243. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1244. The list of buffer sequences to concatenate. Copies of the arguments will be maintained for the lifetime of the concatenated sequence; however, the ownership of the memory buffers themselves is not transferred. ]] ]
  1245. [endsect] [endsect] [section:end buffers_cat_view::end] [indexterm2 end..buffers_cat_view]
  1246. Returns an iterator to one past the last buffer in the sequence. [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:operator_eq_ buffers_cat_view::operator=] [indexterm2 operator=..buffers_cat_view]
  1247. Copy Assignment. [heading Synopsis] ``` buffers_cat_view& operator=( buffers_cat_view const&); ``` [heading Description] [endsect] [section:value_type buffers_cat_view::value_type] [indexterm2 value_type..buffers_cat_view]
  1248. The type of buffer returned when dereferencing an iterator. [heading Synopsis] ``` using value_type = ``['see-below]``; ``` [heading Description]
  1249. If every buffer sequence in the view is a ['MutableBufferSequence], then `value_type` will be `net::mutable_buffer`. Otherwise, `value_type` will be `net::const_buffer`. [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_front buffers_front] [indexterm1 buffers_front]
  1250. Returns the first buffer in a buffer sequence. [heading Synopsis] Defined in header [include_file boost/beast/core/buffers_prefix.hpp] ``` template< class __BufferSequence__> buffers_type< BufferSequence > buffers_front( BufferSequence const& buffers); ``` [heading Description]
  1251. This returns the first buffer in the buffer sequence. If the buffer sequence is an empty range, the returned buffer will have a zero buffer size.
  1252. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1253. The buffer sequence. If the sequence is mutable, the returned buffer sequence will also be mutable. Otherwise, the returned buffer sequence will be constant. ]] ]
  1254. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_iterator_type buffers_iterator_type] [indexterm1 buffers_iterator_type]
  1255. Type alias for the iterator type of a buffer sequence type. [heading Synopsis] Defined in header [include_file boost/beast/core/buffer_traits.hpp] ``` template< class __BufferSequence__> using buffers_iterator_type = ``['see-below]``; ``` [heading Description]
  1256. This metafunction is used to determine the type of iterator used by a particular buffer sequence.
  1257. [heading Template Parameters] [table [[Type][Description]] [[`T`][
  1258. The buffer sequence type to use. The resulting type alias will be equal to the iterator type used by the buffer sequence. ]] ]
  1259. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_prefix buffers_prefix] [indexterm1 buffers_prefix]
  1260. Returns a prefix of a constant or mutable buffer sequence. [heading Synopsis] Defined in header [include_file boost/beast/core/buffers_prefix.hpp] ``` template< class __BufferSequence__> buffers_prefix_view< BufferSequence > buffers_prefix( std::size_t size, BufferSequence const& buffers); ``` [heading Description]
  1261. The returned buffer sequence points to the same memory as the passed buffer sequence, but with a size that is equal to or smaller. No memory allocations are performed; the resulting sequence is calculated as a lazy range.
  1262. [heading Parameters] [table [[Name][Description]] [[`size`][
  1263. The maximum size of the returned buffer sequence in bytes. If this is greater than or equal to the size of the passed buffer sequence, the result will have the same size as the original buffer sequence. ]] [[`buffers`][
  1264. An object whose type meets the requirements of ['BufferSequence]. The returned value will maintain a copy of the passed buffers for its lifetime; however, ownership of the underlying memory is not transferred. ]] ]
  1265. [heading Return Value]
  1266. A constant buffer sequence that represents the prefix of the original buffer sequence. If the original buffer sequence also meets the requirements of ['MutableBufferSequence], then the returned value will also be a mutable buffer sequence.
  1267. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_prefix_view buffers_prefix_view]
  1268. A buffer sequence adaptor that shortens the sequence size. [heading Synopsis] Defined in header [include_file boost/beast/core/buffers_prefix.hpp] ``` template< class __BufferSequence__> class buffers_prefix_view ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__buffers_prefix_view.const_iterator [*const_iterator]]] [ A bidirectional iterator type that may be used to read elements. ] ] [ [[link beast.ref.boost__beast__buffers_prefix_view.value_type [*value_type]]] [ The type for each element in the list of buffers. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__buffers_prefix_view.begin [*begin]]] [ Returns an iterator to the first buffer in the sequence. ] ] [ [[link beast.ref.boost__beast__buffers_prefix_view.buffers_prefix_view [*buffers_prefix_view]]] [ Copy Constructor. Construct a buffer sequence prefix. Construct a buffer sequence prefix in-place. ] ] [ [[link beast.ref.boost__beast__buffers_prefix_view.end [*end]]] [ Returns an iterator to one past the last buffer in the sequence. ] ] [ [[link beast.ref.boost__beast__buffers_prefix_view.operator_eq_ [*operator=]]] [ Copy Assignment. ] ] ] [heading Description]
  1269. The class adapts a buffer sequence to efficiently represent a shorter subset of the original list of buffers starting with the first byte of the original sequence.
  1270. [heading Template Parameters] [table [[Type][Description]] [[`BufferSequence`][
  1271. The buffer sequence to adapt. ]] ]
  1272. [section:begin buffers_prefix_view::begin] [indexterm2 begin..buffers_prefix_view]
  1273. Returns an iterator to the first buffer in the sequence. [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:buffers_prefix_view buffers_prefix_view::buffers_prefix_view] [indexterm2 buffers_prefix_view..buffers_prefix_view]
  1274. Copy Constructor. ``` ``[link beast.ref.boost__beast__buffers_prefix_view.buffers_prefix_view.overload1 buffers_prefix_view]``( buffers_prefix_view const&); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_prefix_view.buffers_prefix_view.overload1 more...]]`` ```
  1275. Construct a buffer sequence prefix. ``` ``[link beast.ref.boost__beast__buffers_prefix_view.buffers_prefix_view.overload2 buffers_prefix_view]``( std::size_t size, BufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_prefix_view.buffers_prefix_view.overload2 more...]]`` ```
  1276. Construct a buffer sequence prefix in-place. ``` template< class... Args> ``[link beast.ref.boost__beast__buffers_prefix_view.buffers_prefix_view.overload3 buffers_prefix_view]``( std::size_t size, boost::in_place_init_t, Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_prefix_view.buffers_prefix_view.overload3 more...]]`` ``` [section:overload1 buffers_prefix_view::buffers_prefix_view (1 of 3 overloads)]
  1277. Copy Constructor. [heading Synopsis] ``` buffers_prefix_view( buffers_prefix_view const&); ``` [heading Description] [endsect] [section:overload2 buffers_prefix_view::buffers_prefix_view (2 of 3 overloads)]
  1278. Construct a buffer sequence prefix. [heading Synopsis] ``` buffers_prefix_view( std::size_t size, BufferSequence const& buffers); ``` [heading Description]
  1279. [heading Parameters] [table [[Name][Description]] [[`size`][
  1280. The maximum number of bytes in the prefix. If this is larger than the size of passed buffers, the resulting sequence will represent the entire input sequence. ]] [[`buffers`][
  1281. The buffer sequence to adapt. A copy of the sequence will be made, but ownership of the underlying memory is not transferred. The copy is maintained for the lifetime of the view. ]] ]
  1282. [endsect] [section:overload3 buffers_prefix_view::buffers_prefix_view (3 of 3 overloads)]
  1283. Construct a buffer sequence prefix in-place. [heading Synopsis] ``` template< class... Args> buffers_prefix_view( std::size_t size, boost::in_place_init_t, Args&&... args); ``` [heading Description]
  1284. [heading Parameters] [table [[Name][Description]] [[`size`][
  1285. The maximum number of bytes in the prefix. If this is larger than the size of passed buffers, the resulting sequence will represent the entire input sequence. ]] [[`args`][
  1286. Arguments forwarded to the contained buffer's constructor. ]] ]
  1287. [endsect] [endsect] [section:const_iterator buffers_prefix_view::const_iterator] [indexterm2 const_iterator..buffers_prefix_view]
  1288. A bidirectional iterator type that may be used to read elements. [heading Synopsis] ``` using const_iterator = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:end buffers_prefix_view::end] [indexterm2 end..buffers_prefix_view]
  1289. Returns an iterator to one past the last buffer in the sequence. [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:operator_eq_ buffers_prefix_view::operator=] [indexterm2 operator=..buffers_prefix_view]
  1290. Copy Assignment. [heading Synopsis] ``` buffers_prefix_view& operator=( buffers_prefix_view const&); ``` [heading Description] [endsect] [section:value_type buffers_prefix_view::value_type] [indexterm2 value_type..buffers_prefix_view]
  1291. The type for each element in the list of buffers. [heading Synopsis] ``` using value_type = ``['see-below]``; ``` [heading Description]
  1292. If the type `BufferSequence` meets the requirements of ['MutableBufferSequence], then `value_type` is `net::mutable_buffer`. Otherwise, `value_type` is `net::const_buffer`.
  1293. [heading See Also]
  1294. [link beast.ref.boost__beast__buffers_type `buffers_type`]
  1295. [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_range buffers_range] [indexterm1 buffers_range]
  1296. Returns an iterable range representing a buffer sequence. [heading Synopsis] Defined in header [include_file boost/beast/core/buffers_range.hpp] ``` template< class __BufferSequence__> ``['implementation-defined]`` buffers_range( BufferSequence const& buffers); ``` [heading Description]
  1297. This function returns an iterable range representing the passed buffer sequence. The values obtained when iterating the range will be `net::const_buffer`, unless the underlying buffer sequence is a ['MutableBufferSequence], in which case the value obtained when iterating will be a `net::mutable_buffer`.
  1298. [heading Example]
  1299. The following function returns the total number of bytes in the specified buffer sequence. A copy of the buffer sequence is maintained for the lifetime of the range object:
  1300. ``` template <class BufferSequence>
  1301. std::size_t buffer_sequence_size (BufferSequence const& buffers)
  1302. {
  1303. std::size_t size = 0;
  1304. for (auto const buffer : buffers_range (buffers))
  1305. size += buffer.size();
  1306. return size;
  1307. }
  1308. ```
  1309. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1310. The buffer sequence to adapt into a range. The range object returned from this function will contain a copy of the passed buffer sequence. ]] ]
  1311. [heading Return Value]
  1312. An object of unspecified type which meets the requirements of ['ConstBufferSequence]. If `buffers` is a mutable buffer sequence, the returned object will also meet the requirements of ['MutableBufferSequence].
  1313. [heading See Also]
  1314. [link beast.ref.boost__beast__buffers_range_ref `buffers_range_ref`]
  1315. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_range_ref buffers_range_ref] [indexterm1 buffers_range_ref]
  1316. Returns an iterable range representing a buffer sequence. [heading Synopsis] Defined in header [include_file boost/beast/core/buffers_range.hpp] ``` template< class __BufferSequence__> ``['implementation-defined]`` buffers_range_ref( BufferSequence const& buffers); ``` [heading Description]
  1317. This function returns an iterable range representing the passed buffer sequence. The values obtained when iterating the range will be `net::const_buffer`, unless the underlying buffer sequence is a ['MutableBufferSequence], in which case the value obtained when iterating will be a `net::mutable_buffer`.
  1318. [heading Example]
  1319. The following function returns the total number of bytes in the specified buffer sequence. A reference to the original buffers is maintained for the lifetime of the range object:
  1320. ``` template <class BufferSequence>
  1321. std::size_t buffer_sequence_size_ref (BufferSequence const& buffers)
  1322. {
  1323. std::size_t size = 0;
  1324. for (auto const buffer : buffers_range_ref (buffers))
  1325. size += buffer.size();
  1326. return size;
  1327. }
  1328. ```
  1329. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1330. The buffer sequence to adapt into a range. The range returned from this function will maintain a reference to these buffers. The application is responsible for ensuring that the lifetime of the referenced buffers extends until the range object is destroyed. ]] ]
  1331. [heading Return Value]
  1332. An object of unspecified type which meets the requirements of ['ConstBufferSequence]. If `buffers` is a mutable buffer sequence, the returned object will also meet the requirements of ['MutableBufferSequence].
  1333. [heading See Also]
  1334. [link beast.ref.boost__beast__buffers_range `buffers_range`]
  1335. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_suffix buffers_suffix]
  1336. Adaptor to progressively trim the front of a ['BufferSequence]. [heading Synopsis] Defined in header [include_file boost/beast/core/buffers_suffix.hpp] ``` template< class __BufferSequence__> class buffers_suffix ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__buffers_suffix.const_iterator [*const_iterator]]] [ A bidirectional iterator type that may be used to read elements. ] ] [ [[link beast.ref.boost__beast__buffers_suffix.value_type [*value_type]]] [ The type for each element in the list of buffers. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__buffers_suffix.begin [*begin]]] [ Get a bidirectional iterator to the first element. ] ] [ [[link beast.ref.boost__beast__buffers_suffix.buffers_suffix [*buffers_suffix]]] [ Constructor. Copy Constructor. ] ] [ [[link beast.ref.boost__beast__buffers_suffix.consume [*consume]]] [ Remove bytes from the beginning of the sequence. ] ] [ [[link beast.ref.boost__beast__buffers_suffix.end [*end]]] [ Get a bidirectional iterator to one past the last element. ] ] [ [[link beast.ref.boost__beast__buffers_suffix.operator_eq_ [*operator=]]] [ Copy Assignment. ] ] ] [heading Description]
  1337. This adaptor wraps a buffer sequence to create a new sequence which may be incrementally consumed. Bytes consumed are removed from the front of the buffer. The underlying memory is not changed, instead the adaptor efficiently iterates through a subset of the buffers wrapped.
  1338. The wrapped buffer is not modified, a copy is made instead. Ownership of the underlying memory is not transferred, the application is still responsible for managing its lifetime.
  1339. [heading Template Parameters] [table [[Type][Description]] [[`BufferSequence`][
  1340. The buffer sequence to wrap. ]] ]
  1341. [heading Example]
  1342. This function writes the entire contents of a buffer sequence to the specified stream.
  1343. ``` template<class SyncWriteStream, class ConstBufferSequence>
  1344. void send(SyncWriteStream& stream, ConstBufferSequence const& buffers)
  1345. {
  1346. buffers_suffix<ConstBufferSequence> bs{buffers};
  1347. while(buffer_bytes(bs) > 0)
  1348. bs.consume(stream.write_some(bs));
  1349. }
  1350. ``` [section:begin buffers_suffix::begin] [indexterm2 begin..buffers_suffix]
  1351. Get a bidirectional iterator to the first element. [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:buffers_suffix buffers_suffix::buffers_suffix] [indexterm2 buffers_suffix..buffers_suffix]
  1352. Constructor. ``` ``[link beast.ref.boost__beast__buffers_suffix.buffers_suffix.overload1 buffers_suffix]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_suffix.buffers_suffix.overload1 more...]]`` ```
  1353. Copy Constructor. ``` ``[link beast.ref.boost__beast__buffers_suffix.buffers_suffix.overload2 buffers_suffix]``( buffers_suffix const&); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_suffix.buffers_suffix.overload2 more...]]`` explicit ``[link beast.ref.boost__beast__buffers_suffix.buffers_suffix.overload3 buffers_suffix]``( BufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_suffix.buffers_suffix.overload3 more...]]`` template< class... Args> explicit ``[link beast.ref.boost__beast__buffers_suffix.buffers_suffix.overload4 buffers_suffix]``( boost::in_place_init_t, Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__buffers_suffix.buffers_suffix.overload4 more...]]`` ``` [section:overload1 buffers_suffix::buffers_suffix (1 of 4 overloads)]
  1354. Constructor. [heading Synopsis] ``` buffers_suffix(); ``` [heading Description] [endsect] [section:overload2 buffers_suffix::buffers_suffix (2 of 4 overloads)]
  1355. Copy Constructor. [heading Synopsis] ``` buffers_suffix( buffers_suffix const&); ``` [heading Description] [endsect] [section:overload3 buffers_suffix::buffers_suffix (3 of 4 overloads)]
  1356. Constructor. [heading Synopsis] ``` buffers_suffix( BufferSequence const& buffers); ``` [heading Description]
  1357. A copy of the buffer sequence is made. Ownership of the underlying memory is not transferred or copied. [endsect] [section:overload4 buffers_suffix::buffers_suffix (4 of 4 overloads)]
  1358. Constructor. [heading Synopsis] ``` template< class... Args> buffers_suffix( boost::in_place_init_t, Args&&... args); ``` [heading Description]
  1359. This constructs the buffer sequence in-place from a list of arguments.
  1360. [heading Parameters] [table [[Name][Description]] [[`args`][
  1361. Arguments forwarded to the buffers constructor. ]] ]
  1362. [endsect] [endsect] [section:const_iterator buffers_suffix::const_iterator] [indexterm2 const_iterator..buffers_suffix]
  1363. A bidirectional iterator type that may be used to read elements. [heading Synopsis] ``` using const_iterator = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:consume buffers_suffix::consume] [indexterm2 consume..buffers_suffix]
  1364. Remove bytes from the beginning of the sequence. [heading Synopsis] ``` void consume( std::size_t amount); ``` [heading Description]
  1365. [heading Parameters] [table [[Name][Description]] [[`amount`][
  1366. The number of bytes to remove. If this is larger than the number of bytes remaining, all the bytes remaining are removed. ]] ]
  1367. [endsect] [section:end buffers_suffix::end] [indexterm2 end..buffers_suffix]
  1368. Get a bidirectional iterator to one past the last element. [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:operator_eq_ buffers_suffix::operator=] [indexterm2 operator=..buffers_suffix]
  1369. Copy Assignment. [heading Synopsis] ``` buffers_suffix& operator=( buffers_suffix const&); ``` [heading Description] [endsect] [section:value_type buffers_suffix::value_type] [indexterm2 value_type..buffers_suffix]
  1370. The type for each element in the list of buffers. [heading Synopsis] ``` using value_type = ``['see-below]``; ``` [heading Description]
  1371. If ['BufferSequence] meets the requirements of ['MutableBufferSequence], then this type will be `net::mutable_buffer`, otherwise this type will be `net::const_buffer`. [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_to_string buffers_to_string] [indexterm1 buffers_to_string]
  1372. Return a string representing the contents of a buffer sequence. [heading Synopsis] Defined in header [include_file boost/beast/core/buffers_to_string.hpp] ``` template< class __ConstBufferSequence__> std::string buffers_to_string( ConstBufferSequence const& buffers); ``` [heading Description]
  1373. This function returns a string representing an entire buffer sequence. Nulls and unprintable characters in the buffer sequence are inserted to the resulting string as-is. No character conversions are performed.
  1374. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1375. The buffer sequence to convert ]] ]
  1376. [heading Example]
  1377. This function writes a buffer sequence converted to a string to `std::cout`.
  1378. ``` template<class ConstBufferSequence>
  1379. void print(ConstBufferSequence const& buffers)
  1380. {
  1381. std::cout << buffers_to_string(buffers) << std::endl;
  1382. }
  1383. ``` Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__buffers_type buffers_type] [indexterm1 buffers_type]
  1384. Type alias for the underlying buffer type of a list of buffer sequence types. [heading Synopsis] Defined in header [include_file boost/beast/core/buffer_traits.hpp] ``` template< class... __BufferSequence__> using buffers_type = ``['see-below]``; ``` [heading Description]
  1385. This metafunction is used to determine the underlying buffer type for a list of buffer sequence. The equivalent type of the alias will vary depending on the template type argument:
  1386. * If every type in the list is a ['MutableBufferSequence], the resulting type alias will be `net::mutable_buffer`, otherwise
  1387. * The resulting type alias will be `net::const_buffer`.
  1388. [heading Example]
  1389. The following code returns the first buffer in a buffer sequence, or generates a compilation error if the argument is not a buffer sequence: ``` template <class BufferSequence>
  1390. buffers_type <BufferSequence>
  1391. buffers_front (BufferSequence const& buffers)
  1392. {
  1393. static_assert(
  1394. net::is_const_buffer_sequence<BufferSequence>::value,
  1395. "BufferSequence type requirements not met");
  1396. auto const first = net::buffer_sequence_begin (buffers);
  1397. if (first == net::buffer_sequence_end (buffers))
  1398. return {};
  1399. return *first;
  1400. }
  1401. ```
  1402. [heading Template Parameters] [table [[Type][Description]] [[`BufferSequence`][
  1403. A list of zero or more types to check. If this list is empty, the resulting type alias will be `net::mutable_buffer`. ]] ]
  1404. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__close_socket close_socket] [indexterm1 close_socket]
  1405. Close a socket or socket-like object. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class Socket> void close_socket( Socket& sock); ``` [heading Description]
  1406. This function attempts to close an object representing a socket. In this context, a socket is an object for which an unqualified call to the function `void beast_close_socket(Socket&)` is well-defined. The function `beast_close_socket` is a ['customization point], allowing user-defined types to provide an algorithm for performing the close operation by overloading this function for the type in question.
  1407. Since the customization point is a function call, the normal rules for finding the correct overload are applied including the rules for argument-dependent lookup ("ADL"). This permits classes derived from a type for which a customization is provided to inherit the customization point.
  1408. An overload for the networking class template `net::basic_socket` is provided, which implements the close algorithm for all socket-like objects (hence the name of this customization point). When used in conjunction with [link beast.ref.boost__beast__get_lowest_layer `get_lowest_layer`], a generic algorithm operating on a layered stream can perform a closure of the underlying socket without knowing the exact list of concrete types.
  1409. [heading Example 1]
  1410. The following generic function synchronously sends a message on the stream, then closes the socket. ``` template <class WriteStream>
  1411. void hello_and_close (WriteStream& stream)
  1412. {
  1413. net::write(stream, net::const_buffer("Hello, world!", 13));
  1414. close_socket(get_lowest_layer(stream));
  1415. }
  1416. ```
  1417. To enable closure of user defined types, it is necessary to provide an overload of the function `beast_close_socket` for the type.
  1418. [heading Example 2]
  1419. The following code declares a user-defined type which contains a private socket, and provides an overload of the customization point which closes the private socket. ``` class my_socket
  1420. {
  1421. net::ip::tcp::socket sock_;
  1422. public:
  1423. my_socket(net::io_context& ioc)
  1424. : sock_(ioc)
  1425. {
  1426. }
  1427. friend void beast_close_socket(my_socket& s)
  1428. {
  1429. error_code ec;
  1430. s.sock_.close(ec);
  1431. // ignore the error
  1432. }
  1433. };
  1434. ```
  1435. [heading Parameters] [table [[Name][Description]] [[`sock`][
  1436. The socket to close. If the customization point is not defined for the type of this object, or one of its base classes, then a compiler error results. ]] ]
  1437. [heading See Also]
  1438. [link beast.ref.boost__beast__beast_close_socket `beast_close_socket`]
  1439. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__condition condition] [indexterm1 condition]
  1440. Error conditions corresponding to sets of library error codes. [heading Synopsis] Defined in header [include_file boost/beast/core/error.hpp] ``` enum condition ``` [indexterm2 timeout..condition] [heading Values] [table [[Name][Description]] [[[^timeout]][The operation timed out. This error indicates that an operation took took too long.
  1441. ]] ] [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__detect_ssl detect_ssl] [indexterm1 detect_ssl]
  1442. Detect a TLS client handshake on a stream. [heading Synopsis] Defined in header [include_file boost/beast/core/detect_ssl.hpp] ``` template< class __SyncReadStream__, class __DynamicBuffer__> bool detect_ssl( SyncReadStream& stream, DynamicBuffer& buffer, error_code& ec); ``` [heading Description]
  1443. This function reads from a stream to determine if a client handshake message is being received.
  1444. The call blocks until one of the following is true:
  1445. * A TLS client opening handshake is detected,
  1446. * The received data is invalid for a TLS client handshake, or
  1447. * An error occurs.
  1448. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` function.
  1449. Bytes read from the stream will be stored in the passed dynamic buffer, which may be used to perform the TLS handshake if the detector returns true, or be otherwise consumed by the caller based on the expected protocol.
  1450. [heading Parameters] [table [[Name][Description]] [[`stream`][
  1451. The stream to read from. This type must meet the requirements of ['SyncReadStream]. ]] [[`buffer`][
  1452. The dynamic buffer to use. This type must meet the requirements of ['DynamicBuffer]. ]] [[`ec`][
  1453. Set to the error if any occurred. ]] ]
  1454. [heading Return Value]
  1455. `true` if the buffer contains a TLS client handshake and no error occurred, otherwise `false`.
  1456. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__errc errc] [indexterm1 errc]
  1457. The set of constants used for cross-platform error codes. [heading Synopsis] Defined in header [include_file boost/beast/core/error.hpp] ``` enum errc ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__error error] [indexterm1 error]
  1458. Error codes returned from library operations. [heading Synopsis] Defined in header [include_file boost/beast/core/error.hpp] ``` enum error ``` [indexterm2 timeout..error] [heading Values] [table [[Name][Description]] [[[^timeout]][The socket was closed due to a timeout. This error indicates that a socket was closed due to a
  1459. a timeout detected during an operation.
  1460. Error codes with this value will compare equal to @ref condition::timeout.
  1461. ]] ] [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__error_category error_category] [indexterm1 error_category]
  1462. The type of error category used by the library. [heading Synopsis] Defined in header [include_file boost/beast/core/error.hpp] ``` using error_category = boost::system::error_category; ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__error_code error_code] [indexterm1 error_code]
  1463. The type of error code used by the library. [heading Synopsis] Defined in header [include_file boost/beast/core/error.hpp] ``` using error_code = boost::system::error_code; ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__error_condition error_condition] [indexterm1 error_condition]
  1464. The type of error condition used by the library. [heading Synopsis] Defined in header [include_file boost/beast/core/error.hpp] ``` using error_condition = boost::system::error_condition; ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__executor_type executor_type] [indexterm1 executor_type]
  1465. A trait to determine the return type of get\_executor. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class T> using executor_type = ``['see-below]``; ``` [heading Description]
  1466. This type alias will be the type of values returned by by calling member `get_exector` on an object of type `T&`.
  1467. [heading Parameters] [table [[Name][Description]] [[`T`][
  1468. The type to query ]] ]
  1469. [heading Return Value]
  1470. The type of values returned from `get_executor`.
  1471. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__file file]
  1472. An implementation of File. [heading Synopsis] Defined in header [include_file boost/beast/core/file.hpp] ``` struct file : public file_stdio ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__file.native_handle_type [*native_handle_type]]] [ The type of the underlying file handle. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__file.close [*close]]] [ Close the file if open. ] ] [ [[link beast.ref.boost__beast__file.is_open [*is_open]]] [ Returns true if the file is open. ] ] [ [[link beast.ref.boost__beast__file.native_handle [*native_handle]]] [ Returns the native handle associated with the file. Set the native handle associated with the file. ] ] [ [[link beast.ref.boost__beast__file.open [*open]]] [ Open a file at the given path with the specified mode. ] ] [ [[link beast.ref.boost__beast__file.pos [*pos]]] [ Return the current position in the open file. ] ] [ [[link beast.ref.boost__beast__file.read [*read]]] [ Read from the open file. ] ] [ [[link beast.ref.boost__beast__file.seek [*seek]]] [ Adjust the current position in the open file. ] ] [ [[link beast.ref.boost__beast__file.size [*size]]] [ Return the size of the open file. ] ] [ [[link beast.ref.boost__beast__file.write [*write]]] [ Write to the open file. ] ] ] [heading Description]
  1473. This alias is set to the best available implementation of ['File] given the platform and build settings. [section:close file::close] (Inherited from `file_stdio`) [indexterm2 close..file]
  1474. Close the file if open. [heading Synopsis] ``` void close( error_code& ec); ``` [heading Description]
  1475. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1476. Set to the error, if any occurred. ]] ]
  1477. [endsect] [section:is_open file::is_open] (Inherited from `file_stdio`) [indexterm2 is_open..file]
  1478. Returns `true` if the file is open. [heading Synopsis] ``` bool is_open() const; ``` [heading Description] [endsect] [section:native_handle file::native_handle] [indexterm2 native_handle..file]
  1479. Returns the native handle associated with the file. ``` FILE* ``[link beast.ref.boost__beast__file.native_handle.overload1 native_handle]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__file.native_handle.overload1 more...]]`` ```
  1480. Set the native handle associated with the file. ``` void ``[link beast.ref.boost__beast__file.native_handle.overload2 native_handle]``( FILE* f); ``[''''&raquo;''' [link beast.ref.boost__beast__file.native_handle.overload2 more...]]`` ``` [section:overload1 file::native_handle (1 of 2 overloads)] (Inherited from `file_stdio`)
  1481. Returns the native handle associated with the file. [heading Synopsis] ``` FILE* native_handle() const; ``` [heading Description] [endsect] [section:overload2 file::native_handle (2 of 2 overloads)] (Inherited from `file_stdio`)
  1482. Set the native handle associated with the file. [heading Synopsis] ``` void native_handle( FILE* f); ``` [heading Description]
  1483. If the file is open it is first closed.
  1484. [heading Parameters] [table [[Name][Description]] [[`f`][
  1485. The native file handle to assign. ]] ]
  1486. [endsect] [endsect] [section:native_handle_type file::native_handle_type] (Inherited from `file_stdio`) [indexterm2 native_handle_type..file]
  1487. The type of the underlying file handle. [heading Synopsis] ``` using native_handle_type = FILE*; ``` [heading Description]
  1488. This is platform-specific. [endsect] [section:open file::open] (Inherited from `file_stdio`) [indexterm2 open..file]
  1489. Open a file at the given path with the specified mode. [heading Synopsis] ``` void open( char const* path, file_mode mode, error_code& ec); ``` [heading Description]
  1490. [heading Parameters] [table [[Name][Description]] [[`path`][
  1491. The utf-8 encoded path to the file ]] [[`mode`][
  1492. The file mode to use ]] [[`ec`][
  1493. Set to the error, if any occurred ]] ]
  1494. [endsect] [section:pos file::pos] (Inherited from `file_stdio`) [indexterm2 pos..file]
  1495. Return the current position in the open file. [heading Synopsis] ``` std::uint64_t pos( error_code& ec) const; ``` [heading Description]
  1496. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1497. Set to the error, if any occurred ]] ]
  1498. [heading Return Value]
  1499. The offset in bytes from the beginning of the file
  1500. [endsect] [section:read file::read] (Inherited from `file_stdio`) [indexterm2 read..file]
  1501. Read from the open file. [heading Synopsis] ``` std::size_t read( void* buffer, std::size_t n, error_code& ec) const; ``` [heading Description]
  1502. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  1503. The buffer for storing the result of the read ]] [[`n`][
  1504. The number of bytes to read ]] [[`ec`][
  1505. Set to the error, if any occurred ]] ]
  1506. [endsect] [section:seek file::seek] (Inherited from `file_stdio`) [indexterm2 seek..file]
  1507. Adjust the current position in the open file. [heading Synopsis] ``` void seek( std::uint64_t offset, error_code& ec); ``` [heading Description]
  1508. [heading Parameters] [table [[Name][Description]] [[`offset`][
  1509. The offset in bytes from the beginning of the file ]] [[`ec`][
  1510. Set to the error, if any occurred ]] ]
  1511. [endsect] [section:size file::size] (Inherited from `file_stdio`) [indexterm2 size..file]
  1512. Return the size of the open file. [heading Synopsis] ``` std::uint64_t size( error_code& ec) const; ``` [heading Description]
  1513. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1514. Set to the error, if any occurred ]] ]
  1515. [heading Return Value]
  1516. The size in bytes
  1517. [endsect] [section:write file::write] (Inherited from `file_stdio`) [indexterm2 write..file]
  1518. Write to the open file. [heading Synopsis] ``` std::size_t write( void const* buffer, std::size_t n, error_code& ec); ``` [heading Description]
  1519. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  1520. The buffer holding the data to write ]] [[`n`][
  1521. The number of bytes to write ]] [[`ec`][
  1522. Set to the error, if any occurred ]] ]
  1523. [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__file_mode file_mode] [indexterm1 file_mode]
  1524. File open modes. [heading Synopsis] Defined in header [include_file boost/beast/core/file_base.hpp] ``` enum file_mode ``` [indexterm2 read..file_mode] [indexterm2 scan..file_mode] [indexterm2 write..file_mode] [indexterm2 write_new..file_mode] [indexterm2 write_existing..file_mode] [indexterm2 append..file_mode] [indexterm2 append_existing..file_mode] [heading Values] [table [[Name][Description]] [[[^read]][Random read-only access to an existing file. ]] [[[^scan]][Sequential read-only access to an existing file. ]] [[[^write]][Random reading and writing to a new or truncated file. This mode permits random-access reading and writing
  1525. for the specified file. If the file does not exist
  1526. prior to the function call, it is created with an
  1527. initial size of zero bytes. Otherwise if the file
  1528. already exists, the size is truncated to zero bytes.
  1529. ]] [[[^write_new]][Random reading and writing to a new file only. This mode permits random-access reading and writing
  1530. for the specified file. The file will be created with
  1531. an initial size of zero bytes. If the file already exists
  1532. prior to the function call, an error is returned and
  1533. no file is opened.
  1534. ]] [[[^write_existing]][Random write-only access to existing file. If the file does not exist, an error is generated.
  1535. ]] [[[^append]][Appending to a new or truncated file. The current file position shall be set to the end of
  1536. the file prior to each write.
  1537. @li If the file does not exist, it is created.
  1538. @li If the file exists, it is truncated to
  1539. zero size upon opening.
  1540. ]] [[[^append_existing]][Appending to an existing file. The current file position shall be set to the end of
  1541. the file prior to each write.
  1542. If the file does not exist, an error is generated.
  1543. ]] ] [heading Description]
  1544. These modes are used when opening files using instances of the ['File] concept.
  1545. [heading See Also]
  1546. [link beast.ref.boost__beast__file_stdio `file_stdio`]
  1547. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__file_posix file_posix]
  1548. An implementation of File for POSIX systems. [heading Synopsis] Defined in header [include_file boost/beast/core/file_posix.hpp] ``` class file_posix ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__file_posix.native_handle_type [*native_handle_type]]] [ The type of the underlying file handle. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__file_posix.close [*close]]] [ Close the file if open. ] ] [ [[link beast.ref.boost__beast__file_posix.file_posix [*file_posix]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__file_posix.is_open [*is_open]]] [ Returns true if the file is open. ] ] [ [[link beast.ref.boost__beast__file_posix.native_handle [*native_handle]]] [ Returns the native handle associated with the file. Set the native handle associated with the file. ] ] [ [[link beast.ref.boost__beast__file_posix.open [*open]]] [ Open a file at the given path with the specified mode. ] ] [ [[link beast.ref.boost__beast__file_posix.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__file_posix.pos [*pos]]] [ Return the current position in the open file. ] ] [ [[link beast.ref.boost__beast__file_posix.read [*read]]] [ Read from the open file. ] ] [ [[link beast.ref.boost__beast__file_posix.seek [*seek]]] [ Adjust the current position in the open file. ] ] [ [[link beast.ref.boost__beast__file_posix.size [*size]]] [ Return the size of the open file. ] ] [ [[link beast.ref.boost__beast__file_posix.write [*write]]] [ Write to the open file. ] ] [ [[link beast.ref.boost__beast__file_posix.file_posix_dtor_ [*~file_posix]]] [ Destructor. ] ] ] [heading Description]
  1549. This class implements a ['File] using POSIX interfaces. [section:close file_posix::close] [indexterm2 close..file_posix]
  1550. Close the file if open. [heading Synopsis] ``` void close( error_code& ec); ``` [heading Description]
  1551. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1552. Set to the error, if any occurred. ]] ]
  1553. [endsect] [section:file_posix file_posix::file_posix] [indexterm2 file_posix..file_posix]
  1554. Constructor. ``` ``[link beast.ref.boost__beast__file_posix.file_posix.overload1 file_posix]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__file_posix.file_posix.overload1 more...]]`` ``[link beast.ref.boost__beast__file_posix.file_posix.overload2 file_posix]``( file_posix&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__file_posix.file_posix.overload2 more...]]`` ``` [section:overload1 file_posix::file_posix (1 of 2 overloads)]
  1555. Constructor. [heading Synopsis] ``` file_posix(); ``` [heading Description]
  1556. There is no open file initially. [endsect] [section:overload2 file_posix::file_posix (2 of 2 overloads)]
  1557. Constructor. [heading Synopsis] ``` file_posix( file_posix&& other); ``` [heading Description]
  1558. The moved-from object behaves as if default constructed. [endsect] [endsect] [section:is_open file_posix::is_open] [indexterm2 is_open..file_posix]
  1559. Returns `true` if the file is open. [heading Synopsis] ``` bool is_open() const; ``` [heading Description] [endsect] [section:native_handle file_posix::native_handle] [indexterm2 native_handle..file_posix]
  1560. Returns the native handle associated with the file. ``` native_handle_type ``[link beast.ref.boost__beast__file_posix.native_handle.overload1 native_handle]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__file_posix.native_handle.overload1 more...]]`` ```
  1561. Set the native handle associated with the file. ``` void ``[link beast.ref.boost__beast__file_posix.native_handle.overload2 native_handle]``( native_handle_type fd); ``[''''&raquo;''' [link beast.ref.boost__beast__file_posix.native_handle.overload2 more...]]`` ``` [section:overload1 file_posix::native_handle (1 of 2 overloads)]
  1562. Returns the native handle associated with the file. [heading Synopsis] ``` native_handle_type native_handle() const; ``` [heading Description] [endsect] [section:overload2 file_posix::native_handle (2 of 2 overloads)]
  1563. Set the native handle associated with the file. [heading Synopsis] ``` void native_handle( native_handle_type fd); ``` [heading Description]
  1564. If the file is open it is first closed.
  1565. [heading Parameters] [table [[Name][Description]] [[`fd`][
  1566. The native file handle to assign. ]] ]
  1567. [endsect] [endsect] [section:native_handle_type file_posix::native_handle_type] [indexterm2 native_handle_type..file_posix]
  1568. The type of the underlying file handle. [heading Synopsis] ``` using native_handle_type = int; ``` [heading Description]
  1569. This is platform-specific. [endsect] [section:open file_posix::open] [indexterm2 open..file_posix]
  1570. Open a file at the given path with the specified mode. [heading Synopsis] ``` void open( char const* path, file_mode mode, error_code& ec); ``` [heading Description]
  1571. [heading Parameters] [table [[Name][Description]] [[`path`][
  1572. The utf-8 encoded path to the file ]] [[`mode`][
  1573. The file mode to use ]] [[`ec`][
  1574. Set to the error, if any occurred ]] ]
  1575. [endsect] [section:operator_eq_ file_posix::operator=] [indexterm2 operator=..file_posix]
  1576. Assignment. [heading Synopsis] ``` file_posix& operator=( file_posix&& other); ``` [heading Description]
  1577. The moved-from object behaves as if default constructed. [endsect] [section:pos file_posix::pos] [indexterm2 pos..file_posix]
  1578. Return the current position in the open file. [heading Synopsis] ``` std::uint64_t pos( error_code& ec) const; ``` [heading Description]
  1579. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1580. Set to the error, if any occurred ]] ]
  1581. [heading Return Value]
  1582. The offset in bytes from the beginning of the file
  1583. [endsect] [section:read file_posix::read] [indexterm2 read..file_posix]
  1584. Read from the open file. [heading Synopsis] ``` std::size_t read( void* buffer, std::size_t n, error_code& ec) const; ``` [heading Description]
  1585. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  1586. The buffer for storing the result of the read ]] [[`n`][
  1587. The number of bytes to read ]] [[`ec`][
  1588. Set to the error, if any occurred ]] ]
  1589. [endsect] [section:seek file_posix::seek] [indexterm2 seek..file_posix]
  1590. Adjust the current position in the open file. [heading Synopsis] ``` void seek( std::uint64_t offset, error_code& ec); ``` [heading Description]
  1591. [heading Parameters] [table [[Name][Description]] [[`offset`][
  1592. The offset in bytes from the beginning of the file ]] [[`ec`][
  1593. Set to the error, if any occurred ]] ]
  1594. [endsect] [section:size file_posix::size] [indexterm2 size..file_posix]
  1595. Return the size of the open file. [heading Synopsis] ``` std::uint64_t size( error_code& ec) const; ``` [heading Description]
  1596. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1597. Set to the error, if any occurred ]] ]
  1598. [heading Return Value]
  1599. The size in bytes
  1600. [endsect] [section:write file_posix::write] [indexterm2 write..file_posix]
  1601. Write to the open file. [heading Synopsis] ``` std::size_t write( void const* buffer, std::size_t n, error_code& ec); ``` [heading Description]
  1602. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  1603. The buffer holding the data to write ]] [[`n`][
  1604. The number of bytes to write ]] [[`ec`][
  1605. Set to the error, if any occurred ]] ]
  1606. [endsect] [section:file_posix_dtor_ file_posix::~file_posix] [indexterm2 ~file_posix..file_posix]
  1607. Destructor. [heading Synopsis] ``` ~file_posix(); ``` [heading Description]
  1608. If the file is open it is first closed. [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__file_stdio file_stdio]
  1609. An implementation of File which uses cstdio. [heading Synopsis] Defined in header [include_file boost/beast/core/file_stdio.hpp] ``` class file_stdio ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__file_stdio.native_handle_type [*native_handle_type]]] [ The type of the underlying file handle. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__file_stdio.close [*close]]] [ Close the file if open. ] ] [ [[link beast.ref.boost__beast__file_stdio.file_stdio [*file_stdio]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__file_stdio.is_open [*is_open]]] [ Returns true if the file is open. ] ] [ [[link beast.ref.boost__beast__file_stdio.native_handle [*native_handle]]] [ Returns the native handle associated with the file. Set the native handle associated with the file. ] ] [ [[link beast.ref.boost__beast__file_stdio.open [*open]]] [ Open a file at the given path with the specified mode. ] ] [ [[link beast.ref.boost__beast__file_stdio.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__file_stdio.pos [*pos]]] [ Return the current position in the open file. ] ] [ [[link beast.ref.boost__beast__file_stdio.read [*read]]] [ Read from the open file. ] ] [ [[link beast.ref.boost__beast__file_stdio.seek [*seek]]] [ Adjust the current position in the open file. ] ] [ [[link beast.ref.boost__beast__file_stdio.size [*size]]] [ Return the size of the open file. ] ] [ [[link beast.ref.boost__beast__file_stdio.write [*write]]] [ Write to the open file. ] ] [ [[link beast.ref.boost__beast__file_stdio.file_stdio_dtor_ [*~file_stdio]]] [ Destructor. ] ] ] [heading Description]
  1610. This class implements a file using the interfaces present in the C++ Standard Library, in `<stdio>`. [section:close file_stdio::close] [indexterm2 close..file_stdio]
  1611. Close the file if open. [heading Synopsis] ``` void close( error_code& ec); ``` [heading Description]
  1612. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1613. Set to the error, if any occurred. ]] ]
  1614. [endsect] [section:file_stdio file_stdio::file_stdio] [indexterm2 file_stdio..file_stdio]
  1615. Constructor. ``` ``[link beast.ref.boost__beast__file_stdio.file_stdio.overload1 file_stdio]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__file_stdio.file_stdio.overload1 more...]]`` ``[link beast.ref.boost__beast__file_stdio.file_stdio.overload2 file_stdio]``( file_stdio&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__file_stdio.file_stdio.overload2 more...]]`` ``` [section:overload1 file_stdio::file_stdio (1 of 2 overloads)]
  1616. Constructor. [heading Synopsis] ``` file_stdio(); ``` [heading Description]
  1617. There is no open file initially. [endsect] [section:overload2 file_stdio::file_stdio (2 of 2 overloads)]
  1618. Constructor. [heading Synopsis] ``` file_stdio( file_stdio&& other); ``` [heading Description]
  1619. The moved-from object behaves as if default constructed. [endsect] [endsect] [section:is_open file_stdio::is_open] [indexterm2 is_open..file_stdio]
  1620. Returns `true` if the file is open. [heading Synopsis] ``` bool is_open() const; ``` [heading Description] [endsect] [section:native_handle file_stdio::native_handle] [indexterm2 native_handle..file_stdio]
  1621. Returns the native handle associated with the file. ``` FILE* ``[link beast.ref.boost__beast__file_stdio.native_handle.overload1 native_handle]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__file_stdio.native_handle.overload1 more...]]`` ```
  1622. Set the native handle associated with the file. ``` void ``[link beast.ref.boost__beast__file_stdio.native_handle.overload2 native_handle]``( FILE* f); ``[''''&raquo;''' [link beast.ref.boost__beast__file_stdio.native_handle.overload2 more...]]`` ``` [section:overload1 file_stdio::native_handle (1 of 2 overloads)]
  1623. Returns the native handle associated with the file. [heading Synopsis] ``` FILE* native_handle() const; ``` [heading Description] [endsect] [section:overload2 file_stdio::native_handle (2 of 2 overloads)]
  1624. Set the native handle associated with the file. [heading Synopsis] ``` void native_handle( FILE* f); ``` [heading Description]
  1625. If the file is open it is first closed.
  1626. [heading Parameters] [table [[Name][Description]] [[`f`][
  1627. The native file handle to assign. ]] ]
  1628. [endsect] [endsect] [section:native_handle_type file_stdio::native_handle_type] [indexterm2 native_handle_type..file_stdio]
  1629. The type of the underlying file handle. [heading Synopsis] ``` using native_handle_type = FILE*; ``` [heading Description]
  1630. This is platform-specific. [endsect] [section:open file_stdio::open] [indexterm2 open..file_stdio]
  1631. Open a file at the given path with the specified mode. [heading Synopsis] ``` void open( char const* path, file_mode mode, error_code& ec); ``` [heading Description]
  1632. [heading Parameters] [table [[Name][Description]] [[`path`][
  1633. The utf-8 encoded path to the file ]] [[`mode`][
  1634. The file mode to use ]] [[`ec`][
  1635. Set to the error, if any occurred ]] ]
  1636. [endsect] [section:operator_eq_ file_stdio::operator=] [indexterm2 operator=..file_stdio]
  1637. Assignment. [heading Synopsis] ``` file_stdio& operator=( file_stdio&& other); ``` [heading Description]
  1638. The moved-from object behaves as if default constructed. [endsect] [section:pos file_stdio::pos] [indexterm2 pos..file_stdio]
  1639. Return the current position in the open file. [heading Synopsis] ``` std::uint64_t pos( error_code& ec) const; ``` [heading Description]
  1640. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1641. Set to the error, if any occurred ]] ]
  1642. [heading Return Value]
  1643. The offset in bytes from the beginning of the file
  1644. [endsect] [section:read file_stdio::read] [indexterm2 read..file_stdio]
  1645. Read from the open file. [heading Synopsis] ``` std::size_t read( void* buffer, std::size_t n, error_code& ec) const; ``` [heading Description]
  1646. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  1647. The buffer for storing the result of the read ]] [[`n`][
  1648. The number of bytes to read ]] [[`ec`][
  1649. Set to the error, if any occurred ]] ]
  1650. [endsect] [section:seek file_stdio::seek] [indexterm2 seek..file_stdio]
  1651. Adjust the current position in the open file. [heading Synopsis] ``` void seek( std::uint64_t offset, error_code& ec); ``` [heading Description]
  1652. [heading Parameters] [table [[Name][Description]] [[`offset`][
  1653. The offset in bytes from the beginning of the file ]] [[`ec`][
  1654. Set to the error, if any occurred ]] ]
  1655. [endsect] [section:size file_stdio::size] [indexterm2 size..file_stdio]
  1656. Return the size of the open file. [heading Synopsis] ``` std::uint64_t size( error_code& ec) const; ``` [heading Description]
  1657. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1658. Set to the error, if any occurred ]] ]
  1659. [heading Return Value]
  1660. The size in bytes
  1661. [endsect] [section:write file_stdio::write] [indexterm2 write..file_stdio]
  1662. Write to the open file. [heading Synopsis] ``` std::size_t write( void const* buffer, std::size_t n, error_code& ec); ``` [heading Description]
  1663. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  1664. The buffer holding the data to write ]] [[`n`][
  1665. The number of bytes to write ]] [[`ec`][
  1666. Set to the error, if any occurred ]] ]
  1667. [endsect] [section:file_stdio_dtor_ file_stdio::~file_stdio] [indexterm2 ~file_stdio..file_stdio]
  1668. Destructor. [heading Synopsis] ``` ~file_stdio(); ``` [heading Description]
  1669. If the file is open it is first closed. [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__file_win32 file_win32]
  1670. An implementation of File for Win32. [heading Synopsis] Defined in header [include_file boost/beast/core/file_win32.hpp] ``` class file_win32 ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__file_win32.native_handle_type [*native_handle_type]]] [ The type of the underlying file handle. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__file_win32.close [*close]]] [ Close the file if open. ] ] [ [[link beast.ref.boost__beast__file_win32.file_win32 [*file_win32]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__file_win32.is_open [*is_open]]] [ Returns true if the file is open. ] ] [ [[link beast.ref.boost__beast__file_win32.native_handle [*native_handle]]] [ Returns the native handle associated with the file. Set the native handle associated with the file. ] ] [ [[link beast.ref.boost__beast__file_win32.open [*open]]] [ Open a file at the given path with the specified mode. ] ] [ [[link beast.ref.boost__beast__file_win32.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__file_win32.pos [*pos]]] [ Return the current position in the open file. ] ] [ [[link beast.ref.boost__beast__file_win32.read [*read]]] [ Read from the open file. ] ] [ [[link beast.ref.boost__beast__file_win32.seek [*seek]]] [ Adjust the current position in the open file. ] ] [ [[link beast.ref.boost__beast__file_win32.size [*size]]] [ Return the size of the open file. ] ] [ [[link beast.ref.boost__beast__file_win32.write [*write]]] [ Write to the open file. ] ] [ [[link beast.ref.boost__beast__file_win32.file_win32_dtor_ [*~file_win32]]] [ Destructor. ] ] ] [heading Description]
  1671. This class implements a ['File] using Win32 native interfaces. [section:close file_win32::close] [indexterm2 close..file_win32]
  1672. Close the file if open. [heading Synopsis] ``` void close( error_code& ec); ``` [heading Description]
  1673. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1674. Set to the error, if any occurred. ]] ]
  1675. [endsect] [section:file_win32 file_win32::file_win32] [indexterm2 file_win32..file_win32]
  1676. Constructor. ``` ``[link beast.ref.boost__beast__file_win32.file_win32.overload1 file_win32]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__file_win32.file_win32.overload1 more...]]`` ``[link beast.ref.boost__beast__file_win32.file_win32.overload2 file_win32]``( file_win32&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__file_win32.file_win32.overload2 more...]]`` ``` [section:overload1 file_win32::file_win32 (1 of 2 overloads)]
  1677. Constructor. [heading Synopsis] ``` file_win32(); ``` [heading Description]
  1678. There is no open file initially. [endsect] [section:overload2 file_win32::file_win32 (2 of 2 overloads)]
  1679. Constructor. [heading Synopsis] ``` file_win32( file_win32&& other); ``` [heading Description]
  1680. The moved-from object behaves as if default constructed. [endsect] [endsect] [section:is_open file_win32::is_open] [indexterm2 is_open..file_win32]
  1681. Returns `true` if the file is open. [heading Synopsis] ``` bool is_open() const; ``` [heading Description] [endsect] [section:native_handle file_win32::native_handle] [indexterm2 native_handle..file_win32]
  1682. Returns the native handle associated with the file. ``` native_handle_type ``[link beast.ref.boost__beast__file_win32.native_handle.overload1 native_handle]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__file_win32.native_handle.overload1 more...]]`` ```
  1683. Set the native handle associated with the file. ``` void ``[link beast.ref.boost__beast__file_win32.native_handle.overload2 native_handle]``( native_handle_type h); ``[''''&raquo;''' [link beast.ref.boost__beast__file_win32.native_handle.overload2 more...]]`` ``` [section:overload1 file_win32::native_handle (1 of 2 overloads)]
  1684. Returns the native handle associated with the file. [heading Synopsis] ``` native_handle_type native_handle(); ``` [heading Description] [endsect] [section:overload2 file_win32::native_handle (2 of 2 overloads)]
  1685. Set the native handle associated with the file. [heading Synopsis] ``` void native_handle( native_handle_type h); ``` [heading Description]
  1686. If the file is open it is first closed.
  1687. [heading Parameters] [table [[Name][Description]] [[`h`][
  1688. The native file handle to assign. ]] ]
  1689. [endsect] [endsect] [section:native_handle_type file_win32::native_handle_type] [indexterm2 native_handle_type..file_win32]
  1690. The type of the underlying file handle. [heading Synopsis] ``` using native_handle_type = HANDLE; ``` [heading Description]
  1691. This is platform-specific. [endsect] [section:open file_win32::open] [indexterm2 open..file_win32]
  1692. Open a file at the given path with the specified mode. [heading Synopsis] ``` void open( char const* path, file_mode mode, error_code& ec); ``` [heading Description]
  1693. [heading Parameters] [table [[Name][Description]] [[`path`][
  1694. The utf-8 encoded path to the file ]] [[`mode`][
  1695. The file mode to use ]] [[`ec`][
  1696. Set to the error, if any occurred ]] ]
  1697. [endsect] [section:operator_eq_ file_win32::operator=] [indexterm2 operator=..file_win32]
  1698. Assignment. [heading Synopsis] ``` file_win32& operator=( file_win32&& other); ``` [heading Description]
  1699. The moved-from object behaves as if default constructed. [endsect] [section:pos file_win32::pos] [indexterm2 pos..file_win32]
  1700. Return the current position in the open file. [heading Synopsis] ``` std::uint64_t pos( error_code& ec); ``` [heading Description]
  1701. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1702. Set to the error, if any occurred ]] ]
  1703. [heading Return Value]
  1704. The offset in bytes from the beginning of the file
  1705. [endsect] [section:read file_win32::read] [indexterm2 read..file_win32]
  1706. Read from the open file. [heading Synopsis] ``` std::size_t read( void* buffer, std::size_t n, error_code& ec); ``` [heading Description]
  1707. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  1708. The buffer for storing the result of the read ]] [[`n`][
  1709. The number of bytes to read ]] [[`ec`][
  1710. Set to the error, if any occurred ]] ]
  1711. [endsect] [section:seek file_win32::seek] [indexterm2 seek..file_win32]
  1712. Adjust the current position in the open file. [heading Synopsis] ``` void seek( std::uint64_t offset, error_code& ec); ``` [heading Description]
  1713. [heading Parameters] [table [[Name][Description]] [[`offset`][
  1714. The offset in bytes from the beginning of the file ]] [[`ec`][
  1715. Set to the error, if any occurred ]] ]
  1716. [endsect] [section:size file_win32::size] [indexterm2 size..file_win32]
  1717. Return the size of the open file. [heading Synopsis] ``` std::uint64_t size( error_code& ec) const; ``` [heading Description]
  1718. [heading Parameters] [table [[Name][Description]] [[`ec`][
  1719. Set to the error, if any occurred ]] ]
  1720. [heading Return Value]
  1721. The size in bytes
  1722. [endsect] [section:write file_win32::write] [indexterm2 write..file_win32]
  1723. Write to the open file. [heading Synopsis] ``` std::size_t write( void const* buffer, std::size_t n, error_code& ec); ``` [heading Description]
  1724. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  1725. The buffer holding the data to write ]] [[`n`][
  1726. The number of bytes to write ]] [[`ec`][
  1727. Set to the error, if any occurred ]] ]
  1728. [endsect] [section:file_win32_dtor_ file_win32::~file_win32] [indexterm2 ~file_win32..file_win32]
  1729. Destructor. [heading Synopsis] ``` ~file_win32(); ``` [heading Description]
  1730. If the file is open it is first closed. [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__flat_buffer flat_buffer] [indexterm1 flat_buffer]
  1731. A flat buffer which uses the default allocator. [heading Synopsis] Defined in header [include_file boost/beast/core/flat_buffer.hpp] ``` using flat_buffer = basic_flat_buffer< std::allocator< char > >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_flat_buffer.allocator_type [*allocator_type]]] [ The type of allocator used. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.const_buffers_type [*const_buffers_type]]] [ The ConstBufferSequence used to represent the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.mutable_buffers_type [*mutable_buffers_type]]] [ The MutableBufferSequence used to represent the writable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.mutable_data_type [*mutable_data_type]]] [ The MutableBufferSequence used to represent the readable bytes. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer [*basic_flat_buffer]]] [ Constructor. Move Constructor. Copy Constructor. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.capacity [*capacity]]] [ Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.cdata [*cdata]]] [ Returns a constant buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.clear [*clear]]] [ Set the size of the readable and writable bytes to zero. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.commit [*commit]]] [ Append writable bytes to the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.consume [*consume]]] [ Remove bytes from beginning of the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.data [*data]]] [ Returns a constant buffer sequence representing the readable bytes. Returns a mutable buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.get_allocator [*get_allocator]]] [ Returns a copy of the allocator used. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.max_size [*max_size]]] [ Set the maximum allowed capacity. Return the maximum number of bytes, both readable and writable, that can ever be held. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.operator_eq_ [*operator=]]] [ Move Assignment. Copy Assignment. Copy assignment. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.prepare [*prepare]]] [ Returns a mutable buffer sequence representing writable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.reserve [*reserve]]] [ Guarantee a minimum capacity. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.shrink_to_fit [*shrink_to_fit]]] [ Reallocate the buffer to fit the readable bytes exactly. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.size [*size]]] [ Returns the number of readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_flat_buffer.basic_flat_buffer_dtor_ [*~basic_flat_buffer]]] [ Destructor. ] ] ] [heading Friends] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_flat_buffer.swap [*swap]]] [ Exchange two dynamic buffers. ] ] ]
  1732. A dynamic buffer encapsulates memory storage that may be automatically resized as required, where the memory is divided into two regions: readable bytes followed by writable bytes. These memory regions are internal to the dynamic buffer, but direct access to the elements is provided to permit them to be efficiently used with I/O operations.
  1733. Objects of this type meet the requirements of ['DynamicBuffer] and have the following additional properties:
  1734. * A mutable buffer sequence representing the readable bytes is returned by [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] when `this` is non-const.
  1735. * A configurable maximum buffer size may be set upon construction. Attempts to exceed the buffer size will throw `std::length_error`.
  1736. * Buffer sequences representing the readable and writable bytes, returned by [link beast.ref.boost__beast__basic_flat_buffer.data `basic_flat_buffer::data`] and [link beast.ref.boost__beast__basic_flat_buffer.prepare `basic_flat_buffer::prepare`], will have length one.
  1737. Upon construction, a maximum size for the buffer may be specified. If this limit is exceeded, the `std::length_error` exception will be thrown.
  1738. [heading Remarks]
  1739. This class is designed for use with algorithms that take dynamic buffers as parameters, and are optimized for the case where the input sequence or output sequence is stored in a single contiguous buffer.
  1740. [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__flat_static_buffer flat_static_buffer]
  1741. A ['DynamicBuffer] with a fixed size internal buffer. [heading Synopsis] Defined in header [include_file boost/beast/core/flat_static_buffer.hpp] ``` template< std::size_t N> class flat_static_buffer : public flat_static_buffer_base ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__flat_static_buffer.const_buffers_type [*const_buffers_type]]] [ The ConstBufferSequence used to represent the readable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.mutable_buffers_type [*mutable_buffers_type]]] [ The MutableBufferSequence used to represent the writable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.mutable_data_type [*mutable_data_type]]] [ The MutableBufferSequence used to represent the readable bytes. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__flat_static_buffer.base [*base]]] [ Returns the flat_static_buffer_base portion of this object. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.capacity [*capacity]]] [ Return the maximum sum of input and output sizes that can be held without an allocation. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.cdata [*cdata]]] [ Returns a constant buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.clear [*clear]]] [ Clear the readable and writable bytes to zero. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.commit [*commit]]] [ Append writable bytes to the readable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.consume [*consume]]] [ Remove bytes from beginning of the readable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.data [*data]]] [ Returns a constant buffer sequence representing the readable bytes. Returns a mutable buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.flat_static_buffer [*flat_static_buffer]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.max_size [*max_size]]] [ Return the maximum sum of the input and output sequence sizes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.prepare [*prepare]]] [ Returns a mutable buffer sequence representing writable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer.size [*size]]] [ Returns the number of readable bytes. ] ] ] [heading Protected Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__flat_static_buffer.reset [*reset]]] [ Reset the pointed-to buffer. ] ] ] [heading Description]
  1742. Buffer sequences returned by [link beast.ref.boost__beast__flat_static_buffer.data `flat_static_buffer::data`] and [link beast.ref.boost__beast__flat_static_buffer.prepare `flat_static_buffer::prepare`] will always be of length one. This implements a dynamic buffer using no memory allocations.
  1743. [heading Template Parameters] [table [[Type][Description]] [[`N`][
  1744. The number of bytes in the internal buffer. ]] ]
  1745. [heading Remarks]
  1746. To reduce the number of template instantiations when passing objects of this type in a deduced context, the signature of the receiving function should use [link beast.ref.boost__beast__flat_static_buffer_base `flat_static_buffer_base`] instead.
  1747. [heading See Also]
  1748. [link beast.ref.boost__beast__flat_static_buffer_base `flat_static_buffer_base`]
  1749. [section:base flat_static_buffer::base] [indexterm2 base..flat_static_buffer]
  1750. Returns the [link beast.ref.boost__beast__flat_static_buffer_base `flat_static_buffer_base`] portion of this object. ``` flat_static_buffer_base& ``[link beast.ref.boost__beast__flat_static_buffer.base.overload1 base]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_static_buffer.base.overload1 more...]]`` flat_static_buffer_base const & ``[link beast.ref.boost__beast__flat_static_buffer.base.overload2 base]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__flat_static_buffer.base.overload2 more...]]`` ``` [section:overload1 flat_static_buffer::base (1 of 2 overloads)]
  1751. Returns the [link beast.ref.boost__beast__flat_static_buffer_base `flat_static_buffer_base`] portion of this object. [heading Synopsis] ``` flat_static_buffer_base& base(); ``` [heading Description] [endsect] [section:overload2 flat_static_buffer::base (2 of 2 overloads)]
  1752. Returns the [link beast.ref.boost__beast__flat_static_buffer_base `flat_static_buffer_base`] portion of this object. [heading Synopsis] ``` flat_static_buffer_base const & base() const; ``` [heading Description] [endsect] [endsect] [section:capacity flat_static_buffer::capacity] [indexterm2 capacity..flat_static_buffer]
  1753. Return the maximum sum of input and output sizes that can be held without an allocation. [heading Synopsis] ``` std::size_t constexpr capacity() const; ``` [heading Description] [endsect] [section:cdata flat_static_buffer::cdata] [indexterm2 cdata..flat_static_buffer]
  1754. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type cdata() const; ``` [heading Description] [endsect] [section:clear flat_static_buffer::clear] [indexterm2 clear..flat_static_buffer]
  1755. Clear the readable and writable bytes to zero. [heading Synopsis] ``` void clear(); ``` [heading Description]
  1756. This function causes the readable and writable bytes to become empty. The capacity is not changed.
  1757. Buffer sequences previously obtained using [link beast.ref.boost__beast__flat_static_buffer.data `flat_static_buffer::data`] or [link beast.ref.boost__beast__flat_static_buffer.prepare `flat_static_buffer::prepare`] become invalid.
  1758. [heading Exception Safety]
  1759. No-throw guarantee. [endsect] [section:commit flat_static_buffer::commit] [indexterm2 commit..flat_static_buffer]
  1760. Append writable bytes to the readable bytes. [heading Synopsis] ``` void commit( std::size_t n); ``` [heading Description]
  1761. Appends n bytes from the start of the writable bytes to the end of the readable bytes. The remainder of the writable bytes are discarded. If n is greater than the number of writable bytes, all writable bytes are appended to the readable bytes.
  1762. All buffers sequences previously obtained using [link beast.ref.boost__beast__flat_static_buffer.data `flat_static_buffer::data`] or [link beast.ref.boost__beast__flat_static_buffer.prepare `flat_static_buffer::prepare`] are invalidated.
  1763. [heading Parameters] [table [[Name][Description]] [[`n`][
  1764. The number of bytes to append. If this number is greater than the number of writable bytes, all writable bytes are appended. ]] ]
  1765. [heading Exception Safety]
  1766. No-throw guarantee. [endsect] [section:const_buffers_type flat_static_buffer::const_buffers_type] [indexterm2 const_buffers_type..flat_static_buffer]
  1767. The ConstBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using const_buffers_type = net::const_buffer; ``` [heading Description] [endsect] [section:consume flat_static_buffer::consume] [indexterm2 consume..flat_static_buffer]
  1768. Remove bytes from beginning of the readable bytes. [heading Synopsis] ``` void consume( std::size_t n); ``` [heading Description]
  1769. Removes n bytes from the beginning of the readable bytes.
  1770. All buffers sequences previously obtained using [link beast.ref.boost__beast__flat_static_buffer.data `flat_static_buffer::data`] or [link beast.ref.boost__beast__flat_static_buffer.prepare `flat_static_buffer::prepare`] are invalidated.
  1771. [heading Parameters] [table [[Name][Description]] [[`n`][
  1772. The number of bytes to remove. If this number is greater than the number of readable bytes, all readable bytes are removed. ]] ]
  1773. [heading Exception Safety]
  1774. No-throw guarantee. [endsect] [section:data flat_static_buffer::data] [indexterm2 data..flat_static_buffer]
  1775. Returns a constant buffer sequence representing the readable bytes. ``` const_buffers_type ``[link beast.ref.boost__beast__flat_static_buffer.data.overload1 data]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__flat_static_buffer.data.overload1 more...]]`` ```
  1776. Returns a mutable buffer sequence representing the readable bytes. ``` mutable_data_type ``[link beast.ref.boost__beast__flat_static_buffer.data.overload2 data]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_static_buffer.data.overload2 more...]]`` ``` [section:overload1 flat_static_buffer::data (1 of 2 overloads)]
  1777. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type data() const; ``` [heading Description] [endsect] [section:overload2 flat_static_buffer::data (2 of 2 overloads)]
  1778. Returns a mutable buffer sequence representing the readable bytes. [heading Synopsis] ``` mutable_data_type data(); ``` [heading Description] [endsect] [endsect] [section:flat_static_buffer flat_static_buffer::flat_static_buffer] [indexterm2 flat_static_buffer..flat_static_buffer]
  1779. Constructor. ``` ``[link beast.ref.boost__beast__flat_static_buffer.flat_static_buffer.overload1 flat_static_buffer]``( flat_static_buffer const&); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_static_buffer.flat_static_buffer.overload1 more...]]`` ``[link beast.ref.boost__beast__flat_static_buffer.flat_static_buffer.overload2 flat_static_buffer]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_static_buffer.flat_static_buffer.overload2 more...]]`` ``` [section:overload1 flat_static_buffer::flat_static_buffer (1 of 2 overloads)]
  1780. Constructor. [heading Synopsis] ``` flat_static_buffer( flat_static_buffer const&); ``` [heading Description] [endsect] [section:overload2 flat_static_buffer::flat_static_buffer (2 of 2 overloads)]
  1781. Constructor. [heading Synopsis] ``` flat_static_buffer(); ``` [heading Description] [endsect] [endsect] [section:max_size flat_static_buffer::max_size] [indexterm2 max_size..flat_static_buffer]
  1782. Return the maximum sum of the input and output sequence sizes. [heading Synopsis] ``` std::size_t constexpr max_size() const; ``` [heading Description] [endsect] [section:mutable_buffers_type flat_static_buffer::mutable_buffers_type] [indexterm2 mutable_buffers_type..flat_static_buffer]
  1783. The MutableBufferSequence used to represent the writable bytes. [heading Synopsis] ``` using mutable_buffers_type = net::mutable_buffer; ``` [heading Description] [endsect] [section:mutable_data_type flat_static_buffer::mutable_data_type] [indexterm2 mutable_data_type..flat_static_buffer]
  1784. The MutableBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using mutable_data_type = net::mutable_buffer; ``` [heading Description] [endsect] [section:operator_eq_ flat_static_buffer::operator=] [indexterm2 operator=..flat_static_buffer]
  1785. Assignment. [heading Synopsis] ``` flat_static_buffer& operator=( flat_static_buffer const&); ``` [heading Description] [endsect] [section:prepare flat_static_buffer::prepare] [indexterm2 prepare..flat_static_buffer]
  1786. Returns a mutable buffer sequence representing writable bytes. [heading Synopsis] ``` mutable_buffers_type prepare( std::size_t n); ``` [heading Description]
  1787. Returns a mutable buffer sequence representing the writable bytes containing exactly `n` bytes of storage.
  1788. All buffers sequences previously obtained using [link beast.ref.boost__beast__flat_static_buffer.data `flat_static_buffer::data`] or [link beast.ref.boost__beast__flat_static_buffer.prepare `flat_static_buffer::prepare`] are invalidated.
  1789. [heading Parameters] [table [[Name][Description]] [[`n`][
  1790. The desired number of bytes in the returned buffer sequence. ]] ]
  1791. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  1792. if `size() + n` exceeds `max_size()`. ]] ]
  1793. [heading Exception Safety]
  1794. Strong guarantee. [endsect] [section:reset flat_static_buffer::reset] [indexterm2 reset..flat_static_buffer]
  1795. Reset the pointed-to buffer. [heading Synopsis] ``` void reset( void* p, std::size_t n); ``` [heading Description]
  1796. This function resets the internal state to the buffer provided. All input and output sequences are invalidated. This function allows the derived class to construct its members before initializing the static buffer.
  1797. [heading Parameters] [table [[Name][Description]] [[`p`][
  1798. A pointer to valid storage of at least `n` bytes. ]] [[`n`][
  1799. The number of valid bytes pointed to by `p`. ]] ]
  1800. [heading Exception Safety]
  1801. No-throw guarantee. [endsect] [section:size flat_static_buffer::size] [indexterm2 size..flat_static_buffer]
  1802. Returns the number of readable bytes. [heading Synopsis] ``` std::size_t size() const; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__flat_static_buffer_base flat_static_buffer_base]
  1803. A dynamic buffer using a fixed size internal buffer. [heading Synopsis] Defined in header [include_file boost/beast/core/flat_static_buffer.hpp] ``` class flat_static_buffer_base ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__flat_static_buffer_base.const_buffers_type [*const_buffers_type]]] [ The ConstBufferSequence used to represent the readable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.mutable_buffers_type [*mutable_buffers_type]]] [ The MutableBufferSequence used to represent the writable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.mutable_data_type [*mutable_data_type]]] [ The MutableBufferSequence used to represent the readable bytes. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__flat_static_buffer_base.capacity [*capacity]]] [ Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.cdata [*cdata]]] [ Returns a constant buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.clear [*clear]]] [ Clear the readable and writable bytes to zero. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.commit [*commit]]] [ Append writable bytes to the readable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.consume [*consume]]] [ Remove bytes from beginning of the readable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.data [*data]]] [ Returns a constant buffer sequence representing the readable bytes. Returns a mutable buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.flat_static_buffer_base [*flat_static_buffer_base]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.max_size [*max_size]]] [ Return the maximum number of bytes, both readable and writable, that can ever be held. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.prepare [*prepare]]] [ Returns a mutable buffer sequence representing writable bytes. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.size [*size]]] [ Returns the number of readable bytes. ] ] ] [heading Protected Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__flat_static_buffer_base.flat_static_buffer_base [*flat_static_buffer_base]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__flat_static_buffer_base.reset [*reset]]] [ Reset the pointed-to buffer. ] ] ] [heading Description]
  1804. A dynamic buffer encapsulates memory storage that may be automatically resized as required, where the memory is divided into two regions: readable bytes followed by writable bytes. These memory regions are internal to the dynamic buffer, but direct access to the elements is provided to permit them to be efficiently used with I/O operations.
  1805. Objects of this type meet the requirements of ['DynamicBuffer] and have the following additional properties:
  1806. * A mutable buffer sequence representing the readable bytes is returned by [link beast.ref.boost__beast__flat_static_buffer.data `flat_static_buffer::data`] when `this` is non-const.
  1807. * Buffer sequences representing the readable and writable bytes, returned by [link beast.ref.boost__beast__flat_static_buffer.data `flat_static_buffer::data`] and [link beast.ref.boost__beast__flat_static_buffer.prepare `flat_static_buffer::prepare`], will have length one.
  1808. * Ownership of the underlying storage belongs to the derived class.
  1809. [heading Remarks]
  1810. Variables are usually declared using the template class [link beast.ref.boost__beast__flat_static_buffer `flat_static_buffer`]; however, to reduce the number of template instantiations, objects should be passed `flat_static_buffer_base&`.
  1811. [heading See Also]
  1812. [link beast.ref.boost__beast__flat_static_buffer `flat_static_buffer`]
  1813. [section:capacity flat_static_buffer_base::capacity] [indexterm2 capacity..flat_static_buffer_base]
  1814. Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. [heading Synopsis] ``` std::size_t capacity() const; ``` [heading Description] [endsect] [section:cdata flat_static_buffer_base::cdata] [indexterm2 cdata..flat_static_buffer_base]
  1815. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type cdata() const; ``` [heading Description] [endsect] [section:clear flat_static_buffer_base::clear] [indexterm2 clear..flat_static_buffer_base]
  1816. Clear the readable and writable bytes to zero. [heading Synopsis] ``` void clear(); ``` [heading Description]
  1817. This function causes the readable and writable bytes to become empty. The capacity is not changed.
  1818. Buffer sequences previously obtained using [link beast.ref.boost__beast__flat_static_buffer.data `flat_static_buffer::data`] or [link beast.ref.boost__beast__flat_static_buffer.prepare `flat_static_buffer::prepare`] become invalid.
  1819. [heading Exception Safety]
  1820. No-throw guarantee. [endsect] [section:commit flat_static_buffer_base::commit] [indexterm2 commit..flat_static_buffer_base]
  1821. Append writable bytes to the readable bytes. [heading Synopsis] ``` void commit( std::size_t n); ``` [heading Description]
  1822. Appends n bytes from the start of the writable bytes to the end of the readable bytes. The remainder of the writable bytes are discarded. If n is greater than the number of writable bytes, all writable bytes are appended to the readable bytes.
  1823. All buffers sequences previously obtained using [link beast.ref.boost__beast__flat_static_buffer.data `flat_static_buffer::data`] or [link beast.ref.boost__beast__flat_static_buffer.prepare `flat_static_buffer::prepare`] are invalidated.
  1824. [heading Parameters] [table [[Name][Description]] [[`n`][
  1825. The number of bytes to append. If this number is greater than the number of writable bytes, all writable bytes are appended. ]] ]
  1826. [heading Exception Safety]
  1827. No-throw guarantee. [endsect] [section:const_buffers_type flat_static_buffer_base::const_buffers_type] [indexterm2 const_buffers_type..flat_static_buffer_base]
  1828. The ConstBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using const_buffers_type = net::const_buffer; ``` [heading Description] [endsect] [section:consume flat_static_buffer_base::consume] [indexterm2 consume..flat_static_buffer_base]
  1829. Remove bytes from beginning of the readable bytes. [heading Synopsis] ``` void consume( std::size_t n); ``` [heading Description]
  1830. Removes n bytes from the beginning of the readable bytes.
  1831. All buffers sequences previously obtained using [link beast.ref.boost__beast__flat_static_buffer.data `flat_static_buffer::data`] or [link beast.ref.boost__beast__flat_static_buffer.prepare `flat_static_buffer::prepare`] are invalidated.
  1832. [heading Parameters] [table [[Name][Description]] [[`n`][
  1833. The number of bytes to remove. If this number is greater than the number of readable bytes, all readable bytes are removed. ]] ]
  1834. [heading Exception Safety]
  1835. No-throw guarantee. [endsect] [section:data flat_static_buffer_base::data] [indexterm2 data..flat_static_buffer_base]
  1836. Returns a constant buffer sequence representing the readable bytes. ``` const_buffers_type ``[link beast.ref.boost__beast__flat_static_buffer_base.data.overload1 data]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__flat_static_buffer_base.data.overload1 more...]]`` ```
  1837. Returns a mutable buffer sequence representing the readable bytes. ``` mutable_data_type ``[link beast.ref.boost__beast__flat_static_buffer_base.data.overload2 data]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_static_buffer_base.data.overload2 more...]]`` ``` [section:overload1 flat_static_buffer_base::data (1 of 2 overloads)]
  1838. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type data() const; ``` [heading Description] [endsect] [section:overload2 flat_static_buffer_base::data (2 of 2 overloads)]
  1839. Returns a mutable buffer sequence representing the readable bytes. [heading Synopsis] ``` mutable_data_type data(); ``` [heading Description] [endsect] [endsect] [section:flat_static_buffer_base flat_static_buffer_base::flat_static_buffer_base] [indexterm2 flat_static_buffer_base..flat_static_buffer_base]
  1840. Constructor. [heading Synopsis] ``` flat_static_buffer_base( void* p, std::size_t n); ``` [heading Description]
  1841. This creates a dynamic buffer using the provided storage area.
  1842. [heading Parameters] [table [[Name][Description]] [[`p`][
  1843. A pointer to valid storage of at least `n` bytes. ]] [[`n`][
  1844. The number of valid bytes pointed to by `p`. ]] ]
  1845. [endsect] [section:flat_static_buffer_base flat_static_buffer_base::flat_static_buffer_base] [indexterm2 flat_static_buffer_base..flat_static_buffer_base]
  1846. Constructor. [heading Synopsis] ``` flat_static_buffer_base(); ``` [heading Description]
  1847. The buffer will be in an undefined state. It is necessary for the derived class to call [link beast.ref.boost__beast__flat_static_buffer.reset `flat_static_buffer::reset`] with a pointer and size in order to initialize the object. [endsect] [section:max_size flat_static_buffer_base::max_size] [indexterm2 max_size..flat_static_buffer_base]
  1848. Return the maximum number of bytes, both readable and writable, that can ever be held. [heading Synopsis] ``` std::size_t max_size() const; ``` [heading Description] [endsect] [section:mutable_buffers_type flat_static_buffer_base::mutable_buffers_type] [indexterm2 mutable_buffers_type..flat_static_buffer_base]
  1849. The MutableBufferSequence used to represent the writable bytes. [heading Synopsis] ``` using mutable_buffers_type = net::mutable_buffer; ``` [heading Description] [endsect] [section:mutable_data_type flat_static_buffer_base::mutable_data_type] [indexterm2 mutable_data_type..flat_static_buffer_base]
  1850. The MutableBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using mutable_data_type = net::mutable_buffer; ``` [heading Description] [endsect] [section:prepare flat_static_buffer_base::prepare] [indexterm2 prepare..flat_static_buffer_base]
  1851. Returns a mutable buffer sequence representing writable bytes. [heading Synopsis] ``` mutable_buffers_type prepare( std::size_t n); ``` [heading Description]
  1852. Returns a mutable buffer sequence representing the writable bytes containing exactly `n` bytes of storage.
  1853. All buffers sequences previously obtained using [link beast.ref.boost__beast__flat_static_buffer.data `flat_static_buffer::data`] or [link beast.ref.boost__beast__flat_static_buffer.prepare `flat_static_buffer::prepare`] are invalidated.
  1854. [heading Parameters] [table [[Name][Description]] [[`n`][
  1855. The desired number of bytes in the returned buffer sequence. ]] ]
  1856. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  1857. if `size() + n` exceeds `max_size()`. ]] ]
  1858. [heading Exception Safety]
  1859. Strong guarantee. [endsect] [section:reset flat_static_buffer_base::reset] [indexterm2 reset..flat_static_buffer_base]
  1860. Reset the pointed-to buffer. [heading Synopsis] ``` void reset( void* p, std::size_t n); ``` [heading Description]
  1861. This function resets the internal state to the buffer provided. All input and output sequences are invalidated. This function allows the derived class to construct its members before initializing the static buffer.
  1862. [heading Parameters] [table [[Name][Description]] [[`p`][
  1863. A pointer to valid storage of at least `n` bytes. ]] [[`n`][
  1864. The number of valid bytes pointed to by `p`. ]] ]
  1865. [heading Exception Safety]
  1866. No-throw guarantee. [endsect] [section:size flat_static_buffer_base::size] [indexterm2 size..flat_static_buffer_base]
  1867. Returns the number of readable bytes. [heading Synopsis] ``` std::size_t size() const; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__flat_stream flat_stream]
  1868. Stream wrapper to improve write performance. [heading Synopsis] Defined in header [include_file boost/beast/core/flat_stream.hpp] ``` template< class NextLayer> class flat_stream ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__flat_stream.executor_type [*executor_type]]] [ The type of the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__flat_stream.next_layer_type [*next_layer_type]]] [ The type of the next layer. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__flat_stream.async_read_some [*async_read_some]]] [ Start an asynchronous read. ] ] [ [[link beast.ref.boost__beast__flat_stream.async_write_some [*async_write_some]]] [ Start an asynchronous write. ] ] [ [[link beast.ref.boost__beast__flat_stream.flat_stream [*flat_stream]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__flat_stream.get_executor [*get_executor]]] [ Get the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__flat_stream.next_layer [*next_layer]]] [ Get a reference to the next layer. ] ] [ [[link beast.ref.boost__beast__flat_stream.operator_eq_ [*operator=]]] [ ] ] [ [[link beast.ref.boost__beast__flat_stream.read_some [*read_some]]] [ Read some data from the stream. ] ] [ [[link beast.ref.boost__beast__flat_stream.write_some [*write_some]]] [ Write some data to the stream. ] ] [ [[link beast.ref.boost__beast__flat_stream.flat_stream_dtor_ [*~flat_stream]]] [ Destructor. ] ] ] [heading Description]
  1869. This wrapper flattens writes for buffer sequences having length greater than 1 and total size below a predefined amount, using a dynamic memory allocation. It is primarily designed to overcome a performance limitation of the current version of `net::ssl::stream`, which does not use OpenSSL's scatter/gather interface for its low-level read some and write some operations.
  1870. It is normally not necessary to use this class directly if you are already using [link beast.ref.boost__beast__ssl_stream `ssl_stream`]. The following examples shows how to use this class with the ssl stream that comes with networking:
  1871. [heading Example]
  1872. To use the [link beast.ref.boost__beast__flat_stream `flat_stream`] template with SSL streams, declare a variable of the correct type. Parameters passed to the constructor will be forwarded to the next layer's constructor:
  1873. ``` flat_stream<net::ssl::stream<ip::tcp::socket>> fs{ioc, ctx};
  1874. ``` Alternatively you can write ``` ssl::stream<ip::tcp::socket> ss{ioc, ctx};
  1875. flat_stream<net::ssl::stream<ip::tcp::socket>&> fs{ss};
  1876. ```
  1877. The resulting stream may be passed to any stream algorithms which operate on synchronous or asynchronous read or write streams, examples include:
  1878. * `net::read`, `net::async_read`
  1879. * `net::write`, `net::async_write`
  1880. * `net::read_until`, `net::async_read_until`
  1881. The stream may also be used as a template parameter in other stream wrappers, such as for websocket: ``` websocket::stream<flat_stream<net::ssl::stream<ip::tcp::socket>>> ws{ioc, ctx};
  1882. ```
  1883. [heading Template Parameters] [table [[Type][Description]] [[`NextLayer`][
  1884. The type representing the next layer, to which data will be read and written during operations. For synchronous operations, the type must support the [*SyncStream] concept. For asynchronous operations, the type must support the [*AsyncStream] concept. This type will usually be some variation of `net::ssl::stream`. ]] ]
  1885. [heading Concepts]
  1886. * SyncStream
  1887. * AsyncStream
  1888. [heading See Also]
  1889. * [@https://github.com/boostorg/asio/issues/100 https://github.com/boostorg/asio/issues/100]
  1890. * [@https://github.com/boostorg/beast/issues/1108 https://github.com/boostorg/beast/issues/1108]
  1891. * [@https://stackoverflow.com/questions/38198638/openssl-ssl-write-from-multiple-buffers-ssl-writev https://stackoverflow.com/questions/38198638/openssl-ssl-write-from-multiple-buffers-ssl-writev]
  1892. * [@https://stackoverflow.com/questions/50026167/performance-drop-on-port-from-beast-1-0-0-b66-to-boost-1-67-0-beast https://stackoverflow.com/questions/50026167/performance-drop-on-port-from-beast-1-0-0-b66-to-boost-1-67-0-beast]
  1893. [section:async_read_some flat_stream::async_read_some] [indexterm2 async_read_some..flat_stream]
  1894. Start an asynchronous read. [heading Synopsis] ``` template< class __MutableBufferSequence__, class __ReadHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_read_some( MutableBufferSequence const& buffers, ReadHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  1895. This function is used to asynchronously read one or more bytes of data from the stream. The function call always returns immediately.
  1896. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1897. The buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  1898. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  1899. error_code const& error, // Result of operation.
  1900. std::size_t bytes_transferred // Number of bytes read.
  1901. );
  1902. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  1903. [heading Remarks]
  1904. The `read_some` operation may not read all of the requested number of bytes. Consider using the function `net::async_read` if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
  1905. [endsect] [section:async_write_some flat_stream::async_write_some] [indexterm2 async_write_some..flat_stream]
  1906. Start an asynchronous write. [heading Synopsis] ``` template< class __ConstBufferSequence__, class __WriteHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_write_some( ConstBufferSequence const& buffers, WriteHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  1907. This function is used to asynchronously write one or more bytes of data to the stream. The function call always returns immediately.
  1908. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1909. The data to be written to the stream. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  1910. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  1911. error_code const& ec, // Result of operation.
  1912. std::size_t bytes_transferred // Number of bytes written.
  1913. );
  1914. ``` ]] ]
  1915. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`.
  1916. [heading Remarks]
  1917. The `async_write_some` operation may not transmit all of the data to the peer. Consider using the function `net::async_write` if you need to ensure that all data is written before the asynchronous operation completes.
  1918. [endsect] [section:executor_type flat_stream::executor_type] [indexterm2 executor_type..flat_stream]
  1919. The type of the executor associated with the object. [heading Synopsis] ``` using executor_type = beast::executor_type< next_layer_type >; ``` [heading Description] [endsect] [section:flat_stream flat_stream::flat_stream] [indexterm2 flat_stream..flat_stream] ``` ``[link beast.ref.boost__beast__flat_stream.flat_stream.overload1 flat_stream]``( flat_stream&&); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_stream.flat_stream.overload1 more...]]`` ``[link beast.ref.boost__beast__flat_stream.flat_stream.overload2 flat_stream]``( flat_stream const&); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_stream.flat_stream.overload2 more...]]`` ```
  1920. Constructor. ``` template< class... Args> explicit ``[link beast.ref.boost__beast__flat_stream.flat_stream.overload3 flat_stream]``( Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_stream.flat_stream.overload3 more...]]`` ``` [section:overload1 flat_stream::flat_stream (1 of 3 overloads)] [heading Synopsis] ``` flat_stream( flat_stream&&); ``` [heading Description] [endsect] [section:overload2 flat_stream::flat_stream (2 of 3 overloads)] [heading Synopsis] ``` flat_stream( flat_stream const&); ``` [heading Description] [endsect] [section:overload3 flat_stream::flat_stream (3 of 3 overloads)]
  1921. Constructor. [heading Synopsis] ``` template< class... Args> flat_stream( Args&&... args); ``` [heading Description]
  1922. Arguments, if any, are forwarded to the next layer's constructor. [endsect] [endsect] [section:get_executor flat_stream::get_executor] [indexterm2 get_executor..flat_stream]
  1923. Get the executor associated with the object. [heading Synopsis] ``` executor_type get_executor(); ``` [heading Description]
  1924. This function may be used to obtain the executor object that the stream uses to dispatch handlers for asynchronous operations.
  1925. [heading Return Value]
  1926. A copy of the executor that stream will use to dispatch handlers.
  1927. [endsect] [section:next_layer flat_stream::next_layer] [indexterm2 next_layer..flat_stream]
  1928. Get a reference to the next layer. ``` next_layer_type& ``[link beast.ref.boost__beast__flat_stream.next_layer.overload1 next_layer]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_stream.next_layer.overload1 more...]]`` next_layer_type const & ``[link beast.ref.boost__beast__flat_stream.next_layer.overload2 next_layer]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__flat_stream.next_layer.overload2 more...]]`` ``` [section:overload1 flat_stream::next_layer (1 of 2 overloads)]
  1929. Get a reference to the next layer. [heading Synopsis] ``` next_layer_type& next_layer(); ``` [heading Description]
  1930. This function returns a reference to the next layer in a stack of stream layers.
  1931. [heading Return Value]
  1932. A reference to the next layer in the stack of stream layers.
  1933. [endsect] [section:overload2 flat_stream::next_layer (2 of 2 overloads)]
  1934. Get a reference to the next layer. [heading Synopsis] ``` next_layer_type const & next_layer() const; ``` [heading Description]
  1935. This function returns a reference to the next layer in a stack of stream layers.
  1936. [heading Return Value]
  1937. A reference to the next layer in the stack of stream layers.
  1938. [endsect] [endsect] [section:next_layer_type flat_stream::next_layer_type] [indexterm2 next_layer_type..flat_stream]
  1939. The type of the next layer. [heading Synopsis] ``` using next_layer_type = typename std::remove_reference< NextLayer >::type; ``` [heading Description] [endsect] [section:operator_eq_ flat_stream::operator=] [indexterm2 operator=..flat_stream] ``` flat_stream& ``[link beast.ref.boost__beast__flat_stream.operator_eq_.overload1 operator=]``( flat_stream&&); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_stream.operator_eq_.overload1 more...]]`` flat_stream& ``[link beast.ref.boost__beast__flat_stream.operator_eq_.overload2 operator=]``( flat_stream const&); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_stream.operator_eq_.overload2 more...]]`` ``` [section:overload1 flat_stream::operator= (1 of 2 overloads)] [heading Synopsis] ``` flat_stream& operator=( flat_stream&&); ``` [heading Description] [endsect] [section:overload2 flat_stream::operator= (2 of 2 overloads)] [heading Synopsis] ``` flat_stream& operator=( flat_stream const&); ``` [heading Description] [endsect] [endsect] [section:read_some flat_stream::read_some] [indexterm2 read_some..flat_stream]
  1940. Read some data from the stream. ``` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__flat_stream.read_some.overload1 read_some]``( MutableBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_stream.read_some.overload1 more...]]`` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__flat_stream.read_some.overload2 read_some]``( MutableBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_stream.read_some.overload2 more...]]`` ``` [section:overload1 flat_stream::read_some (1 of 2 overloads)]
  1941. Read some data from the stream. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers); ``` [heading Description]
  1942. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  1943. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1944. The buffers into which the data will be read. ]] ]
  1945. [heading Return Value]
  1946. The number of bytes read.
  1947. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  1948. Thrown on failure. ]] ]
  1949. [heading Remarks]
  1950. The `read_some` operation may not read all of the requested number of bytes. Consider using the function `net::read` if you need to ensure that the requested amount of data is read before the blocking operation completes.
  1951. [endsect] [section:overload2 flat_stream::read_some (2 of 2 overloads)]
  1952. Read some data from the stream. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  1953. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  1954. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1955. The buffers into which the data will be read. ]] [[`ec`][
  1956. Set to indicate what error occurred, if any. ]] ]
  1957. [heading Return Value]
  1958. The number of bytes read.
  1959. [heading Remarks]
  1960. The `read_some` operation may not read all of the requested number of bytes. Consider using the function `net::read` if you need to ensure that the requested amount of data is read before the blocking operation completes.
  1961. [endsect] [endsect] [section:write_some flat_stream::write_some] [indexterm2 write_some..flat_stream]
  1962. Write some data to the stream. ``` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__flat_stream.write_some.overload1 write_some]``( ConstBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_stream.write_some.overload1 more...]]`` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__flat_stream.write_some.overload2 write_some]``( ConstBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__flat_stream.write_some.overload2 more...]]`` ``` [section:overload1 flat_stream::write_some (1 of 2 overloads)]
  1963. Write some data to the stream. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers); ``` [heading Description]
  1964. This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
  1965. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1966. The data to be written. ]] ]
  1967. [heading Return Value]
  1968. The number of bytes written.
  1969. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  1970. Thrown on failure. ]] ]
  1971. [heading Remarks]
  1972. The `write_some` operation may not transmit all of the data to the peer. Consider using the function `net::write` if you need to ensure that all data is written before the blocking operation completes.
  1973. [endsect] [section:overload2 flat_stream::write_some (2 of 2 overloads)]
  1974. Write some data to the stream. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  1975. This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
  1976. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  1977. The data to be written. ]] [[`ec`][
  1978. Set to indicate what error occurred, if any. ]] ]
  1979. [heading Return Value]
  1980. The number of bytes written.
  1981. [heading Remarks]
  1982. The `write_some` operation may not transmit all of the data to the peer. Consider using the function `net::write` if you need to ensure that all data is written before the blocking operation completes.
  1983. [endsect] [endsect] [section:flat_stream_dtor_ flat_stream::~flat_stream] [indexterm2 ~flat_stream..flat_stream]
  1984. Destructor. [heading Synopsis] ``` ~flat_stream(); ``` [heading Description]
  1985. The treatment of pending operations will be the same as that of the next layer. [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__generic_category generic_category] [indexterm1 generic_category]
  1986. A function to return the generic error category used by the library. [heading Synopsis] Defined in header [include_file boost/beast/core/error.hpp] ``` error_category const & generic_category(); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__get_lowest_layer get_lowest_layer] [indexterm1 get_lowest_layer]
  1987. Return the lowest layer in a stack of stream layers. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class T> lowest_layer_type< T >& get_lowest_layer( T& t); ``` [heading Description]
  1988. If `t.next_layer()` is well-defined, returns `get_lowest_layer(t.next_layer())`. Otherwise, it returns `t`.
  1989. A stream layer is an object of class type which wraps another object through composition, and meets some or all of the named requirements of the wrapped type while optionally changing behavior. Examples of stream layers include `net::ssl::stream` or [link beast.ref.boost__beast__websocket__stream `websocket::stream`]. The owner of a stream layer can interact directly with the wrapper, by passing it to stream algorithms. Or, the owner can obtain a reference to the wrapped object by calling `next_layer()` and accessing its members. This is necessary when it is desired to access functionality in the next layer which is not available in the wrapper. For example, [link beast.ref.boost__beast__websocket__stream `websocket::stream`] permits reading and writing, but in order to establish the underlying connection, members of the wrapped stream (such as `connect`) must be invoked directly.
  1990. Usually the last object in the chain of composition is the concrete socket object (for example, a `net::basic_socket` or a class derived from it). The function [link beast.ref.boost__beast__get_lowest_layer `get_lowest_layer`] exists to easily obtain the concrete socket when it is desired to perform an action that is not prescribed by a named requirement, such as changing a socket option, cancelling all pending asynchronous I/O, or closing the socket (perhaps by using [link beast.ref.boost__beast__close_socket `close_socket`]).
  1991. [heading Example]
  1992. ``` // Set non-blocking mode on a stack of stream
  1993. // layers with a regular socket at the lowest layer.
  1994. template <class Stream>
  1995. void set_non_blocking (Stream& stream)
  1996. {
  1997. error_code ec;
  1998. // A compile error here means your lowest layer is not the right type!
  1999. get_lowest_layer(stream).non_blocking(true, ec);
  2000. if(ec)
  2001. throw system_error{ec};
  2002. }
  2003. ```
  2004. [heading Parameters] [table [[Name][Description]] [[`t`][
  2005. The layer in a stack of layered objects for which the lowest layer is returned. ]] ]
  2006. [heading See Also]
  2007. [link beast.ref.boost__beast__close_socket `close_socket`], [link beast.ref.boost__beast__lowest_layer_type `lowest_layer_type`]
  2008. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__has_get_executor has_get_executor] [indexterm1 has_get_executor]
  2009. Determine if `T` has the `get_executor` member function. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class T> using has_get_executor = ``['see-below]``; ``` [heading Description]
  2010. Metafunctions are used to perform compile time checking of template types. This type will be `std::true_type` if `T` has the member function with the correct signature, else type will be `std::false_type`.
  2011. [heading Example]
  2012. Use with tag dispatching:
  2013. ``` template<class T>
  2014. void maybe_hello(T const& t, std::true_type)
  2015. {
  2016. net::post(
  2017. t.get_executor(),
  2018. []
  2019. {
  2020. std::cout << "Hello, world!" << std::endl;
  2021. });
  2022. }
  2023. template<class T>
  2024. void maybe_hello(T const&, std::false_type)
  2025. {
  2026. // T does not have get_executor
  2027. }
  2028. template<class T>
  2029. void maybe_hello(T const& t)
  2030. {
  2031. maybe_hello(t, has_get_executor<T>{});
  2032. }
  2033. ```
  2034. Use with `static_assert`:
  2035. ``` struct stream
  2036. {
  2037. using executor_type = net::io_context::executor_type;
  2038. executor_type get_executor() noexcept;
  2039. };
  2040. static_assert(has_get_executor<stream>::value, "Missing get_executor member");
  2041. ``` Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__http__async_read http::async_read] [indexterm1 http::async_read]
  2042. Read a complete message asynchronously from a stream using a parser. ``` template< class __AsyncReadStream__, class __DynamicBuffer__, bool isRequest, class __ReadHandler__ = net::default_completion_token_t< executor_type<AsyncReadStream>>> ``__deduced__`` ``[link beast.ref.boost__beast__http__async_read.overload1 async_read]``( AsyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser, ReadHandler&& handler = net::default_completion_token_t< executor_type< AsyncReadStream >>{}); ``[''''&raquo;''' [link beast.ref.boost__beast__http__async_read.overload1 more...]]`` ```
  2043. Read a complete message asynchronously from a stream. ``` template< class __AsyncReadStream__, class __DynamicBuffer__, bool isRequest, class __Body__, class __Allocator__, class __ReadHandler__ = net::default_completion_token_t< executor_type<AsyncReadStream>>> ``__deduced__`` ``[link beast.ref.boost__beast__http__async_read.overload2 async_read]``( AsyncReadStream& stream, DynamicBuffer& buffer, message< isRequest, Body, basic_fields< Allocator >>& msg, ReadHandler&& handler = net::default_completion_token_t< executor_type< AsyncReadStream >>{}); ``[''''&raquo;''' [link beast.ref.boost__beast__http__async_read.overload2 more...]]`` ``` [section:overload1 http::async_read (1 of 2 overloads)]
  2044. Read a complete message asynchronously from a stream using a parser. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __AsyncReadStream__, class __DynamicBuffer__, bool isRequest, class __ReadHandler__ = net::default_completion_token_t< executor_type<AsyncReadStream>>> ``__deduced__`` async_read( AsyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser, ReadHandler&& handler = net::default_completion_token_t< executor_type< AsyncReadStream >>{}); ``` [heading Description]
  2045. This function is used to asynchronously read a complete message from a stream into an instance of [link beast.ref.boost__beast__http__basic_parser `http::basic_parser`]. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2046. * [link beast.ref.boost__beast__http__basic_parser.is_done `http::basic_parser::is_done`] returns `true`
  2047. * An error occurs.
  2048. This operation is implemented in terms of zero or more calls to the next layer's `async_read_some` function, and is known as a ['composed operation]. The program must ensure that the stream performs no other reads until this operation completes. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  2049. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  2050. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  2051. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  2052. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  2053. [heading Parameters] [table [[Name][Description]] [[`stream`][
  2054. The stream from which the data is to be read. The type must meet the ['AsyncReadStream] requirements. ]] [[`buffer`][
  2055. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`parser`][
  2056. The parser to use. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`handler`][
  2057. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  2058. error_code const& error, // result of operation
  2059. std::size_t bytes_transferred // the total number of bytes transferred from the stream
  2060. );
  2061. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  2062. [heading Remarks]
  2063. The completion handler will receive as a parameter the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer. The implementation will call [link beast.ref.boost__beast__http__basic_parser.eager `http::basic_parser::eager`] with the value `true` on the parser passed in.
  2064. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::async_read (2 of 2 overloads)]
  2065. Read a complete message asynchronously from a stream. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __AsyncReadStream__, class __DynamicBuffer__, bool isRequest, class __Body__, class __Allocator__, class __ReadHandler__ = net::default_completion_token_t< executor_type<AsyncReadStream>>> ``__deduced__`` async_read( AsyncReadStream& stream, DynamicBuffer& buffer, message< isRequest, Body, basic_fields< Allocator >>& msg, ReadHandler&& handler = net::default_completion_token_t< executor_type< AsyncReadStream >>{}); ``` [heading Description]
  2066. This function is used to asynchronously read a complete message from a stream into an instance of [link beast.ref.boost__beast__http__message `http::message`]. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2067. * The entire message is read in.
  2068. * An error occurs.
  2069. This operation is implemented in terms of zero or more calls to the next layer's `async_read_some` function, and is known as a ['composed operation]. The program must ensure that the stream performs no other reads until this operation completes. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  2070. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  2071. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  2072. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  2073. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  2074. [heading Parameters] [table [[Name][Description]] [[`stream`][
  2075. The stream from which the data is to be read. The type must meet the ['AsyncReadStream] requirements. ]] [[`buffer`][
  2076. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`msg`][
  2077. The container in which to store the message contents. This message container should not have previous contents, otherwise the behavior is undefined. The type must be meet the ['MoveAssignable] and ['MoveConstructible] requirements. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`handler`][
  2078. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  2079. error_code const& error, // result of operation
  2080. std::size_t bytes_transferred // the total number of bytes transferred from the stream
  2081. );
  2082. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  2083. [heading Remarks]
  2084. The completion handler will receive as a parameter the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer. The implementation will call [link beast.ref.boost__beast__http__basic_parser.eager `http::basic_parser::eager`] with the value `true` on the parser passed in.
  2085. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__async_read_header http::async_read_header] [indexterm1 http::async_read_header]
  2086. Read a complete message header asynchronously from a stream using a parser. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __AsyncReadStream__, class __DynamicBuffer__, bool isRequest, class __ReadHandler__ = net::default_completion_token_t< executor_type<AsyncReadStream>>> ``__deduced__`` async_read_header( AsyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser, ReadHandler&& handler = net::default_completion_token_t< executor_type< AsyncReadStream >>{}); ``` [heading Description]
  2087. This function is used to asynchronously read a complete message header from a stream into an instance of [link beast.ref.boost__beast__http__basic_parser `http::basic_parser`]. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2088. * [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] returns `true`
  2089. * An error occurs.
  2090. This operation is implemented in terms of zero or more calls to the next layer's `async_read_some` function, and is known as a ['composed operation]. The program must ensure that the stream performs no other reads until this operation completes. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  2091. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  2092. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  2093. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  2094. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  2095. [heading Parameters] [table [[Name][Description]] [[`stream`][
  2096. The stream from which the data is to be read. The type must meet the ['AsyncReadStream] requirements. ]] [[`buffer`][
  2097. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`parser`][
  2098. The parser to use. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`handler`][
  2099. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  2100. error_code const& error, // result of operation
  2101. std::size_t bytes_transferred // the total number of bytes transferred from the stream
  2102. );
  2103. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  2104. [heading Remarks]
  2105. The completion handler will receive as a parameter the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer. The implementation will call [link beast.ref.boost__beast__http__basic_parser.eager `http::basic_parser::eager`] with the value `false` on the parser passed in.
  2106. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__async_read_some http::async_read_some] [indexterm1 http::async_read_some]
  2107. Read part of a message asynchronously from a stream using a parser. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __AsyncReadStream__, class __DynamicBuffer__, bool isRequest, class __ReadHandler__ = net::default_completion_token_t< executor_type<AsyncReadStream>>> ``__deduced__`` async_read_some( AsyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser, ReadHandler&& handler = net::default_completion_token_t< executor_type< AsyncReadStream >>{}); ``` [heading Description]
  2108. This function is used to asynchronously read part of a message from a stream into an instance of [link beast.ref.boost__beast__http__basic_parser `http::basic_parser`]. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2109. * A call to [link beast.ref.boost__beast__http__basic_parser.put `http::basic_parser::put`] with a non-empty buffer sequence is successful.
  2110. * An error occurs.
  2111. This operation is implemented in terms of zero or more calls to the next layer's `async_read_some` function, and is known as a ['composed operation]. The program must ensure that the stream performs no other reads until this operation completes. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  2112. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  2113. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  2114. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  2115. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  2116. [heading Parameters] [table [[Name][Description]] [[`stream`][
  2117. The stream from which the data is to be read. The type must meet the ['AsyncReadStream] requirements. ]] [[`buffer`][
  2118. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`parser`][
  2119. The parser to use. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`handler`][
  2120. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  2121. error_code const& error, // result of operation
  2122. std::size_t bytes_transferred // the total number of bytes transferred from the stream
  2123. );
  2124. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  2125. [heading Remarks]
  2126. The completion handler will receive as a parameter the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer.
  2127. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__async_write http::async_write] [indexterm1 http::async_write]
  2128. Write a complete message to a stream asynchronously using a serializer. ``` template< class __AsyncWriteStream__, bool isRequest, class __Body__, class __Fields__, class __WriteHandler__ = net::default_completion_token_t< executor_type<AsyncWriteStream>>> ``__deduced__`` ``[link beast.ref.boost__beast__http__async_write.overload1 async_write]``( AsyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr, WriteHandler&& handler = net::default_completion_token_t< executor_type< AsyncWriteStream >>{}); ``[''''&raquo;''' [link beast.ref.boost__beast__http__async_write.overload1 more...]]`` ```
  2129. Write a complete message to a stream asynchronously. ``` template< class __AsyncWriteStream__, bool isRequest, class __Body__, class __Fields__, class __WriteHandler__ = net::default_completion_token_t< executor_type<AsyncWriteStream>>> ``__deduced__`` ``[link beast.ref.boost__beast__http__async_write.overload2 async_write]``( AsyncWriteStream& stream, message< isRequest, Body, Fields >& msg, WriteHandler&& handler = net::default_completion_token_t< executor_type< AsyncWriteStream >>{}); ``[''''&raquo;''' [link beast.ref.boost__beast__http__async_write.overload2 more...]]`` template< class __AsyncWriteStream__, bool isRequest, class __Body__, class __Fields__, class __WriteHandler__ = net::default_completion_token_t< executor_type<AsyncWriteStream>>> ``__deduced__`` ``[link beast.ref.boost__beast__http__async_write.overload3 async_write]``( AsyncWriteStream& stream, message< isRequest, Body, Fields > const& msg, WriteHandler&& handler = net::default_completion_token_t< executor_type< AsyncWriteStream >>{}); ``[''''&raquo;''' [link beast.ref.boost__beast__http__async_write.overload3 more...]]`` ``` [section:overload1 http::async_write (1 of 3 overloads)]
  2130. Write a complete message to a stream asynchronously using a serializer. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __AsyncWriteStream__, bool isRequest, class __Body__, class __Fields__, class __WriteHandler__ = net::default_completion_token_t< executor_type<AsyncWriteStream>>> ``__deduced__`` async_write( AsyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr, WriteHandler&& handler = net::default_completion_token_t< executor_type< AsyncWriteStream >>{}); ``` [heading Description]
  2131. This function is used to write a complete message to a stream asynchronously using a caller-provided HTTP/1 serializer. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2132. * The function [link beast.ref.boost__beast__http__serializer.is_done `http::serializer::is_done`] returns `true`
  2133. * An error occurs.
  2134. This operation is implemented in terms of zero or more calls to the stream's `async_write_some` function, and is known as a ['composed operation]. The program must ensure that the stream performs no other writes until this operation completes.
  2135. [heading Parameters] [table [[Name][Description]] [[`stream`][
  2136. The stream to which the data is to be written. The type must support the ['AsyncWriteStream] concept. ]] [[`sr`][
  2137. The serializer to use. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`handler`][
  2138. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  2139. error_code const& error, // result of operation
  2140. std::size_t bytes_transferred // the number of bytes written to the stream
  2141. );
  2142. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  2143. [heading See Also]
  2144. [link beast.ref.boost__beast__http__serializer `http::serializer`]
  2145. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::async_write (2 of 3 overloads)]
  2146. Write a complete message to a stream asynchronously. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __AsyncWriteStream__, bool isRequest, class __Body__, class __Fields__, class __WriteHandler__ = net::default_completion_token_t< executor_type<AsyncWriteStream>>> ``__deduced__`` async_write( AsyncWriteStream& stream, message< isRequest, Body, Fields >& msg, WriteHandler&& handler = net::default_completion_token_t< executor_type< AsyncWriteStream >>{}); ``` [heading Description]
  2147. This function is used to write a complete message to a stream asynchronously using HTTP/1. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2148. * The entire message is written.
  2149. * An error occurs.
  2150. This operation is implemented in terms of zero or more calls to the stream's `async_write_some` function, and is known as a ['composed operation]. The program must ensure that the stream performs no other writes until this operation completes. The algorithm will use a temporary [link beast.ref.boost__beast__http__serializer `http::serializer`] with an empty chunk decorator to produce buffers.
  2151. [heading Remarks]
  2152. This function only participates in overload resolution if [link beast.ref.boost__beast__http__is_mutable_body_writer `http::is_mutable_body_writer`] for ['Body] returns `true`.
  2153. [heading Parameters] [table [[Name][Description]] [[`stream`][
  2154. The stream to which the data is to be written. The type must support the ['AsyncWriteStream] concept. ]] [[`msg`][
  2155. The message to write. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`handler`][
  2156. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  2157. error_code const& error, // result of operation
  2158. std::size_t bytes_transferred // the number of bytes written to the stream
  2159. );
  2160. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  2161. [heading See Also]
  2162. [link beast.ref.boost__beast__http__message `http::message`]
  2163. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload3 http::async_write (3 of 3 overloads)]
  2164. Write a complete message to a stream asynchronously. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __AsyncWriteStream__, bool isRequest, class __Body__, class __Fields__, class __WriteHandler__ = net::default_completion_token_t< executor_type<AsyncWriteStream>>> ``__deduced__`` async_write( AsyncWriteStream& stream, message< isRequest, Body, Fields > const& msg, WriteHandler&& handler = net::default_completion_token_t< executor_type< AsyncWriteStream >>{}); ``` [heading Description]
  2165. This function is used to write a complete message to a stream asynchronously using HTTP/1. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2166. * The entire message is written.
  2167. * An error occurs.
  2168. This operation is implemented in terms of zero or more calls to the stream's `async_write_some` function, and is known as a ['composed operation]. The program must ensure that the stream performs no other writes until this operation completes. The algorithm will use a temporary [link beast.ref.boost__beast__http__serializer `http::serializer`] with an empty chunk decorator to produce buffers.
  2169. [heading Remarks]
  2170. This function only participates in overload resolution if [link beast.ref.boost__beast__http__is_mutable_body_writer `http::is_mutable_body_writer`] for ['Body] returns `false`.
  2171. [heading Parameters] [table [[Name][Description]] [[`stream`][
  2172. The stream to which the data is to be written. The type must support the ['AsyncWriteStream] concept. ]] [[`msg`][
  2173. The message to write. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`handler`][
  2174. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  2175. error_code const& error, // result of operation
  2176. std::size_t bytes_transferred // the number of bytes written to the stream
  2177. );
  2178. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  2179. [heading See Also]
  2180. [link beast.ref.boost__beast__http__message `http::message`]
  2181. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__async_write_header http::async_write_header] [indexterm1 http::async_write_header]
  2182. Write a header to a stream asynchronously using a serializer. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __AsyncWriteStream__, bool isRequest, class __Body__, class __Fields__, class __WriteHandler__ = net::default_completion_token_t< executor_type<AsyncWriteStream>>> ``__deduced__`` async_write_header( AsyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr, WriteHandler&& handler = net::default_completion_token_t< executor_type< AsyncWriteStream >>{}); ``` [heading Description]
  2183. This function is used to write a header to a stream asynchronously using a caller-provided HTTP/1 serializer. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2184. * The function [link beast.ref.boost__beast__http__serializer.is_header_done `http::serializer::is_header_done`] returns `true`
  2185. * An error occurs.
  2186. This operation is implemented in terms of zero or more calls to the stream's `async_write_some` function, and is known as a ['composed operation]. The program must ensure that the stream performs no other writes until this operation completes.
  2187. [heading Parameters] [table [[Name][Description]] [[`stream`][
  2188. The stream to which the data is to be written. The type must support the ['AsyncWriteStream] concept. ]] [[`sr`][
  2189. The serializer to use. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`handler`][
  2190. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  2191. error_code const& error, // result of operation
  2192. std::size_t bytes_transferred // the number of bytes written to the stream
  2193. );
  2194. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  2195. [heading Remarks]
  2196. The implementation will call [link beast.ref.boost__beast__http__serializer.split `http::serializer::split`] with the value `true` on the serializer passed in.
  2197. [heading See Also]
  2198. [link beast.ref.boost__beast__http__serializer `http::serializer`]
  2199. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__async_write_some http::async_write_some] [indexterm1 http::async_write_some]
  2200. Write part of a message to a stream asynchronously using a serializer. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __AsyncWriteStream__, bool isRequest, class __Body__, class __Fields__, class __WriteHandler__ = net::default_completion_token_t< executor_type<AsyncWriteStream>>> ``__deduced__`` async_write_some( AsyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr, WriteHandler&& handler = net::default_completion_token_t< executor_type< AsyncWriteStream >>{}); ``` [heading Description]
  2201. This function is used to write part of a message to a stream asynchronously using a caller-provided HTTP/1 serializer. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2202. * One or more bytes have been transferred.
  2203. * The function [link beast.ref.boost__beast__http__serializer.is_done `http::serializer::is_done`] returns `true`
  2204. * An error occurs on the stream.
  2205. This operation is implemented in terms of zero or more calls to the stream's `async_write_some` function, and is known as a ['composed operation]. The program must ensure that the stream performs no other writes until this operation completes.
  2206. The amount of data actually transferred is controlled by the behavior of the underlying stream, subject to the buffer size limit of the serializer obtained or set through a call to [link beast.ref.boost__beast__http__serializer.limit `http::serializer::limit`]. Setting a limit and performing bounded work helps applications set reasonable timeouts. It also allows application-level flow control to function correctly. For example when using a TCP/IP based stream.
  2207. [heading Parameters] [table [[Name][Description]] [[`stream`][
  2208. The stream to which the data is to be written. The type must support the ['AsyncWriteStream] concept. ]] [[`sr`][
  2209. The serializer to use. The object must remain valid at least until the handler is called; ownership is not transferred. ]] [[`handler`][
  2210. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  2211. error_code const& error, // result of operation
  2212. std::size_t bytes_transferred // the number of bytes written to the stream
  2213. );
  2214. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  2215. [heading See Also]
  2216. [link beast.ref.boost__beast__http__serializer `http::serializer`]
  2217. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__basic_chunk_extensions http::basic_chunk_extensions]
  2218. A set of chunk extensions. [heading Synopsis] Defined in header [include_file boost/beast/http/chunk_encode.hpp] ``` template< class __Allocator__> class basic_chunk_extensions ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.value_type [*value_type]]] [ The type of value when iterating. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.basic_chunk_extensions [*basic_chunk_extensions]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.begin [*begin]]] [ ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.clear [*clear]]] [ Clear the chunk extensions. ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.end [*end]]] [ ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.insert [*insert]]] [ Insert an extension name with an empty value. Insert an extension value. ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.parse [*parse]]] [ Parse a set of chunk extensions. ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.str [*str]]] [ Return the serialized representation of the chunk extension. ] ] ] [heading Description]
  2219. This container stores a set of chunk extensions suited for use with [link beast.ref.boost__beast__http__chunk_header `http::chunk_header`] and [link beast.ref.boost__beast__http__chunk_body `http::chunk_body`]. The container may be iterated to access the extensions in their structured form.
  2220. Meets the requirements of ChunkExtensions [section:basic_chunk_extensions http::basic_chunk_extensions::basic_chunk_extensions] [indexterm2 basic_chunk_extensions..http::basic_chunk_extensions]
  2221. Constructor. ``` ``[link beast.ref.boost__beast__http__basic_chunk_extensions.basic_chunk_extensions.overload1 basic_chunk_extensions]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_chunk_extensions.basic_chunk_extensions.overload1 more...]]`` ``[link beast.ref.boost__beast__http__basic_chunk_extensions.basic_chunk_extensions.overload2 basic_chunk_extensions]``( basic_chunk_extensions&&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_chunk_extensions.basic_chunk_extensions.overload2 more...]]`` ``[link beast.ref.boost__beast__http__basic_chunk_extensions.basic_chunk_extensions.overload3 basic_chunk_extensions]``( basic_chunk_extensions const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_chunk_extensions.basic_chunk_extensions.overload3 more...]]`` explicit ``[link beast.ref.boost__beast__http__basic_chunk_extensions.basic_chunk_extensions.overload4 basic_chunk_extensions]``( Allocator const& allocator); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_chunk_extensions.basic_chunk_extensions.overload4 more...]]`` ``` [section:overload1 http::basic_chunk_extensions::basic_chunk_extensions (1 of 4 overloads)]
  2222. Constructor. [heading Synopsis] ``` basic_chunk_extensions(); ``` [heading Description] [endsect] [section:overload2 http::basic_chunk_extensions::basic_chunk_extensions (2 of 4 overloads)]
  2223. Constructor. [heading Synopsis] ``` basic_chunk_extensions( basic_chunk_extensions&&); ``` [heading Description] [endsect] [section:overload3 http::basic_chunk_extensions::basic_chunk_extensions (3 of 4 overloads)]
  2224. Constructor. [heading Synopsis] ``` basic_chunk_extensions( basic_chunk_extensions const&); ``` [heading Description] [endsect] [section:overload4 http::basic_chunk_extensions::basic_chunk_extensions (4 of 4 overloads)]
  2225. Constructor. [heading Synopsis] ``` basic_chunk_extensions( Allocator const& allocator); ``` [heading Description]
  2226. [heading Parameters] [table [[Name][Description]] [[`allocator`][
  2227. The allocator to use for storing the serialized extension ]] ]
  2228. [endsect] [endsect] [section:begin http::basic_chunk_extensions::begin] [indexterm2 begin..http::basic_chunk_extensions] [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:clear http::basic_chunk_extensions::clear] [indexterm2 clear..http::basic_chunk_extensions]
  2229. Clear the chunk extensions. [heading Synopsis] ``` void clear(); ``` [heading Description]
  2230. This preserves the capacity of the internal string used to hold the serialized representation. [endsect] [section:end http::basic_chunk_extensions::end] [indexterm2 end..http::basic_chunk_extensions] [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:insert http::basic_chunk_extensions::insert] [indexterm2 insert..http::basic_chunk_extensions]
  2231. Insert an extension name with an empty value. ``` void ``[link beast.ref.boost__beast__http__basic_chunk_extensions.insert.overload1 insert]``( string_view name); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_chunk_extensions.insert.overload1 more...]]`` ```
  2232. Insert an extension value. ``` void ``[link beast.ref.boost__beast__http__basic_chunk_extensions.insert.overload2 insert]``( string_view name, string_view value); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_chunk_extensions.insert.overload2 more...]]`` ``` [section:overload1 http::basic_chunk_extensions::insert (1 of 2 overloads)]
  2233. Insert an extension name with an empty value. [heading Synopsis] ``` void insert( string_view name); ``` [heading Description]
  2234. [heading Parameters] [table [[Name][Description]] [[`name`][
  2235. The name of the extension ]] ]
  2236. [endsect] [section:overload2 http::basic_chunk_extensions::insert (2 of 2 overloads)]
  2237. Insert an extension value. [heading Synopsis] ``` void insert( string_view name, string_view value); ``` [heading Description]
  2238. [heading Parameters] [table [[Name][Description]] [[`name`][
  2239. The name of the extension ]] [[`value`][
  2240. The value to insert. Depending on the contents, the serialized extension may use a quoted string. ]] ]
  2241. [endsect] [endsect] [section:parse http::basic_chunk_extensions::parse] [indexterm2 parse..http::basic_chunk_extensions]
  2242. Parse a set of chunk extensions. [heading Synopsis] ``` void parse( string_view s, error_code& ec); ``` [heading Description]
  2243. Any previous extensions will be cleared [endsect] [section:str http::basic_chunk_extensions::str] [indexterm2 str..http::basic_chunk_extensions]
  2244. Return the serialized representation of the chunk extension. [heading Synopsis] ``` string_view str() const; ``` [heading Description] [endsect] [section:value_type http::basic_chunk_extensions::value_type] [indexterm2 value_type..http::basic_chunk_extensions]
  2245. The type of value when iterating. [heading Synopsis] ``` using value_type = std::pair< string_view, string_view >; ``` [heading Description]
  2246. The first element of the pair is the name, and the second element is the value which may be empty. The value is stored in its raw representation, without quotes or escapes. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__basic_dynamic_body http::basic_dynamic_body]
  2247. A ['Body] using a ['DynamicBuffer] [heading Synopsis] Defined in header [include_file boost/beast/http/basic_dynamic_body.hpp] ``` template< class __DynamicBuffer__> struct basic_dynamic_body ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_dynamic_body.reader [*reader]]] [ The algorithm for parsing the body. ] ] [ [[link beast.ref.boost__beast__http__basic_dynamic_body.value_type [*value_type]]] [ The type of container used for the body. ] ] [ [[link beast.ref.boost__beast__http__basic_dynamic_body.writer [*writer]]] [ The algorithm for serializing the body. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_dynamic_body.size [*size]]] [ Returns the payload size of the body. ] ] ] [heading Description]
  2248. This body uses a ['DynamicBuffer] as a memory-based container for holding message payloads. Messages using this body type may be serialized and parsed. [section:reader http::basic_dynamic_body::reader] [indexterm2 reader..http::basic_dynamic_body]
  2249. The algorithm for parsing the body. [heading Synopsis] ``` using reader = ``['implementation-defined]``; ``` [heading Description]
  2250. Meets the requirements of ['BodyReader]. [endsect] [section:size http::basic_dynamic_body::size] [indexterm2 size..http::basic_dynamic_body]
  2251. Returns the payload size of the body. [heading Synopsis] ``` static std::uint64_t size( value_type const& v); ``` [heading Description]
  2252. When this body is used with [link beast.ref.boost__beast__http__message.prepare_payload `http::message::prepare_payload`], the Content-Length will be set to the payload size, and any chunked Transfer-Encoding will be removed. [endsect] [section:value_type http::basic_dynamic_body::value_type] [indexterm2 value_type..http::basic_dynamic_body]
  2253. The type of container used for the body. [heading Synopsis] ``` using value_type = DynamicBuffer; ``` [heading Description]
  2254. This determines the type of [link beast.ref.boost__beast__http__message.body `http::message::body`] when this body type is used with a message container. [endsect] [section:writer http::basic_dynamic_body::writer] [indexterm2 writer..http::basic_dynamic_body]
  2255. The algorithm for serializing the body. [heading Synopsis] ``` using writer = ``['implementation-defined]``; ``` [heading Description]
  2256. Meets the requirements of ['BodyWriter]. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__basic_fields http::basic_fields]
  2257. A container for storing HTTP header fields. [heading Synopsis] Defined in header [include_file boost/beast/http/fields.hpp] ``` template< class __Allocator__> class basic_fields ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_fields.allocator_type [*allocator_type]]] [ The type of allocator used. ] ] [ [[link beast.ref.boost__beast__http__basic_fields__value_type [*value_type]]] [ The type of element used to represent a field. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.const_iterator [*const_iterator]]] [ A constant iterator to the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.iterator [*iterator]]] [ A constant iterator to the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.key_compare [*key_compare]]] [ A strictly less predicate for comparing keys, using a case-insensitive comparison. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.writer [*writer]]] [ The algorithm used to serialize the header. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_fields.at [*at]]] [ Returns the value for a field, or throws an exception. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.basic_fields [*basic_fields]]] [ Constructor. Move constructor. Copy constructor. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.begin [*begin]]] [ Return a const iterator to the beginning of the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.cbegin [*cbegin]]] [ Return a const iterator to the beginning of the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.cend [*cend]]] [ Return a const iterator to the end of the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.clear [*clear]]] [ Remove all fields from the container. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.count [*count]]] [ Return the number of fields with the specified name. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.end [*end]]] [ Return a const iterator to the end of the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.equal_range [*equal_range]]] [ Returns a range of iterators to the fields with the specified name. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.erase [*erase]]] [ Remove a field. Remove all fields with the specified name. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.find [*find]]] [ Returns an iterator to the case-insensitive matching field. Returns an iterator to the case-insensitive matching field name. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.get_allocator [*get_allocator]]] [ Return a copy of the allocator associated with the container. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.insert [*insert]]] [ Insert a field. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.key_comp [*key_comp]]] [ Returns a copy of the key comparison function. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.operator_eq_ [*operator=]]] [ Move assignment. Copy assignment. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.operator_lb__rb_ [*operator\[\]]]] [ Returns the value for a field, or "" if it does not exist. Returns the value for a case-insensitive matching header, or "" if it does not exist. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set [*set]]] [ Set a field value, removing any other instances of that field. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.swap [*swap]]] [ Return a buffer sequence representing the trailers. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.basic_fields_dtor_ [*~basic_fields]]] [ Destructor. ] ] ] [heading Protected Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_fields.get_chunked_impl [*get_chunked_impl]]] [ Returns the chunked Transfer-Encoding setting. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.get_keep_alive_impl [*get_keep_alive_impl]]] [ Returns the keep-alive setting. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.get_method_impl [*get_method_impl]]] [ Returns the request-method string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.get_reason_impl [*get_reason_impl]]] [ Returns the response reason-phrase string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.get_target_impl [*get_target_impl]]] [ Returns the request-target string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.has_content_length_impl [*has_content_length_impl]]] [ Returns true if the Content-Length field is present. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_chunked_impl [*set_chunked_impl]]] [ Adjusts the chunked Transfer-Encoding value. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_content_length_impl [*set_content_length_impl]]] [ Sets or clears the Content-Length field. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_keep_alive_impl [*set_keep_alive_impl]]] [ Adjusts the Connection field. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_method_impl [*set_method_impl]]] [ Set or clear the method string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_reason_impl [*set_reason_impl]]] [ Set or clear the reason string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_target_impl [*set_target_impl]]] [ Set or clear the target string. ] ] ] [heading Friends] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_fields.swap [*swap]]] [ Swap two field containers. ] ] ] [heading Description]
  2258. This container is designed to store the field value pairs that make up the fields and trailers in an HTTP message. Objects of this type are iterable, with each element holding the field name and field value.
  2259. Field names are stored as-is, but comparisons are case-insensitive. The container behaves as a `std::multiset`; there will be a separate value for each occurrence of the same field name. When the container is iterated the fields are presented in the order of insertion, with fields having the same name following each other consecutively.
  2260. Meets the requirements of ['Fields]
  2261. [heading Template Parameters] [table [[Type][Description]] [[`Allocator`][
  2262. The allocator to use. ]] ]
  2263. [section:allocator_type http::basic_fields::allocator_type] [indexterm2 allocator_type..http::basic_fields]
  2264. The type of allocator used. [heading Synopsis] ``` using allocator_type = Allocator; ``` [heading Description] [endsect] [section:at http::basic_fields::at] [indexterm2 at..http::basic_fields]
  2265. Returns the value for a field, or throws an exception. ``` string_view const ``[link beast.ref.boost__beast__http__basic_fields.at.overload1 at]``( field name) const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.at.overload1 more...]]`` string_view const ``[link beast.ref.boost__beast__http__basic_fields.at.overload2 at]``( string_view name) const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.at.overload2 more...]]`` ``` [section:overload1 http::basic_fields::at (1 of 2 overloads)]
  2266. Returns the value for a field, or throws an exception. [heading Synopsis] ``` string_view const at( field name) const; ``` [heading Description]
  2267. If more than one field with the specified name exists, the first field defined by insertion order is returned.
  2268. [heading Parameters] [table [[Name][Description]] [[`name`][
  2269. The name of the field. ]] ]
  2270. [heading Return Value]
  2271. The field value.
  2272. [heading Exceptions] [table [[Type][Thrown On]] [[`std::out_of_range`][
  2273. if the field is not found. ]] ]
  2274. [endsect] [section:overload2 http::basic_fields::at (2 of 2 overloads)]
  2275. Returns the value for a field, or throws an exception. [heading Synopsis] ``` string_view const at( string_view name) const; ``` [heading Description]
  2276. If more than one field with the specified name exists, the first field defined by insertion order is returned.
  2277. [heading Parameters] [table [[Name][Description]] [[`name`][
  2278. The name of the field. ]] ]
  2279. [heading Return Value]
  2280. The field value.
  2281. [heading Exceptions] [table [[Type][Thrown On]] [[`std::out_of_range`][
  2282. if the field is not found. ]] ]
  2283. [endsect] [endsect] [section:basic_fields http::basic_fields::basic_fields] [indexterm2 basic_fields..http::basic_fields]
  2284. Constructor. ``` ``[link beast.ref.boost__beast__http__basic_fields.basic_fields.overload1 basic_fields]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.basic_fields.overload1 more...]]`` explicit ``[link beast.ref.boost__beast__http__basic_fields.basic_fields.overload2 basic_fields]``( Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.basic_fields.overload2 more...]]`` ```
  2285. Move constructor. ``` ``[link beast.ref.boost__beast__http__basic_fields.basic_fields.overload3 basic_fields]``( basic_fields&&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.basic_fields.overload3 more...]]`` ``[link beast.ref.boost__beast__http__basic_fields.basic_fields.overload4 basic_fields]``( basic_fields&&, Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.basic_fields.overload4 more...]]`` ```
  2286. Copy constructor. ``` ``[link beast.ref.boost__beast__http__basic_fields.basic_fields.overload5 basic_fields]``( basic_fields const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.basic_fields.overload5 more...]]`` ``[link beast.ref.boost__beast__http__basic_fields.basic_fields.overload6 basic_fields]``( basic_fields const&, Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.basic_fields.overload6 more...]]`` template< class OtherAlloc> ``[link beast.ref.boost__beast__http__basic_fields.basic_fields.overload7 basic_fields]``( basic_fields< OtherAlloc > const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.basic_fields.overload7 more...]]`` template< class OtherAlloc> ``[link beast.ref.boost__beast__http__basic_fields.basic_fields.overload8 basic_fields]``( basic_fields< OtherAlloc > const&, Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.basic_fields.overload8 more...]]`` ``` [section:overload1 http::basic_fields::basic_fields (1 of 8 overloads)]
  2287. Constructor. [heading Synopsis] ``` basic_fields(); ``` [heading Description] [endsect] [section:overload2 http::basic_fields::basic_fields (2 of 8 overloads)]
  2288. Constructor. [heading Synopsis] ``` basic_fields( Allocator const& alloc); ``` [heading Description]
  2289. [heading Parameters] [table [[Name][Description]] [[`alloc`][
  2290. The allocator to use. ]] ]
  2291. [endsect] [section:overload3 http::basic_fields::basic_fields (3 of 8 overloads)]
  2292. Move constructor. [heading Synopsis] ``` basic_fields( basic_fields&&); ``` [heading Description]
  2293. The state of the moved-from object is as if constructed using the same allocator. [endsect] [section:overload4 http::basic_fields::basic_fields (4 of 8 overloads)]
  2294. Move constructor. [heading Synopsis] ``` basic_fields( basic_fields&&, Allocator const& alloc); ``` [heading Description]
  2295. The state of the moved-from object is as if constructed using the same allocator.
  2296. [heading Parameters] [table [[Name][Description]] [[`alloc`][
  2297. The allocator to use. ]] ]
  2298. [endsect] [section:overload5 http::basic_fields::basic_fields (5 of 8 overloads)]
  2299. Copy constructor. [heading Synopsis] ``` basic_fields( basic_fields const&); ``` [heading Description] [endsect] [section:overload6 http::basic_fields::basic_fields (6 of 8 overloads)]
  2300. Copy constructor. [heading Synopsis] ``` basic_fields( basic_fields const&, Allocator const& alloc); ``` [heading Description]
  2301. [heading Parameters] [table [[Name][Description]] [[`alloc`][
  2302. The allocator to use. ]] ]
  2303. [endsect] [section:overload7 http::basic_fields::basic_fields (7 of 8 overloads)]
  2304. Copy constructor. [heading Synopsis] ``` template< class OtherAlloc> basic_fields( basic_fields< OtherAlloc > const&); ``` [heading Description] [endsect] [section:overload8 http::basic_fields::basic_fields (8 of 8 overloads)]
  2305. Copy constructor. [heading Synopsis] ``` template< class OtherAlloc> basic_fields( basic_fields< OtherAlloc > const&, Allocator const& alloc); ``` [heading Description]
  2306. [heading Parameters] [table [[Name][Description]] [[`alloc`][
  2307. The allocator to use. ]] ]
  2308. [endsect] [endsect] [section:begin http::basic_fields::begin] [indexterm2 begin..http::basic_fields]
  2309. Return a const iterator to the beginning of the field sequence. [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:cbegin http::basic_fields::cbegin] [indexterm2 cbegin..http::basic_fields]
  2310. Return a const iterator to the beginning of the field sequence. [heading Synopsis] ``` const_iterator cbegin() const; ``` [heading Description] [endsect] [section:cend http::basic_fields::cend] [indexterm2 cend..http::basic_fields]
  2311. Return a const iterator to the end of the field sequence. [heading Synopsis] ``` const_iterator cend() const; ``` [heading Description] [endsect] [section:clear http::basic_fields::clear] [indexterm2 clear..http::basic_fields]
  2312. Remove all fields from the container. [heading Synopsis] ``` void clear(); ``` [heading Description]
  2313. All references, pointers, or iterators referring to contained elements are invalidated. All past-the-end iterators are also invalidated.
  2314. [heading Postconditions:]
  2315. ``` std::distance(this->begin(), this->end()) == 0
  2316. ```
  2317. [endsect] [section:const_iterator http::basic_fields::const_iterator] [indexterm2 const_iterator..http::basic_fields]
  2318. A constant iterator to the field sequence. [heading Synopsis] ``` using const_iterator = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:count http::basic_fields::count] [indexterm2 count..http::basic_fields]
  2319. Return the number of fields with the specified name. ``` std::size_t ``[link beast.ref.boost__beast__http__basic_fields.count.overload1 count]``( field name) const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.count.overload1 more...]]`` std::size_t ``[link beast.ref.boost__beast__http__basic_fields.count.overload2 count]``( string_view name) const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.count.overload2 more...]]`` ``` [section:overload1 http::basic_fields::count (1 of 2 overloads)]
  2320. Return the number of fields with the specified name. [heading Synopsis] ``` std::size_t count( field name) const; ``` [heading Description]
  2321. [heading Parameters] [table [[Name][Description]] [[`name`][
  2322. The field name. ]] ]
  2323. [endsect] [section:overload2 http::basic_fields::count (2 of 2 overloads)]
  2324. Return the number of fields with the specified name. [heading Synopsis] ``` std::size_t count( string_view name) const; ``` [heading Description]
  2325. [heading Parameters] [table [[Name][Description]] [[`name`][
  2326. The field name. ]] ]
  2327. [endsect] [endsect] [section:end http::basic_fields::end] [indexterm2 end..http::basic_fields]
  2328. Return a const iterator to the end of the field sequence. [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:equal_range http::basic_fields::equal_range] [indexterm2 equal_range..http::basic_fields]
  2329. Returns a range of iterators to the fields with the specified name. ``` std::pair< const_iterator, const_iterator > ``[link beast.ref.boost__beast__http__basic_fields.equal_range.overload1 equal_range]``( field name) const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.equal_range.overload1 more...]]`` std::pair< const_iterator, const_iterator > ``[link beast.ref.boost__beast__http__basic_fields.equal_range.overload2 equal_range]``( string_view name) const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.equal_range.overload2 more...]]`` ``` [section:overload1 http::basic_fields::equal_range (1 of 2 overloads)]
  2330. Returns a range of iterators to the fields with the specified name. [heading Synopsis] ``` std::pair< const_iterator, const_iterator > equal_range( field name) const; ``` [heading Description]
  2331. [heading Parameters] [table [[Name][Description]] [[`name`][
  2332. The field name. ]] ]
  2333. [heading Return Value]
  2334. A range of iterators to fields with the same name, otherwise an empty range.
  2335. [endsect] [section:overload2 http::basic_fields::equal_range (2 of 2 overloads)]
  2336. Returns a range of iterators to the fields with the specified name. [heading Synopsis] ``` std::pair< const_iterator, const_iterator > equal_range( string_view name) const; ``` [heading Description]
  2337. [heading Parameters] [table [[Name][Description]] [[`name`][
  2338. The field name. ]] ]
  2339. [heading Return Value]
  2340. A range of iterators to fields with the same name, otherwise an empty range.
  2341. [endsect] [endsect] [section:erase http::basic_fields::erase] [indexterm2 erase..http::basic_fields]
  2342. Remove a field. ``` const_iterator ``[link beast.ref.boost__beast__http__basic_fields.erase.overload1 erase]``( const_iterator pos); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.erase.overload1 more...]]`` ```
  2343. Remove all fields with the specified name. ``` std::size_t ``[link beast.ref.boost__beast__http__basic_fields.erase.overload2 erase]``( field name); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.erase.overload2 more...]]`` std::size_t ``[link beast.ref.boost__beast__http__basic_fields.erase.overload3 erase]``( string_view name); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.erase.overload3 more...]]`` ``` [section:overload1 http::basic_fields::erase (1 of 3 overloads)]
  2344. Remove a field. [heading Synopsis] ``` const_iterator erase( const_iterator pos); ``` [heading Description]
  2345. References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
  2346. [heading Parameters] [table [[Name][Description]] [[`pos`][
  2347. An iterator to the element to remove. ]] ]
  2348. [heading Return Value]
  2349. An iterator following the last removed element. If the iterator refers to the last element, the [link beast.ref.boost__beast__http__basic_fields.end `http::basic_fields::end()`] iterator is returned.
  2350. [endsect] [section:overload2 http::basic_fields::erase (2 of 3 overloads)]
  2351. Remove all fields with the specified name. [heading Synopsis] ``` std::size_t erase( field name); ``` [heading Description]
  2352. All fields with the same field name are erased from the container. References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
  2353. [heading Parameters] [table [[Name][Description]] [[`name`][
  2354. The field name. ]] ]
  2355. [heading Return Value]
  2356. The number of fields removed.
  2357. [endsect] [section:overload3 http::basic_fields::erase (3 of 3 overloads)]
  2358. Remove all fields with the specified name. [heading Synopsis] ``` std::size_t erase( string_view name); ``` [heading Description]
  2359. All fields with the same field name are erased from the container. References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
  2360. [heading Parameters] [table [[Name][Description]] [[`name`][
  2361. The field name. ]] ]
  2362. [heading Return Value]
  2363. The number of fields removed.
  2364. [endsect] [endsect] [section:find http::basic_fields::find] [indexterm2 find..http::basic_fields]
  2365. Returns an iterator to the case-insensitive matching field. ``` const_iterator ``[link beast.ref.boost__beast__http__basic_fields.find.overload1 find]``( field name) const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.find.overload1 more...]]`` ```
  2366. Returns an iterator to the case-insensitive matching field name. ``` const_iterator ``[link beast.ref.boost__beast__http__basic_fields.find.overload2 find]``( string_view name) const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.find.overload2 more...]]`` ``` [section:overload1 http::basic_fields::find (1 of 2 overloads)]
  2367. Returns an iterator to the case-insensitive matching field. [heading Synopsis] ``` const_iterator find( field name) const; ``` [heading Description]
  2368. If more than one field with the specified name exists, the first field defined by insertion order is returned.
  2369. [heading Parameters] [table [[Name][Description]] [[`name`][
  2370. The field name. ]] ]
  2371. [heading Return Value]
  2372. An iterator to the matching field, or `end()` if no match was found.
  2373. [endsect] [section:overload2 http::basic_fields::find (2 of 2 overloads)]
  2374. Returns an iterator to the case-insensitive matching field name. [heading Synopsis] ``` const_iterator find( string_view name) const; ``` [heading Description]
  2375. If more than one field with the specified name exists, the first field defined by insertion order is returned.
  2376. [heading Parameters] [table [[Name][Description]] [[`name`][
  2377. The field name. ]] ]
  2378. [heading Return Value]
  2379. An iterator to the matching field, or `end()` if no match was found.
  2380. [endsect] [endsect] [section:get_allocator http::basic_fields::get_allocator] [indexterm2 get_allocator..http::basic_fields]
  2381. Return a copy of the allocator associated with the container. [heading Synopsis] ``` allocator_type get_allocator() const; ``` [heading Description] [endsect] [section:get_chunked_impl http::basic_fields::get_chunked_impl] [indexterm2 get_chunked_impl..http::basic_fields]
  2382. Returns the chunked Transfer-Encoding setting. [heading Synopsis] ``` bool get_chunked_impl() const; ``` [heading Description] [endsect] [section:get_keep_alive_impl http::basic_fields::get_keep_alive_impl] [indexterm2 get_keep_alive_impl..http::basic_fields]
  2383. Returns the keep-alive setting. [heading Synopsis] ``` bool get_keep_alive_impl( unsigned version) const; ``` [heading Description] [endsect] [section:get_method_impl http::basic_fields::get_method_impl] [indexterm2 get_method_impl..http::basic_fields]
  2384. Returns the request-method string. [heading Synopsis] ``` string_view get_method_impl() const; ``` [heading Description]
  2385. [heading Remarks]
  2386. Only called for requests.
  2387. [endsect] [section:get_reason_impl http::basic_fields::get_reason_impl] [indexterm2 get_reason_impl..http::basic_fields]
  2388. Returns the response reason-phrase string. [heading Synopsis] ``` string_view get_reason_impl() const; ``` [heading Description]
  2389. [heading Remarks]
  2390. Only called for responses.
  2391. [endsect] [section:get_target_impl http::basic_fields::get_target_impl] [indexterm2 get_target_impl..http::basic_fields]
  2392. Returns the request-target string. [heading Synopsis] ``` string_view get_target_impl() const; ``` [heading Description]
  2393. [heading Remarks]
  2394. Only called for requests.
  2395. [endsect] [section:has_content_length_impl http::basic_fields::has_content_length_impl] [indexterm2 has_content_length_impl..http::basic_fields]
  2396. Returns `true` if the Content-Length field is present. [heading Synopsis] ``` bool has_content_length_impl() const; ``` [heading Description] [endsect] [section:insert http::basic_fields::insert] [indexterm2 insert..http::basic_fields]
  2397. Insert a field. ``` void ``[link beast.ref.boost__beast__http__basic_fields.insert.overload1 insert]``( field name, string_param const& value); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.insert.overload1 more...]]`` void ``[link beast.ref.boost__beast__http__basic_fields.insert.overload2 insert]``( string_view name, string_param const& value); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.insert.overload2 more...]]`` void ``[link beast.ref.boost__beast__http__basic_fields.insert.overload3 insert]``( field name, string_view name_string, string_param const& value); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.insert.overload3 more...]]`` ``` [section:overload1 http::basic_fields::insert (1 of 3 overloads)]
  2398. Insert a field. [heading Synopsis] ``` void insert( field name, string_param const& value); ``` [heading Description]
  2399. If one or more fields with the same name already exist, the new field will be inserted after the last field with the matching name, in serialization order.
  2400. [heading Parameters] [table [[Name][Description]] [[`name`][
  2401. The field name. ]] [[`value`][
  2402. The value of the field, as a [link beast.ref.boost__beast__string_param `string_param`] ]] ]
  2403. [endsect] [section:overload2 http::basic_fields::insert (2 of 3 overloads)]
  2404. Insert a field. [heading Synopsis] ``` void insert( string_view name, string_param const& value); ``` [heading Description]
  2405. If one or more fields with the same name already exist, the new field will be inserted after the last field with the matching name, in serialization order.
  2406. [heading Parameters] [table [[Name][Description]] [[`name`][
  2407. The field name. ]] [[`value`][
  2408. The value of the field, as a [link beast.ref.boost__beast__string_param `string_param`] ]] ]
  2409. [endsect] [section:overload3 http::basic_fields::insert (3 of 3 overloads)]
  2410. Insert a field. [heading Synopsis] ``` void insert( field name, string_view name_string, string_param const& value); ``` [heading Description]
  2411. If one or more fields with the same name already exist, the new field will be inserted after the last field with the matching name, in serialization order.
  2412. [heading Parameters] [table [[Name][Description]] [[`name`][
  2413. The field name. ]] [[`name_string`][
  2414. The literal text corresponding to the field name. If `name != field::unknown`, then this value must be equal to `to_string(name)` using a case-insensitive comparison, otherwise the behavior is undefined. ]] [[`value`][
  2415. The value of the field, as a [link beast.ref.boost__beast__string_param `string_param`] ]] ]
  2416. [endsect] [endsect] [section:iterator http::basic_fields::iterator] [indexterm2 iterator..http::basic_fields]
  2417. A constant iterator to the field sequence. [heading Synopsis] ``` using iterator = const_iterator; ``` [heading Description] [endsect] [section:key_comp http::basic_fields::key_comp] [indexterm2 key_comp..http::basic_fields]
  2418. Returns a copy of the key comparison function. [heading Synopsis] ``` key_compare key_comp() const; ``` [heading Description] [endsect] [section:key_compare http::basic_fields::key_compare] [indexterm2 key_compare..http::basic_fields]
  2419. A strictly less predicate for comparing keys, using a case-insensitive comparison. [heading Synopsis] ``` using key_compare = ``['implementation-defined]``; ``` [heading Description]
  2420. The case-comparison operation is defined only for low-ASCII characters. [endsect] [section:operator_eq_ http::basic_fields::operator=] [indexterm2 operator=..http::basic_fields]
  2421. Move assignment. ``` basic_fields& ``[link beast.ref.boost__beast__http__basic_fields.operator_eq_.overload1 operator=]``( basic_fields&&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.operator_eq_.overload1 more...]]`` ```
  2422. Copy assignment. ``` basic_fields& ``[link beast.ref.boost__beast__http__basic_fields.operator_eq_.overload2 operator=]``( basic_fields const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.operator_eq_.overload2 more...]]`` template< class OtherAlloc> basic_fields& ``[link beast.ref.boost__beast__http__basic_fields.operator_eq_.overload3 operator=]``( basic_fields< OtherAlloc > const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.operator_eq_.overload3 more...]]`` ``` [section:overload1 http::basic_fields::operator= (1 of 3 overloads)]
  2423. Move assignment. [heading Synopsis] ``` basic_fields& operator=( basic_fields&&); ``` [heading Description]
  2424. The state of the moved-from object is as if constructed using the same allocator. [endsect] [section:overload2 http::basic_fields::operator= (2 of 3 overloads)]
  2425. Copy assignment. [heading Synopsis] ``` basic_fields& operator=( basic_fields const&); ``` [heading Description] [endsect] [section:overload3 http::basic_fields::operator= (3 of 3 overloads)]
  2426. Copy assignment. [heading Synopsis] ``` template< class OtherAlloc> basic_fields& operator=( basic_fields< OtherAlloc > const&); ``` [heading Description] [endsect] [endsect] [section:operator_lb__rb_ http::basic_fields::operator\[\]] [indexterm2 operator\[\]..http::basic_fields]
  2427. Returns the value for a field, or `""` if it does not exist. ``` string_view const ``[link beast.ref.boost__beast__http__basic_fields.operator_lb__rb_.overload1 operator[]]``( field name) const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.operator_lb__rb_.overload1 more...]]`` ```
  2428. Returns the value for a case-insensitive matching header, or `""` if it does not exist. ``` string_view const ``[link beast.ref.boost__beast__http__basic_fields.operator_lb__rb_.overload2 operator[]]``( string_view name) const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.operator_lb__rb_.overload2 more...]]`` ``` [section:overload1 http::basic_fields::operator\[\] (1 of 2 overloads)]
  2429. Returns the value for a field, or `""` if it does not exist. [heading Synopsis] ``` string_view const operator[]( field name) const; ``` [heading Description]
  2430. If more than one field with the specified name exists, the first field defined by insertion order is returned.
  2431. [heading Parameters] [table [[Name][Description]] [[`name`][
  2432. The name of the field. ]] ]
  2433. [endsect] [section:overload2 http::basic_fields::operator\[\] (2 of 2 overloads)]
  2434. Returns the value for a case-insensitive matching header, or `""` if it does not exist. [heading Synopsis] ``` string_view const operator[]( string_view name) const; ``` [heading Description]
  2435. If more than one field with the specified name exists, the first field defined by insertion order is returned.
  2436. [heading Parameters] [table [[Name][Description]] [[`name`][
  2437. The name of the field. ]] ]
  2438. [endsect] [endsect] [section:set http::basic_fields::set] [indexterm2 set..http::basic_fields]
  2439. Set a field value, removing any other instances of that field. ``` void ``[link beast.ref.boost__beast__http__basic_fields.set.overload1 set]``( field name, string_param const& value); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.set.overload1 more...]]`` void ``[link beast.ref.boost__beast__http__basic_fields.set.overload2 set]``( string_view name, string_param const& value); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_fields.set.overload2 more...]]`` ``` [section:overload1 http::basic_fields::set (1 of 2 overloads)]
  2440. Set a field value, removing any other instances of that field. [heading Synopsis] ``` void set( field name, string_param const& value); ``` [heading Description]
  2441. First removes any values with matching field names, then inserts the new field value.
  2442. [heading Parameters] [table [[Name][Description]] [[`name`][
  2443. The field name. ]] [[`value`][
  2444. The value of the field, as a [link beast.ref.boost__beast__string_param `string_param`] ]] ]
  2445. [heading Return Value]
  2446. The field value.
  2447. [endsect] [section:overload2 http::basic_fields::set (2 of 2 overloads)]
  2448. Set a field value, removing any other instances of that field. [heading Synopsis] ``` void set( string_view name, string_param const& value); ``` [heading Description]
  2449. First removes any values with matching field names, then inserts the new field value.
  2450. [heading Parameters] [table [[Name][Description]] [[`name`][
  2451. The field name. ]] [[`value`][
  2452. The value of the field, as a [link beast.ref.boost__beast__string_param `string_param`] ]] ]
  2453. [endsect] [endsect] [section:set_chunked_impl http::basic_fields::set_chunked_impl] [indexterm2 set_chunked_impl..http::basic_fields]
  2454. Adjusts the chunked Transfer-Encoding value. [heading Synopsis] ``` void set_chunked_impl( bool value); ``` [heading Description] [endsect] [section:set_content_length_impl http::basic_fields::set_content_length_impl] [indexterm2 set_content_length_impl..http::basic_fields]
  2455. Sets or clears the Content-Length field. [heading Synopsis] ``` void set_content_length_impl( boost::optional< std::uint64_t > const& value); ``` [heading Description] [endsect] [section:set_keep_alive_impl http::basic_fields::set_keep_alive_impl] [indexterm2 set_keep_alive_impl..http::basic_fields]
  2456. Adjusts the Connection field. [heading Synopsis] ``` void set_keep_alive_impl( unsigned version, bool keep_alive); ``` [heading Description] [endsect] [section:set_method_impl http::basic_fields::set_method_impl] [indexterm2 set_method_impl..http::basic_fields]
  2457. Set or clear the method string. [heading Synopsis] ``` void set_method_impl( string_view s); ``` [heading Description]
  2458. [heading Remarks]
  2459. Only called for requests.
  2460. [endsect] [section:set_reason_impl http::basic_fields::set_reason_impl] [indexterm2 set_reason_impl..http::basic_fields]
  2461. Set or clear the reason string. [heading Synopsis] ``` void set_reason_impl( string_view s); ``` [heading Description]
  2462. [heading Remarks]
  2463. Only called for responses.
  2464. [endsect] [section:set_target_impl http::basic_fields::set_target_impl] [indexterm2 set_target_impl..http::basic_fields]
  2465. Set or clear the target string. [heading Synopsis] ``` void set_target_impl( string_view s); ``` [heading Description]
  2466. [heading Remarks]
  2467. Only called for requests.
  2468. [endsect] [section:swap http::basic_fields::swap] [indexterm2 swap..http::basic_fields]
  2469. Swap two field containers. [heading Synopsis] Defined in header [include_file boost/beast/http/fields.hpp] ``` template< class Alloc> friend void swap( basic_fields< Alloc >& lhs, basic_fields< Alloc >& rhs); ``` [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:swap http::basic_fields::swap] [indexterm2 swap..http::basic_fields]
  2470. Return a buffer sequence representing the trailers. [heading Synopsis] ``` void swap( basic_fields& other); ``` [heading Description]
  2471. This function returns a buffer sequence holding the serialized representation of the trailer fields promised in the Accept field. Before calling this function the Accept field must contain the exact trailer fields desired. Each field must also exist.Swap this container with another [endsect] [section:writer http::basic_fields::writer] [indexterm2 writer..http::basic_fields]
  2472. The algorithm used to serialize the header. [heading Synopsis] ``` using writer = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:basic_fields_dtor_ http::basic_fields::~basic_fields] [indexterm2 ~basic_fields..http::basic_fields]
  2473. Destructor. [heading Synopsis] ``` ~basic_fields(); ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__basic_fields__element http::basic_fields::element] [heading Synopsis] Defined in header [include_file boost/beast/http/fields.hpp] ``` struct element : public boost::intrusive::list_base_hook< boost::intrusive::link_mode< boost::intrusive::normal_link > >, public boost::intrusive::set_base_hook< boost::intrusive::link_mode< boost::intrusive::normal_link > >, public http::basic_fields< Allocator >::value_type ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_fields__element.element [*element]]] [ ] ] [ [[link beast.ref.boost__beast__http__basic_fields__element.name [*name]]] [ Returns the field enum, which can be field::unknown. ] ] [ [[link beast.ref.boost__beast__http__basic_fields__element.name_string [*name_string]]] [ Returns the field name as a string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields__element.value [*value]]] [ Returns the value of the field. ] ] ] [heading Description] [section:element http::basic_fields::element::element] [indexterm2 element..http::basic_fields::element] [heading Synopsis] ``` element( field name, string_view sname, string_view value); ``` [heading Description] [endsect] [section:name http::basic_fields::element::name] (Inherited from `http::basic_fields`) [indexterm2 name..http::basic_fields::element]
  2474. Returns the field enum, which can be [link beast.ref.boost__beast__http__field `http::unknown`]. [heading Synopsis] ``` field name() const; ``` [heading Description] [endsect] [section:name_string http::basic_fields::element::name_string] (Inherited from `http::basic_fields`) [indexterm2 name_string..http::basic_fields::element]
  2475. Returns the field name as a string. [heading Synopsis] ``` string_view const name_string() const; ``` [heading Description] [endsect] [section:value http::basic_fields::element::value] (Inherited from `http::basic_fields`) [indexterm2 value..http::basic_fields::element]
  2476. Returns the value of the field. [heading Synopsis] ``` string_view const value() const; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__basic_fields__value_type http::basic_fields::value_type]
  2477. The type of element used to represent a field. [heading Synopsis] Defined in header [include_file boost/beast/http/fields.hpp] ``` class value_type ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_fields__value_type.name [*name]]] [ Returns the field enum, which can be field::unknown. ] ] [ [[link beast.ref.boost__beast__http__basic_fields__value_type.name_string [*name_string]]] [ Returns the field name as a string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields__value_type.operator_eq_ [*operator=]]] [ Assignment (deleted) ] ] [ [[link beast.ref.boost__beast__http__basic_fields__value_type.value [*value]]] [ Returns the value of the field. ] ] [ [[link beast.ref.boost__beast__http__basic_fields__value_type.value_type [*value_type]]] [ Constructor (deleted) ] ] ] [heading Protected Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_fields__value_type.value_type [*value_type]]] [ ] ] ] [heading Description] [section:name http::basic_fields::value_type::name] [indexterm2 name..http::basic_fields::value_type]
  2478. Returns the field enum, which can be [link beast.ref.boost__beast__http__field `http::unknown`]. [heading Synopsis] ``` field name() const; ``` [heading Description] [endsect] [section:name_string http::basic_fields::value_type::name_string] [indexterm2 name_string..http::basic_fields::value_type]
  2479. Returns the field name as a string. [heading Synopsis] ``` string_view const name_string() const; ``` [heading Description] [endsect] [section:operator_eq_ http::basic_fields::value_type::operator=] [indexterm2 operator=..http::basic_fields::value_type]
  2480. Assignment (deleted) [heading Synopsis] ``` value_type& operator=( value_type const&); ``` [heading Description] [endsect] [section:value http::basic_fields::value_type::value] [indexterm2 value..http::basic_fields::value_type]
  2481. Returns the value of the field. [heading Synopsis] ``` string_view const value() const; ``` [heading Description] [endsect] [section:value_type http::basic_fields::value_type::value_type] [indexterm2 value_type..http::basic_fields::value_type] [heading Synopsis] ``` value_type( field name, string_view sname, string_view value); ``` [heading Description] [endsect] [section:value_type http::basic_fields::value_type::value_type] [indexterm2 value_type..http::basic_fields::value_type]
  2482. Constructor (deleted) [heading Synopsis] ``` value_type( value_type const&); ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__basic_file_body http::basic_file_body]
  2483. A message body represented by a file on the filesystem. [heading Synopsis] Defined in header [include_file boost/beast/http/basic_file_body.hpp] ``` template< class File> struct basic_file_body ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_file_body__reader [*reader]]] [ Algorithm for storing buffers when parsing. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__value_type [*value_type]]] [ The type of the message::body member. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__writer [*writer]]] [ Algorithm for retrieving buffers when serializing. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body.file_type [*file_type]]] [ The type of File this body uses. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_file_body.size [*size]]] [ Returns the size of the body. ] ] ] [heading Description]
  2484. Messages with this type have bodies represented by a file on the file system. When parsing a message using this body type, the data is stored in the file pointed to by the path, which must be writable. When serializing, the implementation will read the file and present those octets as the body content. This may be used to serve content from a directory as part of a web service.
  2485. [heading Template Parameters] [table [[Type][Description]] [[`File`][
  2486. The implementation to use for accessing files. This type must meet the requirements of ['File]. ]] ]
  2487. [section:file_type http::basic_file_body::file_type] [indexterm2 file_type..http::basic_file_body]
  2488. The type of File this body uses. [heading Synopsis] ``` using file_type = File; ``` [heading Description] [endsect] [section:size http::basic_file_body::size] [indexterm2 size..http::basic_file_body]
  2489. Returns the size of the body. [heading Synopsis] ``` static std::uint64_t size( value_type const& body); ``` [heading Description]
  2490. [heading Parameters] [table [[Name][Description]] [[`body`][
  2491. The file body to use ]] ]
  2492. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__basic_file_body__reader http::basic_file_body::reader]
  2493. Algorithm for storing buffers when parsing. [heading Synopsis] Defined in header [include_file boost/beast/http/basic_file_body.hpp] ``` class reader ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_file_body__reader.finish [*finish]]] [ ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__reader.init [*init]]] [ ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__reader.put [*put]]] [ ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__reader.reader [*reader]]] [ ] ] ] [heading Description]
  2494. Objects of this type are created during parsing to store incoming buffers representing the body. [section:finish http::basic_file_body::reader::finish] [indexterm2 finish..http::basic_file_body::reader] [heading Synopsis] ``` void finish( error_code& ec); ``` [heading Description] [endsect] [section:init http::basic_file_body::reader::init] [indexterm2 init..http::basic_file_body::reader] [heading Synopsis] ``` void init( boost::optional< std::uint64_t > const&, error_code& ec); ``` [heading Description] [endsect] [section:put http::basic_file_body::reader::put] [indexterm2 put..http::basic_file_body::reader] [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t put( ConstBufferSequence const& buffers, error_code& ec); ``` [heading Description] [endsect] [section:reader http::basic_file_body::reader::reader] [indexterm2 reader..http::basic_file_body::reader] [heading Synopsis] ``` template< bool isRequest, class __Fields__> reader( header< isRequest, Fields >& h, value_type& b); ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__basic_file_body__value_type http::basic_file_body::value_type]
  2495. The type of the [link beast.ref.boost__beast__http__message.body `http::message::body`] member. [heading Synopsis] Defined in header [include_file boost/beast/http/basic_file_body.hpp] ``` class value_type ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_file_body__value_type.close [*close]]] [ Close the file if open. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__value_type.is_open [*is_open]]] [ Returns true if the file is open. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__value_type.open [*open]]] [ Open a file at the given path with the specified mode. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__value_type.operator_eq_ [*operator=]]] [ Move assignment. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__value_type.reset [*reset]]] [ Set the open file. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__value_type.size [*size]]] [ Returns the size of the file if open. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__value_type.value_type [*value_type]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__value_type.value_type_dtor_ [*~value_type]]] [ Destructor. ] ] ] [heading Friends] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_file_body__value_type.basic_file_body [*basic_file_body]]] [ ] ] ] [heading Description]
  2496. Messages declared using `basic_file_body` will have this type for the body member. This rich class interface allow the file to be opened with the file handle maintained directly in the object, which is attached to the message. [section:basic_file_body http::basic_file_body::value_type::basic_file_body] [indexterm2 basic_file_body..http::basic_file_body::value_type] [heading Synopsis] Defined in header [include_file boost/beast/http/basic_file_body.hpp] ``` friend struct basic_file_body(); ``` [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:close http::basic_file_body::value_type::close] [indexterm2 close..http::basic_file_body::value_type]
  2497. Close the file if open. [heading Synopsis] ``` void close(); ``` [heading Description] [endsect] [section:is_open http::basic_file_body::value_type::is_open] [indexterm2 is_open..http::basic_file_body::value_type]
  2498. Returns `true` if the file is open. [heading Synopsis] ``` bool is_open() const; ``` [heading Description] [endsect] [section:open http::basic_file_body::value_type::open] [indexterm2 open..http::basic_file_body::value_type]
  2499. Open a file at the given path with the specified mode. [heading Synopsis] ``` void open( char const* path, file_mode mode, error_code& ec); ``` [heading Description]
  2500. [heading Parameters] [table [[Name][Description]] [[`path`][
  2501. The utf-8 encoded path to the file ]] [[`mode`][
  2502. The file mode to use ]] [[`ec`][
  2503. Set to the error, if any occurred ]] ]
  2504. [endsect] [section:operator_eq_ http::basic_file_body::value_type::operator=] [indexterm2 operator=..http::basic_file_body::value_type]
  2505. Move assignment. [heading Synopsis] ``` value_type& operator=( value_type&& other); ``` [heading Description] [endsect] [section:reset http::basic_file_body::value_type::reset] [indexterm2 reset..http::basic_file_body::value_type]
  2506. Set the open file. [heading Synopsis] ``` void reset( File&& file, error_code& ec); ``` [heading Description]
  2507. This function is used to set the open file. Any previously set file will be closed.
  2508. [heading Parameters] [table [[Name][Description]] [[`file`][
  2509. The file to set. The file must be open or else an error occurs ]] [[`ec`][
  2510. Set to the error, if any occurred ]] ]
  2511. [endsect] [section:size http::basic_file_body::value_type::size] [indexterm2 size..http::basic_file_body::value_type]
  2512. Returns the size of the file if open. [heading Synopsis] ``` std::uint64_t size() const; ``` [heading Description] [endsect] [section:value_type http::basic_file_body::value_type::value_type] [indexterm2 value_type..http::basic_file_body::value_type]
  2513. Constructor. ``` ``[link beast.ref.boost__beast__http__basic_file_body__value_type.value_type.overload1 value_type]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_file_body__value_type.value_type.overload1 more...]]`` ``[link beast.ref.boost__beast__http__basic_file_body__value_type.value_type.overload2 value_type]``( value_type&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_file_body__value_type.value_type.overload2 more...]]`` ``` [section:overload1 http::basic_file_body::value_type::value_type (1 of 2 overloads)]
  2514. Constructor. [heading Synopsis] ``` value_type(); ``` [heading Description] [endsect] [section:overload2 http::basic_file_body::value_type::value_type (2 of 2 overloads)]
  2515. Constructor. [heading Synopsis] ``` value_type( value_type&& other); ``` [heading Description] [endsect] [endsect] [section:value_type_dtor_ http::basic_file_body::value_type::~value_type] [indexterm2 ~value_type..http::basic_file_body::value_type]
  2516. Destructor. [heading Synopsis] ``` ~value_type(); ``` [heading Description]
  2517. If the file is open, it is closed first. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__basic_file_body__writer http::basic_file_body::writer]
  2518. Algorithm for retrieving buffers when serializing. [heading Synopsis] Defined in header [include_file boost/beast/http/basic_file_body.hpp] ``` class writer ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_file_body__writer.const_buffers_type [*const_buffers_type]]] [ ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_file_body__writer.get [*get]]] [ ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__writer.init [*init]]] [ ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__writer.writer [*writer]]] [ ] ] ] [heading Description]
  2519. Objects of this type are created during serialization to extract the buffers representing the body. [section:const_buffers_type http::basic_file_body::writer::const_buffers_type] [indexterm2 const_buffers_type..http::basic_file_body::writer] [heading Synopsis] ``` using const_buffers_type = net::const_buffer; ``` [heading Description] [endsect] [section:get http::basic_file_body::writer::get] [indexterm2 get..http::basic_file_body::writer] [heading Synopsis] ``` boost::optional< std::pair< const_buffers_type, bool > > get( error_code& ec); ``` [heading Description] [endsect] [section:init http::basic_file_body::writer::init] [indexterm2 init..http::basic_file_body::writer] [heading Synopsis] ``` void init( error_code& ec); ``` [heading Description] [endsect] [section:writer http::basic_file_body::writer::writer] [indexterm2 writer..http::basic_file_body::writer] [heading Synopsis] ``` template< bool isRequest, class __Fields__> writer( header< isRequest, Fields >& h, value_type& b); ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__basic_parser http::basic_parser]
  2520. A parser for decoding HTTP/1 wire format messages. [heading Synopsis] Defined in header [include_file boost/beast/http/basic_parser.hpp] ``` template< bool isRequest> class basic_parser : private basic_parser_base ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_parser.is_request [*is_request]]] [ true if this parser parses requests, false for responses. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_parser.basic_parser [*basic_parser]]] [ Copy constructor. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.body_limit [*body_limit]]] [ Set the limit on the payload body. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.chunked [*chunked]]] [ Returns true if the last value for Transfer-Encoding is "chunked". ] ] [ [[link beast.ref.boost__beast__http__basic_parser.content_length [*content_length]]] [ Returns the optional value of Content-Length if known. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.content_length_remaining [*content_length_remaining]]] [ Returns the remaining content length if known. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.eager [*eager]]] [ Returns true if the eager parse option is set. Set the eager parse option. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.got_some [*got_some]]] [ Returns true if the parser has received at least one byte of input. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.header_limit [*header_limit]]] [ Set a limit on the total size of the header. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.is_done [*is_done]]] [ Returns true if the message is complete. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.is_header_done [*is_header_done]]] [ Returns true if a the parser has produced the full header. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.keep_alive [*keep_alive]]] [ Returns true if the message has keep-alive connection semantics. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.need_eof [*need_eof]]] [ Returns true if the message semantics require an end of file. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.operator_eq_ [*operator=]]] [ Copy assignment. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.put [*put]]] [ Write a buffer sequence to the parser. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.put_eof [*put_eof]]] [ Inform the parser that the end of stream was reached. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.skip [*skip]]] [ Returns true if the skip parse option is set. Set the skip parse option. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.upgrade [*upgrade]]] [ Returns true if the message is an upgrade message. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.basic_parser_dtor_ [*~basic_parser]]] [ Destructor. ] ] ] [heading Protected Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_parser.basic_parser [*basic_parser]]] [ Default constructor. Move constructor. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.on_body_impl [*on_body_impl]]] [ Called each time additional data is received representing the content body. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.on_body_init_impl [*on_body_init_impl]]] [ Called once before the body is processed. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.on_chunk_body_impl [*on_chunk_body_impl]]] [ Called each time additional data is received representing part of a body chunk. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.on_chunk_header_impl [*on_chunk_header_impl]]] [ Called each time a new chunk header of a chunk encoded body is received. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.on_field_impl [*on_field_impl]]] [ Called once for each complete field in the HTTP header. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.on_finish_impl [*on_finish_impl]]] [ Called once when the complete message is received. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.on_header_impl [*on_header_impl]]] [ Called once after the complete HTTP header is received. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.on_request_impl [*on_request_impl]]] [ Called after receiving the request-line. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.on_response_impl [*on_response_impl]]] [ Called after receiving the status-line. ] ] [ [[link beast.ref.boost__beast__http__basic_parser.operator_eq_ [*operator=]]] [ Move assignment. ] ] ] [heading Description]
  2521. This parser is designed to efficiently parse messages in the HTTP/1 wire format. It allocates no memory when input is presented as a single contiguous buffer, and uses minimal state. It will handle chunked encoding and it understands the semantics of the Connection, Content-Length, and Upgrade fields. The parser is optimized for the case where the input buffer sequence consists of a single contiguous buffer. The [link beast.ref.boost__beast__basic_flat_buffer `basic_flat_buffer`] class is provided, which guarantees that the input sequence of the stream buffer will be represented by exactly one contiguous buffer. To ensure the optimum performance of the parser, use [link beast.ref.boost__beast__basic_flat_buffer `basic_flat_buffer`] with HTTP algorithms such as [link beast.ref.boost__beast__http__read `http::read`], [link beast.ref.boost__beast__http__read_some `http::read_some`], [link beast.ref.boost__beast__http__async_read `http::async_read`], and [link beast.ref.boost__beast__http__async_read_some `http::async_read_some`]. Alternatively, the caller may use custom techniques to ensure that the structured portion of the HTTP message (header or chunk header) is contained in a linear buffer.
  2522. The interface to the parser uses virtual member functions. To use this class, derive your type from [link beast.ref.boost__beast__http__basic_parser `http::basic_parser`]. When bytes are presented, the implementation will make a series of zero or more calls to virtual functions, which the derived class must implement.
  2523. Every virtual function must be provided by the derived class, or else a compilation error will be generated. The implementation will make sure that `ec` is clear before each virtual function is invoked. If a virtual function sets an error, it is propagated out of the parser to the caller.
  2524. [heading Template Parameters] [table [[Type][Description]] [[`isRequest`][
  2525. A `bool` indicating whether the parser will be presented with request or response message. ]] ]
  2526. [heading Remarks]
  2527. If the parser encounters a field value with obs-fold longer than 4 kilobytes in length, an error is generated.
  2528. [section:basic_parser http::basic_parser::basic_parser] [indexterm2 basic_parser..http::basic_parser]
  2529. Default constructor. ``` ``[link beast.ref.boost__beast__http__basic_parser.basic_parser.overload1 basic_parser]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_parser.basic_parser.overload1 more...]]`` ```
  2530. Move constructor. ``` ``[link beast.ref.boost__beast__http__basic_parser.basic_parser.overload2 basic_parser]``( basic_parser&&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_parser.basic_parser.overload2 more...]]`` ``` [section:overload1 http::basic_parser::basic_parser (1 of 2 overloads)]
  2531. Default constructor. [heading Synopsis] ``` basic_parser(); ``` [heading Description] [endsect] [section:overload2 http::basic_parser::basic_parser (2 of 2 overloads)]
  2532. Move constructor. [heading Synopsis] ``` basic_parser( basic_parser&&); ``` [heading Description]
  2533. [heading Remarks]
  2534. After the move, the only valid operation on the moved-from object is destruction. [endsect] [endsect] [section:basic_parser http::basic_parser::basic_parser] [indexterm2 basic_parser..http::basic_parser]
  2535. Copy constructor. [heading Synopsis] ``` basic_parser( basic_parser const&); ``` [heading Description] [endsect] [section:body_limit http::basic_parser::body_limit] [indexterm2 body_limit..http::basic_parser]
  2536. Set the limit on the payload body. [heading Synopsis] ``` void body_limit( std::uint64_t v); ``` [heading Description]
  2537. This function sets the maximum allowed size of the payload body, before any encodings except chunked have been removed. Depending on the message semantics, one of these cases will apply:
  2538. * The Content-Length is specified and exceeds the limit. In this case the result [link beast.ref.boost__beast__http__error `http::body_limit`] is returned immediately after the header is parsed.
  2539. * The Content-Length is unspecified and the chunked encoding is not specified as the last encoding. In this case the end of message is determined by the end of file indicator on the associated stream or input source. If a sufficient number of body payload octets are presented to the parser to exceed the configured limit, the parse fails with the result [link beast.ref.boost__beast__http__error `http::body_limit`]
  2540. * The Transfer-Encoding specifies the chunked encoding as the last encoding. In this case, when the number of payload body octets produced by removing the chunked encoding exceeds the configured limit, the parse fails with the result [link beast.ref.boost__beast__http__error `http::body_limit`].
  2541. Setting the limit after any body octets have been parsed results in undefined behavior.
  2542. The default limit is 1MB for requests and 8MB for responses.
  2543. [heading Parameters] [table [[Name][Description]] [[`v`][
  2544. The payload body limit to set ]] ]
  2545. [endsect] [section:chunked http::basic_parser::chunked] [indexterm2 chunked..http::basic_parser]
  2546. Returns `true` if the last value for Transfer-Encoding is "chunked". [heading Synopsis] ``` bool chunked() const; ``` [heading Description]
  2547. [heading Remarks]
  2548. The return value is undefined unless [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] would return `true`.
  2549. [endsect] [section:content_length http::basic_parser::content_length] [indexterm2 content_length..http::basic_parser]
  2550. Returns the optional value of Content-Length if known. [heading Synopsis] ``` boost::optional< std::uint64_t > content_length() const; ``` [heading Description]
  2551. [heading Remarks]
  2552. The return value is undefined unless [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] would return `true`.
  2553. [endsect] [section:content_length_remaining http::basic_parser::content_length_remaining] [indexterm2 content_length_remaining..http::basic_parser]
  2554. Returns the remaining content length if known. [heading Synopsis] ``` boost::optional< std::uint64_t > content_length_remaining() const; ``` [heading Description]
  2555. If the message header specifies a Content-Length, the return value will be the number of bytes remaining in the payload body have not yet been parsed.
  2556. [heading Remarks]
  2557. The return value is undefined unless [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] would return `true`.
  2558. [endsect] [section:eager http::basic_parser::eager] [indexterm2 eager..http::basic_parser]
  2559. Returns `true` if the eager parse option is set. ``` bool ``[link beast.ref.boost__beast__http__basic_parser.eager.overload1 eager]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_parser.eager.overload1 more...]]`` ```
  2560. Set the eager parse option. ``` void ``[link beast.ref.boost__beast__http__basic_parser.eager.overload2 eager]``( bool v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_parser.eager.overload2 more...]]`` ``` [section:overload1 http::basic_parser::eager (1 of 2 overloads)]
  2561. Returns `true` if the eager parse option is set. [heading Synopsis] ``` bool eager() const; ``` [heading Description] [endsect] [section:overload2 http::basic_parser::eager (2 of 2 overloads)]
  2562. Set the eager parse option. [heading Synopsis] ``` void eager( bool v); ``` [heading Description]
  2563. Normally the parser returns after successfully parsing a structured element (header, chunk header, or chunk body) even if there are octets remaining in the input. This is necessary when attempting to parse the header first, or when the caller wants to inspect information which may be invalidated by subsequent parsing, such as a chunk extension. The `eager` option controls whether the parser keeps going after parsing structured element if there are octets remaining in the buffer and no error occurs. This option is automatically set or cleared during certain stream operations to improve performance with no change in functionality.
  2564. The default setting is `false`.
  2565. [heading Parameters] [table [[Name][Description]] [[`v`][
  2566. `true` to set the eager parse option or `false` to disable it. ]] ]
  2567. [endsect] [endsect] [section:got_some http::basic_parser::got_some] [indexterm2 got_some..http::basic_parser]
  2568. Returns `true` if the parser has received at least one byte of input. [heading Synopsis] ``` bool got_some() const; ``` [heading Description] [endsect] [section:header_limit http::basic_parser::header_limit] [indexterm2 header_limit..http::basic_parser]
  2569. Set a limit on the total size of the header. [heading Synopsis] ``` void header_limit( std::uint32_t v); ``` [heading Description]
  2570. This function sets the maximum allowed size of the header including all field name, value, and delimiter characters and also including the CRLF sequences in the serialized input. If the end of the header is not found within the limit of the header size, the error [link beast.ref.boost__beast__http__error `http::header_limit`] is returned by [link beast.ref.boost__beast__http__basic_parser.put `http::basic_parser::put`].
  2571. Setting the limit after any header octets have been parsed results in undefined behavior. [endsect] [section:is_done http::basic_parser::is_done] [indexterm2 is_done..http::basic_parser]
  2572. Returns `true` if the message is complete. [heading Synopsis] ``` bool is_done() const; ``` [heading Description]
  2573. The message is complete after the full header is prduced and one of the following is true:
  2574. * The skip body option was set.
  2575. * The semantics of the message indicate there is no body.
  2576. * The semantics of the message indicate a body is expected, and the entire body was parsed.
  2577. [endsect] [section:is_header_done http::basic_parser::is_header_done] [indexterm2 is_header_done..http::basic_parser]
  2578. Returns `true` if a the parser has produced the full header. [heading Synopsis] ``` bool is_header_done() const; ``` [heading Description] [endsect] [section:is_request http::basic_parser::is_request] [indexterm2 is_request..http::basic_parser]
  2579. `true` if this parser parses requests, `false` for responses. [heading Synopsis] ``` using is_request = std::integral_constant< bool, isRequest >; ``` [heading Description] [endsect] [section:keep_alive http::basic_parser::keep_alive] [indexterm2 keep_alive..http::basic_parser]
  2580. Returns `true` if the message has keep-alive connection semantics. [heading Synopsis] ``` bool keep_alive() const; ``` [heading Description]
  2581. This function always returns `false` if [link beast.ref.boost__beast__http__basic_parser.need_eof `http::basic_parser::need_eof`] would return `false`.
  2582. [heading Remarks]
  2583. The return value is undefined unless [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] would return `true`.
  2584. [endsect] [section:need_eof http::basic_parser::need_eof] [indexterm2 need_eof..http::basic_parser]
  2585. Returns `true` if the message semantics require an end of file. [heading Synopsis] ``` bool need_eof() const; ``` [heading Description]
  2586. Depending on the contents of the header, the parser may require and end of file notification to know where the end of the body lies. If this function returns `true` it will be necessary to call [link beast.ref.boost__beast__http__basic_parser.put_eof `http::basic_parser::put_eof`] when there will never be additional data from the input. [endsect] [section:on_body_impl http::basic_parser::on_body_impl] [indexterm2 on_body_impl..http::basic_parser]
  2587. Called each time additional data is received representing the content body. [heading Synopsis] ``` std::size_t on_body_impl( string_view body, error_code& ec); ``` [heading Description]
  2588. This virtual function is invoked for each piece of the body which is received while parsing of a message. This function is only used when no chunked transfer encoding is present.
  2589. [heading Parameters] [table [[Name][Description]] [[`body`][
  2590. A string holding the additional body contents. This may contain nulls or unprintable characters. ]] [[`ec`][
  2591. An output parameter which the function may set to indicate an error. The error will be clear before this function is invoked. ]] ]
  2592. [heading See Also]
  2593. [link beast.ref.boost__beast__http__basic_parser.on_chunk_body_impl `http::basic_parser::on_chunk_body_impl`]
  2594. [endsect] [section:on_body_init_impl http::basic_parser::on_body_init_impl] [indexterm2 on_body_init_impl..http::basic_parser]
  2595. Called once before the body is processed. [heading Synopsis] ``` void on_body_init_impl( boost::optional< std::uint64_t > const& content_length, error_code& ec); ``` [heading Description]
  2596. This virtual function is invoked once, before the content body is processed (but after the complete header is received).
  2597. [heading Parameters] [table [[Name][Description]] [[`content_length`][
  2598. A value representing the content length in bytes if the length is known (this can include a zero length). Otherwise, the value will be `boost::none`. ]] [[`ec`][
  2599. An output parameter which the function may set to indicate an error. The error will be clear before this function is invoked. ]] ]
  2600. [endsect] [section:on_chunk_body_impl http::basic_parser::on_chunk_body_impl] [indexterm2 on_chunk_body_impl..http::basic_parser]
  2601. Called each time additional data is received representing part of a body chunk. [heading Synopsis] ``` std::size_t on_chunk_body_impl( std::uint64_t remain, string_view body, error_code& ec); ``` [heading Description]
  2602. This virtual function is invoked for each piece of the body which is received while parsing of a message. This function is only used when no chunked transfer encoding is present.
  2603. [heading Parameters] [table [[Name][Description]] [[`remain`][
  2604. The number of bytes remaining in this chunk. This includes the contents of passed `body`. If this value is zero, then this represents the final chunk. ]] [[`body`][
  2605. A string holding the additional body contents. This may contain nulls or unprintable characters. ]] [[`ec`][
  2606. An output parameter which the function may set to indicate an error. The error will be clear before this function is invoked. ]] ]
  2607. [heading Return Value]
  2608. This function should return the number of bytes actually consumed from the `body` value. Any bytes that are not consumed on this call will be presented in a subsequent call.
  2609. [heading See Also]
  2610. [link beast.ref.boost__beast__http__basic_parser.on_body_impl `http::basic_parser::on_body_impl`]
  2611. [endsect] [section:on_chunk_header_impl http::basic_parser::on_chunk_header_impl] [indexterm2 on_chunk_header_impl..http::basic_parser]
  2612. Called each time a new chunk header of a chunk encoded body is received. [heading Synopsis] ``` void on_chunk_header_impl( std::uint64_t size, string_view extensions, error_code& ec); ``` [heading Description]
  2613. This function is invoked each time a new chunk header is received. The function is only used when the chunked transfer encoding is present.
  2614. [heading Parameters] [table [[Name][Description]] [[`size`][
  2615. The size of this chunk, in bytes. ]] [[`extensions`][
  2616. A string containing the entire chunk extensions. This may be empty, indicating no extensions are present. ]] [[`ec`][
  2617. An output parameter which the function may set to indicate an error. The error will be clear before this function is invoked. ]] ]
  2618. [endsect] [section:on_field_impl http::basic_parser::on_field_impl] [indexterm2 on_field_impl..http::basic_parser]
  2619. Called once for each complete field in the HTTP header. [heading Synopsis] ``` void on_field_impl( field name, string_view name_string, string_view value, error_code& ec); ``` [heading Description]
  2620. This virtual function is invoked for each field that is received while parsing an HTTP message.
  2621. [heading Parameters] [table [[Name][Description]] [[`name`][
  2622. The known field enum value. If the name of the field is not recognized, this value will be [link beast.ref.boost__beast__http__field `http::unknown`]. ]] [[`name_string`][
  2623. The exact name of the field as received from the input, represented as a string. ]] [[`value`][
  2624. A string holding the value of the field. ]] [[`ec`][
  2625. An output parameter which the function may set to indicate an error. The error will be clear before this function is invoked. ]] ]
  2626. [endsect] [section:on_finish_impl http::basic_parser::on_finish_impl] [indexterm2 on_finish_impl..http::basic_parser]
  2627. Called once when the complete message is received. [heading Synopsis] ``` void on_finish_impl( error_code& ec); ``` [heading Description]
  2628. This virtual function is invoked once, after successfully parsing a complete HTTP message.
  2629. [heading Parameters] [table [[Name][Description]] [[`ec`][
  2630. An output parameter which the function may set to indicate an error. The error will be clear before this function is invoked. ]] ]
  2631. [endsect] [section:on_header_impl http::basic_parser::on_header_impl] [indexterm2 on_header_impl..http::basic_parser]
  2632. Called once after the complete HTTP header is received. [heading Synopsis] ``` void on_header_impl( error_code& ec); ``` [heading Description]
  2633. This virtual function is invoked once, after the complete HTTP header is received while parsing a message.
  2634. [heading Parameters] [table [[Name][Description]] [[`ec`][
  2635. An output parameter which the function may set to indicate an error. The error will be clear before this function is invoked. ]] ]
  2636. [endsect] [section:on_request_impl http::basic_parser::on_request_impl] [indexterm2 on_request_impl..http::basic_parser]
  2637. Called after receiving the request-line. [heading Synopsis] ``` void on_request_impl( verb method, string_view method_str, string_view target, int version, error_code& ec); ``` [heading Description]
  2638. This virtual function is invoked after receiving a request-line when parsing HTTP requests. It can only be called when `isRequest == true`.
  2639. [heading Parameters] [table [[Name][Description]] [[`method`][
  2640. The verb enumeration. If the method string is not one of the predefined strings, this value will be [link beast.ref.boost__beast__http__field `http::unknown`]. ]] [[`method_str`][
  2641. The unmodified string representing the verb. ]] [[`target`][
  2642. The request-target. ]] [[`version`][
  2643. The HTTP-version. This will be 10 for HTTP/1.0, and 11 for HTTP/1.1. ]] [[`ec`][
  2644. An output parameter which the function may set to indicate an error. The error will be clear before this function is invoked. ]] ]
  2645. [endsect] [section:on_response_impl http::basic_parser::on_response_impl] [indexterm2 on_response_impl..http::basic_parser]
  2646. Called after receiving the status-line. [heading Synopsis] ``` void on_response_impl( int code, string_view reason, int version, error_code& ec); ``` [heading Description]
  2647. This virtual function is invoked after receiving a status-line when parsing HTTP responses. It can only be called when `isRequest == false`.
  2648. [heading Parameters] [table [[Name][Description]] [[`code`][
  2649. The numeric status code. ]] [[`reason`][
  2650. The reason-phrase. Note that this value is now obsolete, and only provided for historical or diagnostic purposes. ]] [[`version`][
  2651. The HTTP-version. This will be 10 for HTTP/1.0, and 11 for HTTP/1.1. ]] [[`ec`][
  2652. An output parameter which the function may set to indicate an error. The error will be clear before this function is invoked. ]] ]
  2653. [endsect] [section:operator_eq_ http::basic_parser::operator=] [indexterm2 operator=..http::basic_parser]
  2654. Move assignment. [heading Synopsis] ``` basic_parser& operator=( basic_parser&&); ``` [heading Description] [endsect] [section:operator_eq_ http::basic_parser::operator=] [indexterm2 operator=..http::basic_parser]
  2655. Copy assignment. [heading Synopsis] ``` basic_parser& operator=( basic_parser const&); ``` [heading Description] [endsect] [section:put http::basic_parser::put] [indexterm2 put..http::basic_parser]
  2656. Write a buffer sequence to the parser. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t put( ConstBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  2657. This function attempts to incrementally parse the HTTP message data stored in the caller provided buffers. Upon success, a positive return value indicates that the parser made forward progress, consuming that number of bytes.
  2658. In some cases there may be an insufficient number of octets in the input buffer in order to make forward progress. This is indicated by the code [link beast.ref.boost__beast__http__error `http::need_more`]. When this happens, the caller should place additional bytes into the buffer sequence and call [link beast.ref.boost__beast__http__basic_parser.put `http::basic_parser::put`] again.
  2659. The error code [link beast.ref.boost__beast__http__error `http::need_more`] is special. When this error is returned, a subsequent call to [link beast.ref.boost__beast__http__basic_parser.put `http::basic_parser::put`] may succeed if the buffers have been updated. Otherwise, upon error the parser may not be restarted.
  2660. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  2661. An object meeting the requirements of ['ConstBufferSequence] that represents the next chunk of message data. If the length of this buffer sequence is one, the implementation will not allocate additional memory. The class [link beast.ref.boost__beast__basic_flat_buffer `basic_flat_buffer`] is provided as one way to meet this requirement ]] [[`ec`][
  2662. Set to the error, if any occurred. ]] ]
  2663. [heading Return Value]
  2664. The number of octets consumed in the buffer sequence. The caller should remove these octets even if the error is set.
  2665. [endsect] [section:put_eof http::basic_parser::put_eof] [indexterm2 put_eof..http::basic_parser]
  2666. Inform the parser that the end of stream was reached. [heading Synopsis] ``` void put_eof( error_code& ec); ``` [heading Description]
  2667. In certain cases, HTTP needs to know where the end of the stream is. For example, sometimes servers send responses without Content-Length and expect the client to consume input (for the body) until EOF. Callbacks and errors will still be processed as usual.
  2668. This is typically called when a read from the underlying stream object sets the error code to `net::error::eof`.
  2669. [heading Remarks]
  2670. Only valid after parsing a complete header.
  2671. [heading Parameters] [table [[Name][Description]] [[`ec`][
  2672. Set to the error, if any occurred. ]] ]
  2673. [endsect] [section:skip http::basic_parser::skip] [indexterm2 skip..http::basic_parser]
  2674. Returns `true` if the skip parse option is set. ``` bool ``[link beast.ref.boost__beast__http__basic_parser.skip.overload1 skip]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_parser.skip.overload1 more...]]`` ```
  2675. Set the skip parse option. ``` void ``[link beast.ref.boost__beast__http__basic_parser.skip.overload2 skip]``( bool v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__basic_parser.skip.overload2 more...]]`` ``` [section:overload1 http::basic_parser::skip (1 of 2 overloads)]
  2676. Returns `true` if the skip parse option is set. [heading Synopsis] ``` bool skip() const; ``` [heading Description] [endsect] [section:overload2 http::basic_parser::skip (2 of 2 overloads)]
  2677. Set the skip parse option. [heading Synopsis] ``` void skip( bool v); ``` [heading Description]
  2678. This option controls whether or not the parser expects to see an HTTP body, regardless of the presence or absence of certain fields such as Content-Length or a chunked Transfer-Encoding. Depending on the request, some responses do not carry a body. For example, a 200 response to a CONNECT request from a tunneling proxy, or a response to a HEAD request. In these cases, callers may use this function inform the parser that no body is expected. The parser will consider the message complete after the header has been received.
  2679. [heading Parameters] [table [[Name][Description]] [[`v`][
  2680. `true` to set the skip body option or `false` to disable it. ]] ]
  2681. [heading Remarks]
  2682. This function must called before any bytes are processed.
  2683. [endsect] [endsect] [section:upgrade http::basic_parser::upgrade] [indexterm2 upgrade..http::basic_parser]
  2684. Returns `true` if the message is an upgrade message. [heading Synopsis] ``` bool upgrade() const; ``` [heading Description]
  2685. [heading Remarks]
  2686. The return value is undefined unless [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] would return `true`.
  2687. [endsect] [section:basic_parser_dtor_ http::basic_parser::~basic_parser] [indexterm2 ~basic_parser..http::basic_parser]
  2688. Destructor. [heading Synopsis] ``` virtual ~basic_parser(); ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__basic_string_body http::basic_string_body]
  2689. A ['Body] using `std::basic_string` [heading Synopsis] Defined in header [include_file boost/beast/http/string_body.hpp] ``` template< class CharT, class Traits = std::char_traits<CharT>, class __Allocator__ = std::allocator<CharT>> struct basic_string_body ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_string_body.reader [*reader]]] [ The algorithm for parsing the body. ] ] [ [[link beast.ref.boost__beast__http__basic_string_body.value_type [*value_type]]] [ The type of container used for the body. ] ] [ [[link beast.ref.boost__beast__http__basic_string_body.writer [*writer]]] [ The algorithm for serializing the body. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_string_body.size [*size]]] [ Returns the payload size of the body. ] ] ] [heading Description]
  2690. This body uses `std::basic_string` as a memory-based container for holding message payloads. Messages using this body type may be serialized and parsed. [section:reader http::basic_string_body::reader] [indexterm2 reader..http::basic_string_body]
  2691. The algorithm for parsing the body. [heading Synopsis] ``` using reader = ``['implementation-defined]``; ``` [heading Description]
  2692. Meets the requirements of ['BodyReader]. [endsect] [section:size http::basic_string_body::size] [indexterm2 size..http::basic_string_body]
  2693. Returns the payload size of the body. [heading Synopsis] ``` static std::uint64_t size( value_type const& body); ``` [heading Description]
  2694. When this body is used with [link beast.ref.boost__beast__http__message.prepare_payload `http::message::prepare_payload`], the Content-Length will be set to the payload size, and any chunked Transfer-Encoding will be removed. [endsect] [section:value_type http::basic_string_body::value_type] [indexterm2 value_type..http::basic_string_body]
  2695. The type of container used for the body. [heading Synopsis] ``` using value_type = std::basic_string< CharT, Traits, Allocator >; ``` [heading Description]
  2696. This determines the type of [link beast.ref.boost__beast__http__message.body `http::message::body`] when this body type is used with a message container. [endsect] [section:writer http::basic_string_body::writer] [indexterm2 writer..http::basic_string_body]
  2697. The algorithm for serializing the body. [heading Synopsis] ``` using writer = ``['implementation-defined]``; ``` [heading Description]
  2698. Meets the requirements of ['BodyWriter]. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__buffer_body http::buffer_body]
  2699. A ['Body] using a caller provided buffer. [heading Synopsis] Defined in header [include_file boost/beast/http/buffer_body.hpp] ``` struct buffer_body ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__buffer_body__value_type [*value_type]]] [ The type of the body member when used in a message. ] ] [ [[link beast.ref.boost__beast__http__buffer_body.reader [*reader]]] [ The algorithm for parsing the body. ] ] [ [[link beast.ref.boost__beast__http__buffer_body.writer [*writer]]] [ The algorithm for serializing the body. ] ] ] [heading Description]
  2700. Messages using this body type may be serialized and parsed. To use this class, the caller must initialize the members of [link beast.ref.boost__beast__http__buffer_body__value_type `http::buffer_body::value_type`] to appropriate values before each call to read or write during a stream operation. [section:reader http::buffer_body::reader] [indexterm2 reader..http::buffer_body]
  2701. The algorithm for parsing the body. [heading Synopsis] ``` using reader = ``['implementation-defined]``; ``` [heading Description]
  2702. Meets the requirements of ['BodyReader]. [endsect] [section:writer http::buffer_body::writer] [indexterm2 writer..http::buffer_body]
  2703. The algorithm for serializing the body. [heading Synopsis] ``` using writer = ``['implementation-defined]``; ``` [heading Description]
  2704. Meets the requirements of ['BodyWriter]. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__buffer_body__value_type http::buffer_body::value_type]
  2705. The type of the body member when used in a message. [heading Synopsis] Defined in header [include_file boost/beast/http/buffer_body.hpp] ``` struct value_type ``` [heading Data Members] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__buffer_body__value_type.data [*data]]] [ A pointer to a contiguous area of memory of size octets, else nullptr. ] ] [ [[link beast.ref.boost__beast__http__buffer_body__value_type.more [*more]]] [ true if this is not the last buffer. ] ] [ [[link beast.ref.boost__beast__http__buffer_body__value_type.size [*size]]] [ The number of octets in the buffer pointed to by data. ] ] ] [heading Description] [section:data http::buffer_body::value_type::data] [indexterm2 data..http::buffer_body::value_type]
  2706. A pointer to a contiguous area of memory of [link beast.ref.boost__beast__http__buffer_body__value_type.size `http::buffer_body::value_type::size`] octets, else `nullptr`. [heading Synopsis] ``` void * data = nullptr; ``` [heading Description]
  2707. [heading When Serializing]
  2708. If this is `nullptr` and `more` is `true`, the error [link beast.ref.boost__beast__http__error `http::need_buffer`] will be returned from [link beast.ref.boost__beast__http__serializer.get `http::serializer::get`] Otherwise, the serializer will use the memory pointed to by `data` having `size` octets of valid storage as the next buffer representing the body.
  2709. [heading When Parsing]
  2710. If this is `nullptr`, the error [link beast.ref.boost__beast__http__error `http::need_buffer`] will be returned from [link beast.ref.boost__beast__http__basic_parser.put `http::basic_parser::put`]. Otherwise, the parser will store body octets into the memory pointed to by `data` having `size` octets of valid storage. After octets are stored, the `data` and `size` members are adjusted: `data` is incremented to point to the next octet after the data written, while `size` is decremented to reflect the remaining space at the memory location pointed to by `data`. [endsect] [section:more http::buffer_body::value_type::more] [indexterm2 more..http::buffer_body::value_type]
  2711. `true` if this is not the last buffer. [heading Synopsis] ``` bool more = true; ``` [heading Description]
  2712. [heading When Serializing]
  2713. If this is `true` and `data` is `nullptr`, the error [link beast.ref.boost__beast__http__error `http::need_buffer`] will be returned from [link beast.ref.boost__beast__http__serializer.get `http::serializer::get`]
  2714. [heading When Parsing]
  2715. This field is not used during parsing. [endsect] [section:size http::buffer_body::value_type::size] [indexterm2 size..http::buffer_body::value_type]
  2716. The number of octets in the buffer pointed to by [link beast.ref.boost__beast__http__buffer_body__value_type.data `http::buffer_body::value_type::data`]. [heading Synopsis] ``` std::size_t size = 0; ``` [heading Description]
  2717. [heading When Serializing]
  2718. If `data` is `nullptr` during serialization, this value is ignored. Otherwise, it represents the number of valid body octets pointed to by `data`.
  2719. [heading When Parsing]
  2720. The value of this field will be decremented during parsing to indicate the number of remaining free octets in the buffer pointed to by `data`. When it reaches zero, the parser will return [link beast.ref.boost__beast__http__error `http::need_buffer`], indicating to the caller that the values of `data` and `size` should be updated to point to a new memory buffer. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__chunk_body http::chunk_body]
  2721. A ['chunk]. [heading Synopsis] Defined in header [include_file boost/beast/http/chunk_encode.hpp] ``` template< class __ConstBufferSequence__> class chunk_body ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__chunk_body.const_iterator [*const_iterator]]] [ Required for ConstBufferSequence ] ] [ [[link beast.ref.boost__beast__http__chunk_body.value_type [*value_type]]] [ Required for ConstBufferSequence ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__chunk_body.begin [*begin]]] [ Required for ConstBufferSequence ] ] [ [[link beast.ref.boost__beast__http__chunk_body.chunk_body [*chunk_body]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__chunk_body.end [*end]]] [ Required for ConstBufferSequence ] ] ] [heading Description]
  2722. This implements a ['ConstBufferSequence] representing a ['chunk]. The serialized format is as follows: ``` chunk = chunk-size [ chunk-ext ] CRLF chunk-data CRLF
  2723. chunk-size = 1*HEXDIG
  2724. chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
  2725. chunk-ext-name = token
  2726. chunk-ext-val = token / quoted-string
  2727. chunk-data = 1*OCTET ; a sequence of chunk-size octets
  2728. ``` The chunk extension is optional.
  2729. To use this class, pass an instance of it to a stream algorithm as the buffer sequence.
  2730. [heading See Also]
  2731. [@https://tools.ietf.org/html/rfc7230#section-4.1 https://tools.ietf.org/html/rfc7230#section-4.1]
  2732. [section:begin http::chunk_body::begin] [indexterm2 begin..http::chunk_body]
  2733. Required for ['ConstBufferSequence] [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:chunk_body http::chunk_body::chunk_body] [indexterm2 chunk_body..http::chunk_body]
  2734. Constructor. ``` explicit ``[link beast.ref.boost__beast__http__chunk_body.chunk_body.overload1 chunk_body]``( ConstBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_body.chunk_body.overload1 more...]]`` ``[link beast.ref.boost__beast__http__chunk_body.chunk_body.overload2 chunk_body]``( ConstBufferSequence const& buffers, string_view extensions); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_body.chunk_body.overload2 more...]]`` template< class ChunkExtensions> ``[link beast.ref.boost__beast__http__chunk_body.chunk_body.overload3 chunk_body]``( ConstBufferSequence const& buffers, ChunkExtensions&& extensions); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_body.chunk_body.overload3 more...]]`` template< class ChunkExtensions, class __Allocator__> ``[link beast.ref.boost__beast__http__chunk_body.chunk_body.overload4 chunk_body]``( ConstBufferSequence const& buffers, ChunkExtensions&& extensions, Allocator const& allocator); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_body.chunk_body.overload4 more...]]`` ``` [section:overload1 http::chunk_body::chunk_body (1 of 4 overloads)]
  2735. Constructor. [heading Synopsis] ``` chunk_body( ConstBufferSequence const& buffers); ``` [heading Description]
  2736. This constructs buffers representing a complete ['chunk] with no chunk extensions and having the size and contents of the specified buffer sequence.
  2737. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  2738. A buffer sequence representing the chunk body. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid while this object is in use. ]] ]
  2739. [heading See Also]
  2740. [@https://tools.ietf.org/html/rfc7230#section-4.1 https://tools.ietf.org/html/rfc7230#section-4.1]
  2741. [endsect] [section:overload2 http::chunk_body::chunk_body (2 of 4 overloads)]
  2742. Constructor. [heading Synopsis] ``` chunk_body( ConstBufferSequence const& buffers, string_view extensions); ``` [heading Description]
  2743. This constructs buffers representing a complete ['chunk] with the passed chunk extensions and having the size and contents of the specified buffer sequence.
  2744. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  2745. A buffer sequence representing the chunk body. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid while this object is in use. ]] [[`extensions`][
  2746. The chunk extensions string. This string must be formatted correctly as per rfc7230, using this BNF syntax: ``` chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
  2747. chunk-ext-name = token
  2748. chunk-ext-val = token / quoted-string
  2749. ``` The data pointed to by this string view must remain valid for the lifetime of any operations performed on the object. ]] ]
  2750. [heading See Also]
  2751. [@https://tools.ietf.org/html/rfc7230#section-4.1.1 https://tools.ietf.org/html/rfc7230#section-4.1.1]
  2752. [endsect] [section:overload3 http::chunk_body::chunk_body (3 of 4 overloads)]
  2753. Constructor. [heading Synopsis] ``` template< class ChunkExtensions> chunk_body( ConstBufferSequence const& buffers, ChunkExtensions&& extensions); ``` [heading Description]
  2754. This constructs buffers representing a complete ['chunk] with the passed chunk extensions and having the size and contents of the specified buffer sequence. The default allocator is used to provide storage for the extensions object.
  2755. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  2756. A buffer sequence representing the chunk body. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid while this object is in use. ]] [[`extensions`][
  2757. The chunk extensions object. The expression `extensions.str()` must be valid, and the return type must be convertible to [link beast.ref.boost__beast__string_view `string_view`]. This object will be copied or moved as needed to ensure that the chunk header object retains ownership of the buffers provided by the chunk extensions object. ]] ]
  2758. [heading Remarks]
  2759. This function participates in overload resolution only if [*ChunkExtensions] meets the requirements stated above.
  2760. [heading See Also]
  2761. [@https://tools.ietf.org/html/rfc7230#section-4.1 https://tools.ietf.org/html/rfc7230#section-4.1]
  2762. [endsect] [section:overload4 http::chunk_body::chunk_body (4 of 4 overloads)]
  2763. Constructor. [heading Synopsis] ``` template< class ChunkExtensions, class __Allocator__> chunk_body( ConstBufferSequence const& buffers, ChunkExtensions&& extensions, Allocator const& allocator); ``` [heading Description]
  2764. This constructs buffers representing a complete ['chunk] with the passed chunk extensions and having the size and contents of the specified buffer sequence. The specified allocator is used to provide storage for the extensions object.
  2765. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  2766. A buffer sequence representing the chunk body. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid while this object is in use. ]] [[`extensions`][
  2767. The chunk extensions object. The expression `extensions.str()` must be valid, and the return type must be convertible to [link beast.ref.boost__beast__string_view `string_view`]. This object will be copied or moved as needed to ensure that the chunk header object retains ownership of the buffers provided by the chunk extensions object. ]] [[`allocator`][
  2768. The allocator to provide storage for the moved or copied extensions object. ]] ]
  2769. [heading Remarks]
  2770. This function participates in overload resolution only if [*ChunkExtensions] meets the requirements stated above.
  2771. [heading See Also]
  2772. [@https://tools.ietf.org/html/rfc7230#section-4.1 https://tools.ietf.org/html/rfc7230#section-4.1]
  2773. [endsect] [endsect] [section:const_iterator http::chunk_body::const_iterator] [indexterm2 const_iterator..http::chunk_body]
  2774. Required for ['ConstBufferSequence] [heading Synopsis] ``` using const_iterator = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:end http::chunk_body::end] [indexterm2 end..http::chunk_body]
  2775. Required for ['ConstBufferSequence] [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:value_type http::chunk_body::value_type] [indexterm2 value_type..http::chunk_body]
  2776. Required for ['ConstBufferSequence] [heading Synopsis] ``` using value_type = ``['implementation-defined]``; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__chunk_crlf http::chunk_crlf]
  2777. A chunked encoding crlf. [heading Synopsis] Defined in header [include_file boost/beast/http/chunk_encode.hpp] ``` struct chunk_crlf ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__chunk_crlf.const_iterator [*const_iterator]]] [ Required for ConstBufferSequence ] ] [ [[link beast.ref.boost__beast__http__chunk_crlf.value_type [*value_type]]] [ Required for ConstBufferSequence ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__chunk_crlf.begin [*begin]]] [ Required for ConstBufferSequence ] ] [ [[link beast.ref.boost__beast__http__chunk_crlf.chunk_crlf [*chunk_crlf]]] [ Constructor. Required for ConstBufferSequence ] ] [ [[link beast.ref.boost__beast__http__chunk_crlf.end [*end]]] [ Required for ConstBufferSequence ] ] ] [heading Description]
  2778. This implements a ['ConstBufferSequence] holding the CRLF (`"\r\n"`) used as a delimiter in a ['chunk].
  2779. To use this class, pass an instance of it to a stream algorithm as the buffer sequence: ``` // writes "\r\n"
  2780. net::write(stream, chunk_crlf{});
  2781. ```
  2782. [heading See Also]
  2783. [@https://tools.ietf.org/html/rfc7230#section-4.1 https://tools.ietf.org/html/rfc7230#section-4.1]
  2784. [section:begin http::chunk_crlf::begin] [indexterm2 begin..http::chunk_crlf]
  2785. Required for ['ConstBufferSequence] [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:chunk_crlf http::chunk_crlf::chunk_crlf] [indexterm2 chunk_crlf..http::chunk_crlf]
  2786. Constructor. ``` ``[link beast.ref.boost__beast__http__chunk_crlf.chunk_crlf.overload1 chunk_crlf]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_crlf.chunk_crlf.overload1 more...]]`` ```
  2787. Required for ['ConstBufferSequence] ``` ``[link beast.ref.boost__beast__http__chunk_crlf.chunk_crlf.overload2 chunk_crlf]``( chunk_crlf const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_crlf.chunk_crlf.overload2 more...]]`` ``` [section:overload1 http::chunk_crlf::chunk_crlf (1 of 2 overloads)]
  2788. Constructor. [heading Synopsis] ``` chunk_crlf(); ``` [heading Description] [endsect] [section:overload2 http::chunk_crlf::chunk_crlf (2 of 2 overloads)]
  2789. Required for ['ConstBufferSequence] [heading Synopsis] ``` chunk_crlf( chunk_crlf const&); ``` [heading Description] [endsect] [endsect] [section:const_iterator http::chunk_crlf::const_iterator] [indexterm2 const_iterator..http::chunk_crlf]
  2790. Required for ['ConstBufferSequence] [heading Synopsis] ``` using const_iterator = value_type const *; ``` [heading Description] [endsect] [section:end http::chunk_crlf::end] [indexterm2 end..http::chunk_crlf]
  2791. Required for ['ConstBufferSequence] [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:value_type http::chunk_crlf::value_type] [indexterm2 value_type..http::chunk_crlf]
  2792. Required for ['ConstBufferSequence] [heading Synopsis] ``` using value_type = ``['implementation-defined]``; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__chunk_extensions http::chunk_extensions] [indexterm1 http::chunk_extensions]
  2793. A set of chunk extensions. [heading Synopsis] Defined in header [include_file boost/beast/http/chunk_encode.hpp] ``` using chunk_extensions = basic_chunk_extensions< std::allocator< char > >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.value_type [*value_type]]] [ The type of value when iterating. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.basic_chunk_extensions [*basic_chunk_extensions]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.begin [*begin]]] [ ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.clear [*clear]]] [ Clear the chunk extensions. ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.end [*end]]] [ ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.insert [*insert]]] [ Insert an extension name with an empty value. Insert an extension value. ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.parse [*parse]]] [ Parse a set of chunk extensions. ] ] [ [[link beast.ref.boost__beast__http__basic_chunk_extensions.str [*str]]] [ Return the serialized representation of the chunk extension. ] ] ]
  2794. This container stores a set of chunk extensions suited for use with [link beast.ref.boost__beast__http__chunk_header `http::chunk_header`] and [link beast.ref.boost__beast__http__chunk_body `http::chunk_body`]. The container may be iterated to access the extensions in their structured form.
  2795. Meets the requirements of ChunkExtensions [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__chunk_header http::chunk_header]
  2796. A ['chunk] header. [heading Synopsis] Defined in header [include_file boost/beast/http/chunk_encode.hpp] ``` class chunk_header ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__chunk_header.const_iterator [*const_iterator]]] [ Required for ConstBufferSequence ] ] [ [[link beast.ref.boost__beast__http__chunk_header.value_type [*value_type]]] [ Required for ConstBufferSequence ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__chunk_header.begin [*begin]]] [ Required for ConstBufferSequence ] ] [ [[link beast.ref.boost__beast__http__chunk_header.chunk_header [*chunk_header]]] [ Constructor. Required for ConstBufferSequence ] ] [ [[link beast.ref.boost__beast__http__chunk_header.end [*end]]] [ Required for ConstBufferSequence ] ] ] [heading Description]
  2797. This implements a ['ConstBufferSequence] representing the header of a ['chunk]. The serialized format is as follows: ``` chunk-header = 1*HEXDIG chunk-ext CRLF
  2798. chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
  2799. chunk-ext-name = token
  2800. chunk-ext-val = token / quoted-string
  2801. ``` The chunk extension is optional. After the header and chunk body have been serialized, it is the callers responsibility to also serialize the final CRLF (`"\r\n"`).
  2802. This class allows the caller to emit piecewise chunk bodies, by first serializing the chunk header using this class and then serializing the chunk body in a series of one or more calls to a stream write operation.
  2803. To use this class, pass an instance of it to a stream algorithm as the buffer sequence: ``` // writes "400;x\r\n"
  2804. net::write(stream, chunk_header{1024, "x"});
  2805. ```
  2806. [heading See Also]
  2807. [@https://tools.ietf.org/html/rfc7230#section-4.1 https://tools.ietf.org/html/rfc7230#section-4.1]
  2808. [section:begin http::chunk_header::begin] [indexterm2 begin..http::chunk_header]
  2809. Required for ['ConstBufferSequence] [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:chunk_header http::chunk_header::chunk_header] [indexterm2 chunk_header..http::chunk_header]
  2810. Constructor. ``` explicit ``[link beast.ref.boost__beast__http__chunk_header.chunk_header.overload1 chunk_header]``( std::size_t size); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_header.chunk_header.overload1 more...]]`` ``[link beast.ref.boost__beast__http__chunk_header.chunk_header.overload2 chunk_header]``( std::size_t size, string_view extensions); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_header.chunk_header.overload2 more...]]`` template< class ChunkExtensions> ``[link beast.ref.boost__beast__http__chunk_header.chunk_header.overload3 chunk_header]``( std::size_t size, ChunkExtensions&& extensions); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_header.chunk_header.overload3 more...]]`` template< class ChunkExtensions, class __Allocator__> ``[link beast.ref.boost__beast__http__chunk_header.chunk_header.overload4 chunk_header]``( std::size_t size, ChunkExtensions&& extensions, Allocator const& allocator); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_header.chunk_header.overload4 more...]]`` ```
  2811. Required for ['ConstBufferSequence] ``` ``[link beast.ref.boost__beast__http__chunk_header.chunk_header.overload5 chunk_header]``( chunk_header const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_header.chunk_header.overload5 more...]]`` ``` [section:overload1 http::chunk_header::chunk_header (1 of 5 overloads)]
  2812. Constructor. [heading Synopsis] ``` chunk_header( std::size_t size); ``` [heading Description]
  2813. This constructs a buffer sequence representing a ['chunked-body] size and terminating CRLF (`"\r\n"`) with no chunk extensions.
  2814. [heading Parameters] [table [[Name][Description]] [[`size`][
  2815. The size of the chunk body that follows. The value must be greater than zero. ]] ]
  2816. [heading See Also]
  2817. [@https://tools.ietf.org/html/rfc7230#section-4.1 https://tools.ietf.org/html/rfc7230#section-4.1]
  2818. [endsect] [section:overload2 http::chunk_header::chunk_header (2 of 5 overloads)]
  2819. Constructor. [heading Synopsis] ``` chunk_header( std::size_t size, string_view extensions); ``` [heading Description]
  2820. This constructs a buffer sequence representing a ['chunked-body] size and terminating CRLF (`"\r\n"`) with provided chunk extensions.
  2821. [heading Parameters] [table [[Name][Description]] [[`size`][
  2822. The size of the chunk body that follows. The value must be greater than zero. ]] [[`extensions`][
  2823. The chunk extensions string. This string must be formatted correctly as per rfc7230, using this BNF syntax: ``` chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
  2824. chunk-ext-name = token
  2825. chunk-ext-val = token / quoted-string
  2826. ``` The data pointed to by this string view must remain valid for the lifetime of any operations performed on the object. ]] ]
  2827. [heading See Also]
  2828. [@https://tools.ietf.org/html/rfc7230#section-4.1.1 https://tools.ietf.org/html/rfc7230#section-4.1.1]
  2829. [endsect] [section:overload3 http::chunk_header::chunk_header (3 of 5 overloads)]
  2830. Constructor. [heading Synopsis] ``` template< class ChunkExtensions> chunk_header( std::size_t size, ChunkExtensions&& extensions); ``` [heading Description]
  2831. This constructs a buffer sequence representing a ['chunked-body] size and terminating CRLF (`"\r\n"`) with provided chunk extensions. The default allocator is used to provide storage for the extensions object.
  2832. [heading Parameters] [table [[Name][Description]] [[`size`][
  2833. The size of the chunk body that follows. The value must be greater than zero. ]] [[`extensions`][
  2834. The chunk extensions object. The expression `extensions.str()` must be valid, and the return type must be convertible to [link beast.ref.boost__beast__string_view `string_view`]. This object will be copied or moved as needed to ensure that the chunk header object retains ownership of the buffers provided by the chunk extensions object. ]] ]
  2835. [heading Remarks]
  2836. This function participates in overload resolution only if [*ChunkExtensions] meets the requirements stated above.
  2837. [heading See Also]
  2838. [@https://tools.ietf.org/html/rfc7230#section-4.1 https://tools.ietf.org/html/rfc7230#section-4.1]
  2839. [endsect] [section:overload4 http::chunk_header::chunk_header (4 of 5 overloads)]
  2840. Constructor. [heading Synopsis] ``` template< class ChunkExtensions, class __Allocator__> chunk_header( std::size_t size, ChunkExtensions&& extensions, Allocator const& allocator); ``` [heading Description]
  2841. This constructs a buffer sequence representing a ['chunked-body] size and terminating CRLF (`"\r\n"`) with provided chunk extensions. The specified allocator is used to provide storage for the extensions object.
  2842. [heading Parameters] [table [[Name][Description]] [[`size`][
  2843. The size of the chunk body that follows. The value be greater than zero. ]] [[`extensions`][
  2844. The chunk extensions object. The expression `extensions.str()` must be valid, and the return type must be convertible to [link beast.ref.boost__beast__string_view `string_view`]. This object will be copied or moved as needed to ensure that the chunk header object retains ownership of the buffers provided by the chunk extensions object. ]] [[`allocator`][
  2845. The allocator to provide storage for the moved or copied extensions object. ]] ]
  2846. [heading Remarks]
  2847. This function participates in overload resolution only if [*ChunkExtensions] meets the requirements stated above.
  2848. [heading See Also]
  2849. [@https://tools.ietf.org/html/rfc7230#section-4.1 https://tools.ietf.org/html/rfc7230#section-4.1]
  2850. [endsect] [section:overload5 http::chunk_header::chunk_header (5 of 5 overloads)]
  2851. Required for ['ConstBufferSequence] [heading Synopsis] ``` chunk_header( chunk_header const&); ``` [heading Description] [endsect] [endsect] [section:const_iterator http::chunk_header::const_iterator] [indexterm2 const_iterator..http::chunk_header]
  2852. Required for ['ConstBufferSequence] [heading Synopsis] ``` using const_iterator = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:end http::chunk_header::end] [indexterm2 end..http::chunk_header]
  2853. Required for ['ConstBufferSequence] [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:value_type http::chunk_header::value_type] [indexterm2 value_type..http::chunk_header]
  2854. Required for ['ConstBufferSequence] [heading Synopsis] ``` using value_type = ``['implementation-defined]``; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__chunk_last http::chunk_last]
  2855. A chunked-encoding last chunk. [heading Synopsis] Defined in header [include_file boost/beast/http/chunk_encode.hpp] ``` template< class Trailer = chunk_crlf> class chunk_last ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__chunk_last.const_iterator [*const_iterator]]] [ Required for ConstBufferSequence ] ] [ [[link beast.ref.boost__beast__http__chunk_last.value_type [*value_type]]] [ Required for ConstBufferSequence ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__chunk_last.begin [*begin]]] [ Required for ConstBufferSequence ] ] [ [[link beast.ref.boost__beast__http__chunk_last.chunk_last [*chunk_last]]] [ Constructor. Required for ConstBufferSequence ] ] [ [[link beast.ref.boost__beast__http__chunk_last.end [*end]]] [ Required for ConstBufferSequence ] ] ] [heading Description] [section:begin http::chunk_last::begin] [indexterm2 begin..http::chunk_last]
  2856. Required for ['ConstBufferSequence] [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:chunk_last http::chunk_last::chunk_last] [indexterm2 chunk_last..http::chunk_last]
  2857. Constructor. ``` ``[link beast.ref.boost__beast__http__chunk_last.chunk_last.overload1 chunk_last]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_last.chunk_last.overload1 more...]]`` explicit ``[link beast.ref.boost__beast__http__chunk_last.chunk_last.overload2 chunk_last]``( Trailer const& trailer); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_last.chunk_last.overload2 more...]]`` template< class __Allocator__> ``[link beast.ref.boost__beast__http__chunk_last.chunk_last.overload3 chunk_last]``( Trailer const& trailer, Allocator const& allocator); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_last.chunk_last.overload3 more...]]`` ```
  2858. Required for ['ConstBufferSequence] ``` ``[link beast.ref.boost__beast__http__chunk_last.chunk_last.overload4 chunk_last]``( chunk_last const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__chunk_last.chunk_last.overload4 more...]]`` ``` [section:overload1 http::chunk_last::chunk_last (1 of 4 overloads)]
  2859. Constructor. [heading Synopsis] ``` chunk_last(); ``` [heading Description]
  2860. The last chunk will have an empty trailer [endsect] [section:overload2 http::chunk_last::chunk_last (2 of 4 overloads)]
  2861. Constructor. [heading Synopsis] ``` chunk_last( Trailer const& trailer); ``` [heading Description]
  2862. [heading Parameters] [table [[Name][Description]] [[`trailer`][
  2863. The trailer to use. This may be a type meeting the requirements of either Fields or ConstBufferSequence. If it is a ConstBufferSequence, the trailer must be formatted correctly as per rfc7230 including a CRLF on its own line to denote the end of the trailer. ]] ]
  2864. [endsect] [section:overload3 http::chunk_last::chunk_last (3 of 4 overloads)]
  2865. Constructor. [heading Synopsis] ``` template< class __Allocator__> chunk_last( Trailer const& trailer, Allocator const& allocator); ``` [heading Description]
  2866. [heading Parameters] [table [[Name][Description]] [[`trailer`][
  2867. The trailer to use. This type must meet the requirements of Fields. ]] [[`allocator`][
  2868. The allocator to use for storing temporary data associated with the serialized trailer buffers. ]] ]
  2869. [endsect] [section:overload4 http::chunk_last::chunk_last (4 of 4 overloads)]
  2870. Required for ['ConstBufferSequence] [heading Synopsis] ``` chunk_last( chunk_last const&); ``` [heading Description] [endsect] [endsect] [section:const_iterator http::chunk_last::const_iterator] [indexterm2 const_iterator..http::chunk_last]
  2871. Required for ['ConstBufferSequence] [heading Synopsis] ``` using const_iterator = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:end http::chunk_last::end] [indexterm2 end..http::chunk_last]
  2872. Required for ['ConstBufferSequence] [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:value_type http::chunk_last::value_type] [indexterm2 value_type..http::chunk_last]
  2873. Required for ['ConstBufferSequence] [heading Synopsis] ``` using value_type = ``['implementation-defined]``; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__dynamic_body http::dynamic_body] [indexterm1 http::dynamic_body]
  2874. A dynamic message body represented by a [link beast.ref.boost__beast__multi_buffer `multi_buffer`]. [heading Synopsis] Defined in header [include_file boost/beast/http/dynamic_body.hpp] ``` using dynamic_body = basic_dynamic_body< multi_buffer >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_dynamic_body.reader [*reader]]] [ The algorithm for parsing the body. ] ] [ [[link beast.ref.boost__beast__http__basic_dynamic_body.value_type [*value_type]]] [ The type of container used for the body. ] ] [ [[link beast.ref.boost__beast__http__basic_dynamic_body.writer [*writer]]] [ The algorithm for serializing the body. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_dynamic_body.size [*size]]] [ Returns the payload size of the body. ] ] ]
  2875. This body uses a ['DynamicBuffer] as a memory-based container for holding message payloads. Messages using this body type may be serialized and parsed. [heading Description]
  2876. Meets the requirements of ['Body]. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__empty_body http::empty_body]
  2877. An empty ['Body] [heading Synopsis] Defined in header [include_file boost/beast/http/empty_body.hpp] ``` struct empty_body ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__empty_body__value_type [*value_type]]] [ The type of container used for the body. ] ] [ [[link beast.ref.boost__beast__http__empty_body.reader [*reader]]] [ The algorithm for parsing the body. ] ] [ [[link beast.ref.boost__beast__http__empty_body.writer [*writer]]] [ The algorithm for serializing the body. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__empty_body.size [*size]]] [ Returns the payload size of the body. ] ] ] [heading Description]
  2878. This body is used to represent messages which do not have a message body. If this body is used with a parser, and the parser encounters octets corresponding to a message body, the parser will fail with the error [link beast.ref.boost__beast__http__error `http::unexpected_body`].
  2879. The Content-Length of this body is always 0. [section:reader http::empty_body::reader] [indexterm2 reader..http::empty_body]
  2880. The algorithm for parsing the body. [heading Synopsis] ``` using reader = ``['implementation-defined]``; ``` [heading Description]
  2881. Meets the requirements of ['BodyReader]. [endsect] [section:size http::empty_body::size] [indexterm2 size..http::empty_body]
  2882. Returns the payload size of the body. [heading Synopsis] ``` static std::uint64_t size( value_type); ``` [heading Description]
  2883. When this body is used with [link beast.ref.boost__beast__http__message.prepare_payload `http::message::prepare_payload`], the Content-Length will be set to the payload size, and any chunked Transfer-Encoding will be removed. [endsect] [section:writer http::empty_body::writer] [indexterm2 writer..http::empty_body]
  2884. The algorithm for serializing the body. [heading Synopsis] ``` using writer = ``['implementation-defined]``; ``` [heading Description]
  2885. Meets the requirements of ['BodyWriter]. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__empty_body__value_type http::empty_body::value_type]
  2886. The type of container used for the body. [heading Synopsis] Defined in header [include_file boost/beast/http/empty_body.hpp] ``` struct value_type ``` [heading Description]
  2887. This determines the type of [link beast.ref.boost__beast__http__message.body `http::message::body`] when this body type is used with a message container. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__error http::error] [indexterm1 http::error]
  2888. Error codes returned from HTTP algorithms and operations. [heading Synopsis] Defined in header [include_file boost/beast/http/error.hpp] ``` enum error ``` [indexterm2 end_of_stream..http::error] [indexterm2 partial_message..http::error] [indexterm2 need_more..http::error] [indexterm2 unexpected_body..http::error] [indexterm2 need_buffer..http::error] [indexterm2 end_of_chunk..http::error] [indexterm2 buffer_overflow..http::error] [indexterm2 header_limit..http::error] [indexterm2 body_limit..http::error] [indexterm2 bad_alloc..http::error] [indexterm2 bad_line_ending..http::error] [indexterm2 bad_method..http::error] [indexterm2 bad_target..http::error] [indexterm2 bad_version..http::error] [indexterm2 bad_status..http::error] [indexterm2 bad_reason..http::error] [indexterm2 bad_field..http::error] [indexterm2 bad_value..http::error] [indexterm2 bad_content_length..http::error] [indexterm2 bad_transfer_encoding..http::error] [indexterm2 bad_chunk..http::error] [indexterm2 bad_chunk_extension..http::error] [indexterm2 bad_obs_fold..http::error] [indexterm2 stale_parser..http::error] [heading Values] [table [[Name][Description]] [[[^end_of_stream]][The end of the stream was reached. This error is returned when attempting to read HTTP data,
  2889. and the stream returns the error `net::error::eof`
  2890. before any octets corresponding to a new HTTP message have
  2891. been received.
  2892. ]] [[[^partial_message]][The incoming message is incomplete. This happens when the end of stream is reached during
  2893. parsing and some octets have been received, but not the
  2894. entire message.
  2895. ]] [[[^need_more]][Additional buffers are required. This error is returned during parsing when additional
  2896. octets are needed. The caller should append more data
  2897. to the existing buffer and retry the parse operaetion.
  2898. ]] [[[^unexpected_body]][An unexpected body was encountered during parsing. This error is returned when attempting to parse body
  2899. octets into a message container which has the
  2900. @ref empty_body body type.
  2901. @see empty_body
  2902. ]] [[[^need_buffer]][Additional buffers are required. This error is returned under the following conditions:
  2903. @li During serialization when using @ref buffer_body.
  2904. The caller should update the body to point to a new
  2905. buffer or indicate that there are no more octets in
  2906. the body.
  2907. @li During parsing when using @ref buffer_body.
  2908. The caller should update the body to point to a new
  2909. storage area to receive additional body octets.
  2910. ]] [[[^end_of_chunk]][The end of a chunk was reached. ]] [[[^buffer_overflow]][Buffer maximum exceeded. This error is returned when reading HTTP content
  2911. into a dynamic buffer, and the operation would
  2912. exceed the maximum size of the buffer.
  2913. ]] [[[^header_limit]][Header limit exceeded. The parser detected an incoming message header which
  2914. exceeded a configured limit.
  2915. ]] [[[^body_limit]][Body limit exceeded. The parser detected an incoming message body which
  2916. exceeded a configured limit.
  2917. ]] [[[^bad_alloc]][A memory allocation failed. When basic_fields throws std::bad_alloc, it is
  2918. converted into this error by @ref parser.
  2919. ]] [[[^bad_line_ending]][The line ending was malformed. ]] [[[^bad_method]][The method is invalid. ]] [[[^bad_target]][The request-target is invalid. ]] [[[^bad_version]][The HTTP-version is invalid. ]] [[[^bad_status]][The status-code is invalid. ]] [[[^bad_reason]][The reason-phrase is invalid. ]] [[[^bad_field]][The field name is invalid. ]] [[[^bad_value]][The field value is invalid. ]] [[[^bad_content_length]][The Content-Length is invalid. ]] [[[^bad_transfer_encoding]][The Transfer-Encoding is invalid. ]] [[[^bad_chunk]][The chunk syntax is invalid. ]] [[[^bad_chunk_extension]][The chunk extension is invalid. ]] [[[^bad_obs_fold]][An obs-fold exceeded an internal limit. ]] [[[^stale_parser]][The parser is stale. This happens when attempting to re-use a parser that has
  2920. already completed parsing a message. Programs must construct
  2921. a new parser for each message. This can be easily done by
  2922. storing the parser in an boost or std::optional container.
  2923. ]] ] [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__ext_list http::ext_list]
  2924. A list of extensions in a comma separated HTTP field value. [heading Synopsis] Defined in header [include_file boost/beast/http/rfc7230.hpp] ``` class ext_list ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__ext_list.const_iterator [*const_iterator]]] [ A constant iterator to the list. ] ] [ [[link beast.ref.boost__beast__http__ext_list.value_type [*value_type]]] [ The type of each element in the list. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__ext_list.begin [*begin]]] [ Return a const iterator to the beginning of the list. ] ] [ [[link beast.ref.boost__beast__http__ext_list.cbegin [*cbegin]]] [ Return a const iterator to the beginning of the list. ] ] [ [[link beast.ref.boost__beast__http__ext_list.cend [*cend]]] [ Return a const iterator to the end of the list. ] ] [ [[link beast.ref.boost__beast__http__ext_list.end [*end]]] [ Return a const iterator to the end of the list. ] ] [ [[link beast.ref.boost__beast__http__ext_list.exists [*exists]]] [ Return true if a token is present in the list. ] ] [ [[link beast.ref.boost__beast__http__ext_list.ext_list [*ext_list]]] [ Construct a list. ] ] [ [[link beast.ref.boost__beast__http__ext_list.find [*find]]] [ Find a token in the list. ] ] ] [heading Description]
  2925. This container allows iteration of the extensions in an HTTP field value. The extension list is a comma separated list of token parameter list pairs.
  2926. If a parsing error is encountered while iterating the string, the behavior of the container will be as if a string containing only characters up to but excluding the first invalid character was used to construct the list.
  2927. [heading BNF]
  2928. ``` ext-list = *( "," OWS ) ext *( OWS "," [ OWS ext ] )
  2929. ext = token param-list
  2930. param-list = *( OWS ";" OWS param )
  2931. param = token OWS [ "=" OWS ( token / quoted-string ) ]
  2932. ```
  2933. To use this class, construct with the string to be parsed and then use [link beast.ref.boost__beast__http__ext_list.begin `http::ext_list::begin`] and [link beast.ref.boost__beast__http__ext_list.end `http::ext_list::end`], or range-for to iterate each item:
  2934. [heading Example]
  2935. ``` for(auto const& ext : ext_list{"none, 7z;level=9, zip;no_context_takeover;bits=15"})
  2936. {
  2937. std::cout << ext.first << "\n";
  2938. for(auto const& param : ext.second)
  2939. {
  2940. std::cout << ";" << param.first;
  2941. if(! param.second.empty())
  2942. std::cout << "=" << param.second;
  2943. std::cout << "\n";
  2944. }
  2945. }
  2946. ```
  2947. [section:begin http::ext_list::begin] [indexterm2 begin..http::ext_list]
  2948. Return a const iterator to the beginning of the list. [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:cbegin http::ext_list::cbegin] [indexterm2 cbegin..http::ext_list]
  2949. Return a const iterator to the beginning of the list. [heading Synopsis] ``` const_iterator cbegin() const; ``` [heading Description] [endsect] [section:cend http::ext_list::cend] [indexterm2 cend..http::ext_list]
  2950. Return a const iterator to the end of the list. [heading Synopsis] ``` const_iterator cend() const; ``` [heading Description] [endsect] [section:const_iterator http::ext_list::const_iterator] [indexterm2 const_iterator..http::ext_list]
  2951. A constant iterator to the list. [heading Synopsis] ``` using const_iterator = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:end http::ext_list::end] [indexterm2 end..http::ext_list]
  2952. Return a const iterator to the end of the list. [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:exists http::ext_list::exists] [indexterm2 exists..http::ext_list]
  2953. Return `true` if a token is present in the list. [heading Synopsis] ``` bool exists( string_view const& s); ``` [heading Description]
  2954. [heading Parameters] [table [[Name][Description]] [[`s`][
  2955. The token to find. A case-insensitive comparison is used. ]] ]
  2956. [endsect] [section:ext_list http::ext_list::ext_list] [indexterm2 ext_list..http::ext_list]
  2957. Construct a list. [heading Synopsis] ``` ext_list( string_view s); ``` [heading Description]
  2958. [heading Parameters] [table [[Name][Description]] [[`s`][
  2959. A string containing the list contents. The string must remain valid for the lifetime of the container. ]] ]
  2960. [endsect] [section:find http::ext_list::find] [indexterm2 find..http::ext_list]
  2961. Find a token in the list. [heading Synopsis] ``` const_iterator find( string_view const& s); ``` [heading Description]
  2962. [heading Parameters] [table [[Name][Description]] [[`s`][
  2963. The token to find. A case-insensitive comparison is used. ]] ]
  2964. [heading Return Value]
  2965. An iterator to the matching token, or `end()` if no token exists.
  2966. [endsect] [section:value_type http::ext_list::value_type] [indexterm2 value_type..http::ext_list]
  2967. The type of each element in the list. [heading Synopsis] ``` using value_type = std::pair< string_view, param_list >; ``` [heading Description]
  2968. The first element of the pair is the extension token, and the second element of the pair is an iterable container holding the extension's name/value parameters. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__field http::field] [indexterm1 http::field] [heading Synopsis] Defined in header [include_file boost/beast/http/field.hpp] ``` enum field ``` [indexterm2 unknown..http::field] [indexterm2 a_im..http::field] [indexterm2 accept..http::field] [indexterm2 accept_additions..http::field] [indexterm2 accept_charset..http::field] [indexterm2 accept_datetime..http::field] [indexterm2 accept_encoding..http::field] [indexterm2 accept_features..http::field] [indexterm2 accept_language..http::field] [indexterm2 accept_patch..http::field] [indexterm2 accept_post..http::field] [indexterm2 accept_ranges..http::field] [indexterm2 access_control..http::field] [indexterm2 access_control_allow_credentials..http::field] [indexterm2 access_control_allow_headers..http::field] [indexterm2 access_control_allow_methods..http::field] [indexterm2 access_control_allow_origin..http::field] [indexterm2 access_control_expose_headers..http::field] [indexterm2 access_control_max_age..http::field] [indexterm2 access_control_request_headers..http::field] [indexterm2 access_control_request_method..http::field] [indexterm2 age..http::field] [indexterm2 allow..http::field] [indexterm2 alpn..http::field] [indexterm2 also_control..http::field] [indexterm2 alt_svc..http::field] [indexterm2 alt_used..http::field] [indexterm2 alternate_recipient..http::field] [indexterm2 alternates..http::field] [indexterm2 apparently_to..http::field] [indexterm2 apply_to_redirect_ref..http::field] [indexterm2 approved..http::field] [indexterm2 archive..http::field] [indexterm2 archived_at..http::field] [indexterm2 article_names..http::field] [indexterm2 article_updates..http::field] [indexterm2 authentication_control..http::field] [indexterm2 authentication_info..http::field] [indexterm2 authentication_results..http::field] [indexterm2 authorization..http::field] [indexterm2 auto_submitted..http::field] [indexterm2 autoforwarded..http::field] [indexterm2 autosubmitted..http::field] [indexterm2 base..http::field] [indexterm2 bcc..http::field] [indexterm2 body..http::field] [indexterm2 c_ext..http::field] [indexterm2 c_man..http::field] [indexterm2 c_opt..http::field] [indexterm2 c_pep..http::field] [indexterm2 c_pep_info..http::field] [indexterm2 cache_control..http::field] [indexterm2 caldav_timezones..http::field] [indexterm2 cancel_key..http::field] [indexterm2 cancel_lock..http::field] [indexterm2 cc..http::field] [indexterm2 close..http::field] [indexterm2 comments..http::field] [indexterm2 compliance..http::field] [indexterm2 connection..http::field] [indexterm2 content_alternative..http::field] [indexterm2 content_base..http::field] [indexterm2 content_description..http::field] [indexterm2 content_disposition..http::field] [indexterm2 content_duration..http::field] [indexterm2 content_encoding..http::field] [indexterm2 content_features..http::field] [indexterm2 content_id..http::field] [indexterm2 content_identifier..http::field] [indexterm2 content_language..http::field] [indexterm2 content_length..http::field] [indexterm2 content_location..http::field] [indexterm2 content_md5..http::field] [indexterm2 content_range..http::field] [indexterm2 content_return..http::field] [indexterm2 content_script_type..http::field] [indexterm2 content_style_type..http::field] [indexterm2 content_transfer_encoding..http::field] [indexterm2 content_type..http::field] [indexterm2 content_version..http::field] [indexterm2 control..http::field] [indexterm2 conversion..http::field] [indexterm2 conversion_with_loss..http::field] [indexterm2 cookie..http::field] [indexterm2 cookie2..http::field] [indexterm2 cost..http::field] [indexterm2 dasl..http::field] [indexterm2 date..http::field] [indexterm2 date_received..http::field] [indexterm2 dav..http::field] [indexterm2 default_style..http::field] [indexterm2 deferred_delivery..http::field] [indexterm2 delivery_date..http::field] [indexterm2 delta_base..http::field] [indexterm2 depth..http::field] [indexterm2 derived_from..http::field] [indexterm2 destination..http::field] [indexterm2 differential_id..http::field] [indexterm2 digest..http::field] [indexterm2 discarded_x400_ipms_extensions..http::field] [indexterm2 discarded_x400_mts_extensions..http::field] [indexterm2 disclose_recipients..http::field] [indexterm2 disposition_notification_options..http::field] [indexterm2 disposition_notification_to..http::field] [indexterm2 distribution..http::field] [indexterm2 dkim_signature..http::field] [indexterm2 dl_expansion_history..http::field] [indexterm2 downgraded_bcc..http::field] [indexterm2 downgraded_cc..http::field] [indexterm2 downgraded_disposition_notification_to..http::field] [indexterm2 downgraded_final_recipient..http::field] [indexterm2 downgraded_from..http::field] [indexterm2 downgraded_in_reply_to..http::field] [indexterm2 downgraded_mail_from..http::field] [indexterm2 downgraded_message_id..http::field] [indexterm2 downgraded_original_recipient..http::field] [indexterm2 downgraded_rcpt_to..http::field] [indexterm2 downgraded_references..http::field] [indexterm2 downgraded_reply_to..http::field] [indexterm2 downgraded_resent_bcc..http::field] [indexterm2 downgraded_resent_cc..http::field] [indexterm2 downgraded_resent_from..http::field] [indexterm2 downgraded_resent_reply_to..http::field] [indexterm2 downgraded_resent_sender..http::field] [indexterm2 downgraded_resent_to..http::field] [indexterm2 downgraded_return_path..http::field] [indexterm2 downgraded_sender..http::field] [indexterm2 downgraded_to..http::field] [indexterm2 ediint_features..http::field] [indexterm2 eesst_version..http::field] [indexterm2 encoding..http::field] [indexterm2 encrypted..http::field] [indexterm2 errors_to..http::field] [indexterm2 etag..http::field] [indexterm2 expect..http::field] [indexterm2 expires..http::field] [indexterm2 expiry_date..http::field] [indexterm2 ext..http::field] [indexterm2 followup_to..http::field] [indexterm2 forwarded..http::field] [indexterm2 from..http::field] [indexterm2 generate_delivery_report..http::field] [indexterm2 getprofile..http::field] [indexterm2 hobareg..http::field] [indexterm2 host..http::field] [indexterm2 http2_settings..http::field] [indexterm2 if_..http::field] [indexterm2 if_match..http::field] [indexterm2 if_modified_since..http::field] [indexterm2 if_none_match..http::field] [indexterm2 if_range..http::field] [indexterm2 if_schedule_tag_match..http::field] [indexterm2 if_unmodified_since..http::field] [indexterm2 im..http::field] [indexterm2 importance..http::field] [indexterm2 in_reply_to..http::field] [indexterm2 incomplete_copy..http::field] [indexterm2 injection_date..http::field] [indexterm2 injection_info..http::field] [indexterm2 jabber_id..http::field] [indexterm2 keep_alive..http::field] [indexterm2 keywords..http::field] [indexterm2 label..http::field] [indexterm2 language..http::field] [indexterm2 last_modified..http::field] [indexterm2 latest_delivery_time..http::field] [indexterm2 lines..http::field] [indexterm2 link..http::field] [indexterm2 list_archive..http::field] [indexterm2 list_help..http::field] [indexterm2 list_id..http::field] [indexterm2 list_owner..http::field] [indexterm2 list_post..http::field] [indexterm2 list_subscribe..http::field] [indexterm2 list_unsubscribe..http::field] [indexterm2 list_unsubscribe_post..http::field] [indexterm2 location..http::field] [indexterm2 lock_token..http::field] [indexterm2 man..http::field] [indexterm2 max_forwards..http::field] [indexterm2 memento_datetime..http::field] [indexterm2 message_context..http::field] [indexterm2 message_id..http::field] [indexterm2 message_type..http::field] [indexterm2 meter..http::field] [indexterm2 method_check..http::field] [indexterm2 method_check_expires..http::field] [indexterm2 mime_version..http::field] [indexterm2 mmhs_acp127_message_identifier..http::field] [indexterm2 mmhs_authorizing_users..http::field] [indexterm2 mmhs_codress_message_indicator..http::field] [indexterm2 mmhs_copy_precedence..http::field] [indexterm2 mmhs_exempted_address..http::field] [indexterm2 mmhs_extended_authorisation_info..http::field] [indexterm2 mmhs_handling_instructions..http::field] [indexterm2 mmhs_message_instructions..http::field] [indexterm2 mmhs_message_type..http::field] [indexterm2 mmhs_originator_plad..http::field] [indexterm2 mmhs_originator_reference..http::field] [indexterm2 mmhs_other_recipients_indicator_cc..http::field] [indexterm2 mmhs_other_recipients_indicator_to..http::field] [indexterm2 mmhs_primary_precedence..http::field] [indexterm2 mmhs_subject_indicator_codes..http::field] [indexterm2 mt_priority..http::field] [indexterm2 negotiate..http::field] [indexterm2 newsgroups..http::field] [indexterm2 nntp_posting_date..http::field] [indexterm2 nntp_posting_host..http::field] [indexterm2 non_compliance..http::field] [indexterm2 obsoletes..http::field] [indexterm2 opt..http::field] [indexterm2 optional..http::field] [indexterm2 optional_www_authenticate..http::field] [indexterm2 ordering_type..http::field] [indexterm2 organization..http::field] [indexterm2 origin..http::field] [indexterm2 original_encoded_information_types..http::field] [indexterm2 original_from..http::field] [indexterm2 original_message_id..http::field] [indexterm2 original_recipient..http::field] [indexterm2 original_sender..http::field] [indexterm2 original_subject..http::field] [indexterm2 originator_return_address..http::field] [indexterm2 overwrite..http::field] [indexterm2 p3p..http::field] [indexterm2 path..http::field] [indexterm2 pep..http::field] [indexterm2 pep_info..http::field] [indexterm2 pics_label..http::field] [indexterm2 position..http::field] [indexterm2 posting_version..http::field] [indexterm2 pragma..http::field] [indexterm2 prefer..http::field] [indexterm2 preference_applied..http::field] [indexterm2 prevent_nondelivery_report..http::field] [indexterm2 priority..http::field] [indexterm2 privicon..http::field] [indexterm2 profileobject..http::field] [indexterm2 protocol..http::field] [indexterm2 protocol_info..http::field] [indexterm2 protocol_query..http::field] [indexterm2 protocol_request..http::field] [indexterm2 proxy_authenticate..http::field] [indexterm2 proxy_authentication_info..http::field] [indexterm2 proxy_authorization..http::field] [indexterm2 proxy_connection..http::field] [indexterm2 proxy_features..http::field] [indexterm2 proxy_instruction..http::field] [indexterm2 public_..http::field] [indexterm2 public_key_pins..http::field] [indexterm2 public_key_pins_report_only..http::field] [indexterm2 range..http::field] [indexterm2 received..http::field] [indexterm2 received_spf..http::field] [indexterm2 redirect_ref..http::field] [indexterm2 references..http::field] [indexterm2 referer..http::field] [indexterm2 referer_root..http::field] [indexterm2 relay_version..http::field] [indexterm2 reply_by..http::field] [indexterm2 reply_to..http::field] [indexterm2 require_recipient_valid_since..http::field] [indexterm2 resent_bcc..http::field] [indexterm2 resent_cc..http::field] [indexterm2 resent_date..http::field] [indexterm2 resent_from..http::field] [indexterm2 resent_message_id..http::field] [indexterm2 resent_reply_to..http::field] [indexterm2 resent_sender..http::field] [indexterm2 resent_to..http::field] [indexterm2 resolution_hint..http::field] [indexterm2 resolver_location..http::field] [indexterm2 retry_after..http::field] [indexterm2 return_path..http::field] [indexterm2 safe..http::field] [indexterm2 schedule_reply..http::field] [indexterm2 schedule_tag..http::field] [indexterm2 sec_websocket_accept..http::field] [indexterm2 sec_websocket_extensions..http::field] [indexterm2 sec_websocket_key..http::field] [indexterm2 sec_websocket_protocol..http::field] [indexterm2 sec_websocket_version..http::field] [indexterm2 security_scheme..http::field] [indexterm2 see_also..http::field] [indexterm2 sender..http::field] [indexterm2 sensitivity..http::field] [indexterm2 server..http::field] [indexterm2 set_cookie..http::field] [indexterm2 set_cookie2..http::field] [indexterm2 setprofile..http::field] [indexterm2 sio_label..http::field] [indexterm2 sio_label_history..http::field] [indexterm2 slug..http::field] [indexterm2 soapaction..http::field] [indexterm2 solicitation..http::field] [indexterm2 status_uri..http::field] [indexterm2 strict_transport_security..http::field] [indexterm2 subject..http::field] [indexterm2 subok..http::field] [indexterm2 subst..http::field] [indexterm2 summary..http::field] [indexterm2 supersedes..http::field] [indexterm2 surrogate_capability..http::field] [indexterm2 surrogate_control..http::field] [indexterm2 tcn..http::field] [indexterm2 te..http::field] [indexterm2 timeout..http::field] [indexterm2 title..http::field] [indexterm2 to..http::field] [indexterm2 topic..http::field] [indexterm2 trailer..http::field] [indexterm2 transfer_encoding..http::field] [indexterm2 ttl..http::field] [indexterm2 ua_color..http::field] [indexterm2 ua_media..http::field] [indexterm2 ua_pixels..http::field] [indexterm2 ua_resolution..http::field] [indexterm2 ua_windowpixels..http::field] [indexterm2 upgrade..http::field] [indexterm2 urgency..http::field] [indexterm2 uri..http::field] [indexterm2 user_agent..http::field] [indexterm2 variant_vary..http::field] [indexterm2 vary..http::field] [indexterm2 vbr_info..http::field] [indexterm2 version..http::field] [indexterm2 via..http::field] [indexterm2 want_digest..http::field] [indexterm2 warning..http::field] [indexterm2 www_authenticate..http::field] [indexterm2 x_archived_at..http::field] [indexterm2 x_device_accept..http::field] [indexterm2 x_device_accept_charset..http::field] [indexterm2 x_device_accept_encoding..http::field] [indexterm2 x_device_accept_language..http::field] [indexterm2 x_device_user_agent..http::field] [indexterm2 x_frame_options..http::field] [indexterm2 x_mittente..http::field] [indexterm2 x_pgp_sig..http::field] [indexterm2 x_ricevuta..http::field] [indexterm2 x_riferimento_message_id..http::field] [indexterm2 x_tiporicevuta..http::field] [indexterm2 x_trasporto..http::field] [indexterm2 x_verificasicurezza..http::field] [indexterm2 x400_content_identifier..http::field] [indexterm2 x400_content_return..http::field] [indexterm2 x400_content_type..http::field] [indexterm2 x400_mts_identifier..http::field] [indexterm2 x400_originator..http::field] [indexterm2 x400_received..http::field] [indexterm2 x400_recipients..http::field] [indexterm2 x400_trace..http::field] [indexterm2 xref..http::field] [heading Values] [table [[Name][Description]] [[[^unknown]][ ]] [[[^a_im]][ ]] [[[^accept]][ ]] [[[^accept_additions]][ ]] [[[^accept_charset]][ ]] [[[^accept_datetime]][ ]] [[[^accept_encoding]][ ]] [[[^accept_features]][ ]] [[[^accept_language]][ ]] [[[^accept_patch]][ ]] [[[^accept_post]][ ]] [[[^accept_ranges]][ ]] [[[^access_control]][ ]] [[[^access_control_allow_credentials]][ ]] [[[^access_control_allow_headers]][ ]] [[[^access_control_allow_methods]][ ]] [[[^access_control_allow_origin]][ ]] [[[^access_control_expose_headers]][ ]] [[[^access_control_max_age]][ ]] [[[^access_control_request_headers]][ ]] [[[^access_control_request_method]][ ]] [[[^age]][ ]] [[[^allow]][ ]] [[[^alpn]][ ]] [[[^also_control]][ ]] [[[^alt_svc]][ ]] [[[^alt_used]][ ]] [[[^alternate_recipient]][ ]] [[[^alternates]][ ]] [[[^apparently_to]][ ]] [[[^apply_to_redirect_ref]][ ]] [[[^approved]][ ]] [[[^archive]][ ]] [[[^archived_at]][ ]] [[[^article_names]][ ]] [[[^article_updates]][ ]] [[[^authentication_control]][ ]] [[[^authentication_info]][ ]] [[[^authentication_results]][ ]] [[[^authorization]][ ]] [[[^auto_submitted]][ ]] [[[^autoforwarded]][ ]] [[[^autosubmitted]][ ]] [[[^base]][ ]] [[[^bcc]][ ]] [[[^body]][ ]] [[[^c_ext]][ ]] [[[^c_man]][ ]] [[[^c_opt]][ ]] [[[^c_pep]][ ]] [[[^c_pep_info]][ ]] [[[^cache_control]][ ]] [[[^caldav_timezones]][ ]] [[[^cancel_key]][ ]] [[[^cancel_lock]][ ]] [[[^cc]][ ]] [[[^close]][ ]] [[[^comments]][ ]] [[[^compliance]][ ]] [[[^connection]][ ]] [[[^content_alternative]][ ]] [[[^content_base]][ ]] [[[^content_description]][ ]] [[[^content_disposition]][ ]] [[[^content_duration]][ ]] [[[^content_encoding]][ ]] [[[^content_features]][ ]] [[[^content_id]][ ]] [[[^content_identifier]][ ]] [[[^content_language]][ ]] [[[^content_length]][ ]] [[[^content_location]][ ]] [[[^content_md5]][ ]] [[[^content_range]][ ]] [[[^content_return]][ ]] [[[^content_script_type]][ ]] [[[^content_style_type]][ ]] [[[^content_transfer_encoding]][ ]] [[[^content_type]][ ]] [[[^content_version]][ ]] [[[^control]][ ]] [[[^conversion]][ ]] [[[^conversion_with_loss]][ ]] [[[^cookie]][ ]] [[[^cookie2]][ ]] [[[^cost]][ ]] [[[^dasl]][ ]] [[[^date]][ ]] [[[^date_received]][ ]] [[[^dav]][ ]] [[[^default_style]][ ]] [[[^deferred_delivery]][ ]] [[[^delivery_date]][ ]] [[[^delta_base]][ ]] [[[^depth]][ ]] [[[^derived_from]][ ]] [[[^destination]][ ]] [[[^differential_id]][ ]] [[[^digest]][ ]] [[[^discarded_x400_ipms_extensions]][ ]] [[[^discarded_x400_mts_extensions]][ ]] [[[^disclose_recipients]][ ]] [[[^disposition_notification_options]][ ]] [[[^disposition_notification_to]][ ]] [[[^distribution]][ ]] [[[^dkim_signature]][ ]] [[[^dl_expansion_history]][ ]] [[[^downgraded_bcc]][ ]] [[[^downgraded_cc]][ ]] [[[^downgraded_disposition_notification_to]][ ]] [[[^downgraded_final_recipient]][ ]] [[[^downgraded_from]][ ]] [[[^downgraded_in_reply_to]][ ]] [[[^downgraded_mail_from]][ ]] [[[^downgraded_message_id]][ ]] [[[^downgraded_original_recipient]][ ]] [[[^downgraded_rcpt_to]][ ]] [[[^downgraded_references]][ ]] [[[^downgraded_reply_to]][ ]] [[[^downgraded_resent_bcc]][ ]] [[[^downgraded_resent_cc]][ ]] [[[^downgraded_resent_from]][ ]] [[[^downgraded_resent_reply_to]][ ]] [[[^downgraded_resent_sender]][ ]] [[[^downgraded_resent_to]][ ]] [[[^downgraded_return_path]][ ]] [[[^downgraded_sender]][ ]] [[[^downgraded_to]][ ]] [[[^ediint_features]][ ]] [[[^eesst_version]][ ]] [[[^encoding]][ ]] [[[^encrypted]][ ]] [[[^errors_to]][ ]] [[[^etag]][ ]] [[[^expect]][ ]] [[[^expires]][ ]] [[[^expiry_date]][ ]] [[[^ext]][ ]] [[[^followup_to]][ ]] [[[^forwarded]][ ]] [[[^from]][ ]] [[[^generate_delivery_report]][ ]] [[[^getprofile]][ ]] [[[^hobareg]][ ]] [[[^host]][ ]] [[[^http2_settings]][ ]] [[[^if_]][ ]] [[[^if_match]][ ]] [[[^if_modified_since]][ ]] [[[^if_none_match]][ ]] [[[^if_range]][ ]] [[[^if_schedule_tag_match]][ ]] [[[^if_unmodified_since]][ ]] [[[^im]][ ]] [[[^importance]][ ]] [[[^in_reply_to]][ ]] [[[^incomplete_copy]][ ]] [[[^injection_date]][ ]] [[[^injection_info]][ ]] [[[^jabber_id]][ ]] [[[^keep_alive]][ ]] [[[^keywords]][ ]] [[[^label]][ ]] [[[^language]][ ]] [[[^last_modified]][ ]] [[[^latest_delivery_time]][ ]] [[[^lines]][ ]] [[[^link]][ ]] [[[^list_archive]][ ]] [[[^list_help]][ ]] [[[^list_id]][ ]] [[[^list_owner]][ ]] [[[^list_post]][ ]] [[[^list_subscribe]][ ]] [[[^list_unsubscribe]][ ]] [[[^list_unsubscribe_post]][ ]] [[[^location]][ ]] [[[^lock_token]][ ]] [[[^man]][ ]] [[[^max_forwards]][ ]] [[[^memento_datetime]][ ]] [[[^message_context]][ ]] [[[^message_id]][ ]] [[[^message_type]][ ]] [[[^meter]][ ]] [[[^method_check]][ ]] [[[^method_check_expires]][ ]] [[[^mime_version]][ ]] [[[^mmhs_acp127_message_identifier]][ ]] [[[^mmhs_authorizing_users]][ ]] [[[^mmhs_codress_message_indicator]][ ]] [[[^mmhs_copy_precedence]][ ]] [[[^mmhs_exempted_address]][ ]] [[[^mmhs_extended_authorisation_info]][ ]] [[[^mmhs_handling_instructions]][ ]] [[[^mmhs_message_instructions]][ ]] [[[^mmhs_message_type]][ ]] [[[^mmhs_originator_plad]][ ]] [[[^mmhs_originator_reference]][ ]] [[[^mmhs_other_recipients_indicator_cc]][ ]] [[[^mmhs_other_recipients_indicator_to]][ ]] [[[^mmhs_primary_precedence]][ ]] [[[^mmhs_subject_indicator_codes]][ ]] [[[^mt_priority]][ ]] [[[^negotiate]][ ]] [[[^newsgroups]][ ]] [[[^nntp_posting_date]][ ]] [[[^nntp_posting_host]][ ]] [[[^non_compliance]][ ]] [[[^obsoletes]][ ]] [[[^opt]][ ]] [[[^optional]][ ]] [[[^optional_www_authenticate]][ ]] [[[^ordering_type]][ ]] [[[^organization]][ ]] [[[^origin]][ ]] [[[^original_encoded_information_types]][ ]] [[[^original_from]][ ]] [[[^original_message_id]][ ]] [[[^original_recipient]][ ]] [[[^original_sender]][ ]] [[[^original_subject]][ ]] [[[^originator_return_address]][ ]] [[[^overwrite]][ ]] [[[^p3p]][ ]] [[[^path]][ ]] [[[^pep]][ ]] [[[^pep_info]][ ]] [[[^pics_label]][ ]] [[[^position]][ ]] [[[^posting_version]][ ]] [[[^pragma]][ ]] [[[^prefer]][ ]] [[[^preference_applied]][ ]] [[[^prevent_nondelivery_report]][ ]] [[[^priority]][ ]] [[[^privicon]][ ]] [[[^profileobject]][ ]] [[[^protocol]][ ]] [[[^protocol_info]][ ]] [[[^protocol_query]][ ]] [[[^protocol_request]][ ]] [[[^proxy_authenticate]][ ]] [[[^proxy_authentication_info]][ ]] [[[^proxy_authorization]][ ]] [[[^proxy_connection]][ ]] [[[^proxy_features]][ ]] [[[^proxy_instruction]][ ]] [[[^public_]][ ]] [[[^public_key_pins]][ ]] [[[^public_key_pins_report_only]][ ]] [[[^range]][ ]] [[[^received]][ ]] [[[^received_spf]][ ]] [[[^redirect_ref]][ ]] [[[^references]][ ]] [[[^referer]][ ]] [[[^referer_root]][ ]] [[[^relay_version]][ ]] [[[^reply_by]][ ]] [[[^reply_to]][ ]] [[[^require_recipient_valid_since]][ ]] [[[^resent_bcc]][ ]] [[[^resent_cc]][ ]] [[[^resent_date]][ ]] [[[^resent_from]][ ]] [[[^resent_message_id]][ ]] [[[^resent_reply_to]][ ]] [[[^resent_sender]][ ]] [[[^resent_to]][ ]] [[[^resolution_hint]][ ]] [[[^resolver_location]][ ]] [[[^retry_after]][ ]] [[[^return_path]][ ]] [[[^safe]][ ]] [[[^schedule_reply]][ ]] [[[^schedule_tag]][ ]] [[[^sec_websocket_accept]][ ]] [[[^sec_websocket_extensions]][ ]] [[[^sec_websocket_key]][ ]] [[[^sec_websocket_protocol]][ ]] [[[^sec_websocket_version]][ ]] [[[^security_scheme]][ ]] [[[^see_also]][ ]] [[[^sender]][ ]] [[[^sensitivity]][ ]] [[[^server]][ ]] [[[^set_cookie]][ ]] [[[^set_cookie2]][ ]] [[[^setprofile]][ ]] [[[^sio_label]][ ]] [[[^sio_label_history]][ ]] [[[^slug]][ ]] [[[^soapaction]][ ]] [[[^solicitation]][ ]] [[[^status_uri]][ ]] [[[^strict_transport_security]][ ]] [[[^subject]][ ]] [[[^subok]][ ]] [[[^subst]][ ]] [[[^summary]][ ]] [[[^supersedes]][ ]] [[[^surrogate_capability]][ ]] [[[^surrogate_control]][ ]] [[[^tcn]][ ]] [[[^te]][ ]] [[[^timeout]][ ]] [[[^title]][ ]] [[[^to]][ ]] [[[^topic]][ ]] [[[^trailer]][ ]] [[[^transfer_encoding]][ ]] [[[^ttl]][ ]] [[[^ua_color]][ ]] [[[^ua_media]][ ]] [[[^ua_pixels]][ ]] [[[^ua_resolution]][ ]] [[[^ua_windowpixels]][ ]] [[[^upgrade]][ ]] [[[^urgency]][ ]] [[[^uri]][ ]] [[[^user_agent]][ ]] [[[^variant_vary]][ ]] [[[^vary]][ ]] [[[^vbr_info]][ ]] [[[^version]][ ]] [[[^via]][ ]] [[[^want_digest]][ ]] [[[^warning]][ ]] [[[^www_authenticate]][ ]] [[[^x_archived_at]][ ]] [[[^x_device_accept]][ ]] [[[^x_device_accept_charset]][ ]] [[[^x_device_accept_encoding]][ ]] [[[^x_device_accept_language]][ ]] [[[^x_device_user_agent]][ ]] [[[^x_frame_options]][ ]] [[[^x_mittente]][ ]] [[[^x_pgp_sig]][ ]] [[[^x_ricevuta]][ ]] [[[^x_riferimento_message_id]][ ]] [[[^x_tiporicevuta]][ ]] [[[^x_trasporto]][ ]] [[[^x_verificasicurezza]][ ]] [[[^x400_content_identifier]][ ]] [[[^x400_content_return]][ ]] [[[^x400_content_type]][ ]] [[[^x400_mts_identifier]][ ]] [[[^x400_originator]][ ]] [[[^x400_received]][ ]] [[[^x400_recipients]][ ]] [[[^x400_trace]][ ]] [[[^xref]][ ]] ] [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__fields http::fields] [indexterm1 http::fields]
  2969. A typical HTTP header fields container. [heading Synopsis] Defined in header [include_file boost/beast/http/fields.hpp] ``` using fields = basic_fields< std::allocator< char > >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_fields.allocator_type [*allocator_type]]] [ The type of allocator used. ] ] [ [[link beast.ref.boost__beast__http__basic_fields__value_type [*value_type]]] [ The type of element used to represent a field. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.const_iterator [*const_iterator]]] [ A constant iterator to the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.iterator [*iterator]]] [ A constant iterator to the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.key_compare [*key_compare]]] [ A strictly less predicate for comparing keys, using a case-insensitive comparison. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.writer [*writer]]] [ The algorithm used to serialize the header. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_fields.at [*at]]] [ Returns the value for a field, or throws an exception. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.basic_fields [*basic_fields]]] [ Constructor. Move constructor. Copy constructor. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.begin [*begin]]] [ Return a const iterator to the beginning of the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.cbegin [*cbegin]]] [ Return a const iterator to the beginning of the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.cend [*cend]]] [ Return a const iterator to the end of the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.clear [*clear]]] [ Remove all fields from the container. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.count [*count]]] [ Return the number of fields with the specified name. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.end [*end]]] [ Return a const iterator to the end of the field sequence. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.equal_range [*equal_range]]] [ Returns a range of iterators to the fields with the specified name. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.erase [*erase]]] [ Remove a field. Remove all fields with the specified name. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.find [*find]]] [ Returns an iterator to the case-insensitive matching field. Returns an iterator to the case-insensitive matching field name. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.get_allocator [*get_allocator]]] [ Return a copy of the allocator associated with the container. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.insert [*insert]]] [ Insert a field. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.key_comp [*key_comp]]] [ Returns a copy of the key comparison function. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.operator_eq_ [*operator=]]] [ Move assignment. Copy assignment. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.operator_lb__rb_ [*operator\[\]]]] [ Returns the value for a field, or "" if it does not exist. Returns the value for a case-insensitive matching header, or "" if it does not exist. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set [*set]]] [ Set a field value, removing any other instances of that field. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.swap [*swap]]] [ Return a buffer sequence representing the trailers. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.basic_fields_dtor_ [*~basic_fields]]] [ Destructor. ] ] ] [heading Protected Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_fields.get_chunked_impl [*get_chunked_impl]]] [ Returns the chunked Transfer-Encoding setting. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.get_keep_alive_impl [*get_keep_alive_impl]]] [ Returns the keep-alive setting. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.get_method_impl [*get_method_impl]]] [ Returns the request-method string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.get_reason_impl [*get_reason_impl]]] [ Returns the response reason-phrase string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.get_target_impl [*get_target_impl]]] [ Returns the request-target string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.has_content_length_impl [*has_content_length_impl]]] [ Returns true if the Content-Length field is present. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_chunked_impl [*set_chunked_impl]]] [ Adjusts the chunked Transfer-Encoding value. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_content_length_impl [*set_content_length_impl]]] [ Sets or clears the Content-Length field. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_keep_alive_impl [*set_keep_alive_impl]]] [ Adjusts the Connection field. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_method_impl [*set_method_impl]]] [ Set or clear the method string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_reason_impl [*set_reason_impl]]] [ Set or clear the reason string. ] ] [ [[link beast.ref.boost__beast__http__basic_fields.set_target_impl [*set_target_impl]]] [ Set or clear the target string. ] ] ] [heading Friends] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_fields.swap [*swap]]] [ Swap two field containers. ] ] ]
  2970. This container is designed to store the field value pairs that make up the fields and trailers in an HTTP message. Objects of this type are iterable, with each element holding the field name and field value.
  2971. Field names are stored as-is, but comparisons are case-insensitive. The container behaves as a `std::multiset`; there will be a separate value for each occurrence of the same field name. When the container is iterated the fields are presented in the order of insertion, with fields having the same name following each other consecutively.
  2972. Meets the requirements of ['Fields]
  2973. [heading Template Parameters] [table [[Type][Description]] [[`Allocator`][
  2974. The allocator to use. ]] ]
  2975. [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__file_body http::file_body] [indexterm1 http::file_body]
  2976. A message body represented by a file on the filesystem. [heading Synopsis] Defined in header [include_file boost/beast/http/file_body.hpp] ``` using file_body = basic_file_body< file >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_file_body__reader [*reader]]] [ Algorithm for storing buffers when parsing. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__value_type [*value_type]]] [ The type of the message::body member. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body__writer [*writer]]] [ Algorithm for retrieving buffers when serializing. ] ] [ [[link beast.ref.boost__beast__http__basic_file_body.file_type [*file_type]]] [ The type of File this body uses. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_file_body.size [*size]]] [ Returns the size of the body. ] ] ]
  2977. Messages with this type have bodies represented by a file on the file system. When parsing a message using this body type, the data is stored in the file pointed to by the path, which must be writable. When serializing, the implementation will read the file and present those octets as the body content. This may be used to serve content from a directory as part of a web service.
  2978. [heading Template Parameters] [table [[Type][Description]] [[`File`][
  2979. The implementation to use for accessing files. This type must meet the requirements of ['File]. ]] ]
  2980. [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__header http::header]
  2981. A container for an HTTP request or response header. [heading Synopsis] Defined in header [include_file boost/beast/http/message.hpp] ``` template< bool isRequest, class __Fields__ = fields> class header : public Fields ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__header.fields_type [*fields_type]]] [ The type representing the fields. ] ] [ [[link beast.ref.boost__beast__http__header.is_request [*is_request]]] [ Indicates if the header is a request or response. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__header.header [*header]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__header.method [*method]]] [ Return the request-method verb. Set the request-method. ] ] [ [[link beast.ref.boost__beast__http__header.method_string [*method_string]]] [ Return the request-method as a string. ] ] [ [[link beast.ref.boost__beast__http__header.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__http__header.reason [*reason]]] [ Return the response reason-phrase. Set the response reason-phrase (deprecated) ] ] [ [[link beast.ref.boost__beast__http__header.result [*result]]] [ The response status-code result. Set the response status-code. Set the response status-code as an integer. ] ] [ [[link beast.ref.boost__beast__http__header.result_int [*result_int]]] [ The response status-code expressed as an integer. ] ] [ [[link beast.ref.boost__beast__http__header.target [*target]]] [ Returns the request-target string. Set the request-target string. ] ] [ [[link beast.ref.boost__beast__http__header.version [*version]]] [ Return the HTTP-version. Set the HTTP-version. ] ] ] [heading Description]
  2982. This container is derived from the `Fields` template type. To understand all of the members of this class it is necessary to view the declaration for the `Fields` type. When using the default fields container, those declarations are in [link beast.ref.boost__beast__http__fields `http::fields`].
  2983. Newly constructed header objects have version set to HTTP/1.1. Newly constructed response objects also have result code set to [link beast.ref.boost__beast__http__status `http::ok`].
  2984. A `header` includes the start-line and header-fields. [section:fields_type http::header::fields_type] [indexterm2 fields_type..http::header]
  2985. The type representing the fields. [heading Synopsis] ``` using fields_type = Fields; ``` [heading Description] [endsect] [section:header http::header::header] [indexterm2 header..http::header]
  2986. Constructor. ``` ``[link beast.ref.boost__beast__http__header.header.overload1 header]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.header.overload1 more...]]`` ``[link beast.ref.boost__beast__http__header.header.overload2 header]``( header&&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.header.overload2 more...]]`` ``[link beast.ref.boost__beast__http__header.header.overload3 header]``( header const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.header.overload3 more...]]`` template< class... Args> explicit ``[link beast.ref.boost__beast__http__header.header.overload4 header]``( Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.header.overload4 more...]]`` ``` [section:overload1 http::header::header (1 of 4 overloads)]
  2987. Constructor. [heading Synopsis] ``` header(); ``` [heading Description] [endsect] [section:overload2 http::header::header (2 of 4 overloads)]
  2988. Constructor. [heading Synopsis] ``` header( header&&); ``` [heading Description] [endsect] [section:overload3 http::header::header (3 of 4 overloads)]
  2989. Constructor. [heading Synopsis] ``` header( header const&); ``` [heading Description] [endsect] [section:overload4 http::header::header (4 of 4 overloads)]
  2990. Constructor. [heading Synopsis] ``` template< class... Args> header( Args&&... args); ``` [heading Description]
  2991. [heading Parameters] [table [[Name][Description]] [[`args`][
  2992. Arguments forwarded to the `Fields` base class constructor. ]] ]
  2993. [heading Remarks]
  2994. This constructor participates in overload resolution if and only if the first parameter is not convertible to [link beast.ref.boost__beast__http__header `http::header`], [link beast.ref.boost__beast__http__verb `http::verb`], or [link beast.ref.boost__beast__http__status `http::status`].
  2995. [endsect] [endsect] [section:is_request http::header::is_request] [indexterm2 is_request..http::header]
  2996. Indicates if the header is a request or response. [heading Synopsis] ``` using is_request = std::integral_constant< bool, isRequest >; ``` [heading Description] [endsect] [section:method http::header::method] [indexterm2 method..http::header]
  2997. Return the request-method verb. ``` verb ``[link beast.ref.boost__beast__http__header.method.overload1 method]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.method.overload1 more...]]`` ```
  2998. Set the request-method. ``` void ``[link beast.ref.boost__beast__http__header.method.overload2 method]``( verb v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.method.overload2 more...]]`` ``` [section:overload1 http::header::method (1 of 2 overloads)]
  2999. Return the request-method verb. [heading Synopsis] ``` verb method() const; ``` [heading Description]
  3000. If the request-method is not one of the recognized verbs, [link beast.ref.boost__beast__http__field `http::unknown`] is returned. Callers may use [link beast.ref.boost__beast__http__header.method_string `http::header::method_string`] to retrieve the exact text.
  3001. [heading Remarks]
  3002. This function is only available when `isRequest == true`.
  3003. [heading See Also]
  3004. [link beast.ref.boost__beast__http__header.method_string `http::header::method_string`]
  3005. [endsect] [section:overload2 http::header::method (2 of 2 overloads)]
  3006. Set the request-method. [heading Synopsis] ``` void method( verb v); ``` [heading Description]
  3007. This function will set the method for requests to a known verb.
  3008. [heading Parameters] [table [[Name][Description]] [[`v`][
  3009. The request method verb to set. This may not be [link beast.ref.boost__beast__http__field `http::unknown`]. ]] ]
  3010. [heading Exceptions] [table [[Type][Thrown On]] [[`std::invalid_argument`][
  3011. when `v == verb::unknown`. ]] ]
  3012. [heading Remarks]
  3013. This function is only available when `isRequest == true`.
  3014. [endsect] [endsect] [section:method_string http::header::method_string] [indexterm2 method_string..http::header]
  3015. Return the request-method as a string. ``` string_view ``[link beast.ref.boost__beast__http__header.method_string.overload1 method_string]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.method_string.overload1 more...]]`` void ``[link beast.ref.boost__beast__http__header.method_string.overload2 method_string]``( string_view s); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.method_string.overload2 more...]]`` ``` [section:overload1 http::header::method_string (1 of 2 overloads)]
  3016. Return the request-method as a string. [heading Synopsis] ``` string_view method_string() const; ``` [heading Description]
  3017. [heading Remarks]
  3018. This function is only available when `isRequest == true`.
  3019. [heading See Also]
  3020. [link beast.ref.boost__beast__http__header.method `http::header::method`]
  3021. [endsect] [section:overload2 http::header::method_string (2 of 2 overloads)]
  3022. Set the request-method. [heading Synopsis] ``` void method_string( string_view s); ``` [heading Description]
  3023. This function will set the request-method a known verb if the string matches, otherwise it will store a copy of the passed string.
  3024. [heading Parameters] [table [[Name][Description]] [[`s`][
  3025. A string representing the request-method. ]] ]
  3026. [heading Remarks]
  3027. This function is only available when `isRequest == true`.
  3028. [endsect] [endsect] [section:operator_eq_ http::header::operator=] [indexterm2 operator=..http::header]
  3029. Assignment. ``` header& ``[link beast.ref.boost__beast__http__header.operator_eq_.overload1 operator=]``( header&&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.operator_eq_.overload1 more...]]`` header& ``[link beast.ref.boost__beast__http__header.operator_eq_.overload2 operator=]``( header const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.operator_eq_.overload2 more...]]`` ``` [section:overload1 http::header::operator= (1 of 2 overloads)]
  3030. Assignment. [heading Synopsis] ``` header& operator=( header&&); ``` [heading Description] [endsect] [section:overload2 http::header::operator= (2 of 2 overloads)]
  3031. Assignment. [heading Synopsis] ``` header& operator=( header const&); ``` [heading Description] [endsect] [endsect] [section:reason http::header::reason] [indexterm2 reason..http::header]
  3032. Return the response reason-phrase. ``` string_view ``[link beast.ref.boost__beast__http__header.reason.overload1 reason]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.reason.overload1 more...]]`` ```
  3033. Set the response reason-phrase (deprecated) ``` void ``[link beast.ref.boost__beast__http__header.reason.overload2 reason]``( string_view s); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.reason.overload2 more...]]`` ``` [section:overload1 http::header::reason (1 of 2 overloads)]
  3034. Return the response reason-phrase. [heading Synopsis] ``` string_view reason() const; ``` [heading Description]
  3035. The reason-phrase is obsolete as of rfc7230.
  3036. [heading Remarks]
  3037. This function is only available when `isRequest == false`.
  3038. [endsect] [section:overload2 http::header::reason (2 of 2 overloads)]
  3039. Set the response reason-phrase (deprecated) [heading Synopsis] ``` void reason( string_view s); ``` [heading Description]
  3040. This function sets a custom reason-phrase to a copy of the string passed in. Normally it is not necessary to set the reason phrase on an outgoing response object; the implementation will automatically use the standard reason text for the corresponding status code.
  3041. To clear a previously set custom phrase, pass an empty string. This will restore the default standard reason text based on the status code used when serializing.
  3042. The reason-phrase is obsolete as of rfc7230.
  3043. [heading Parameters] [table [[Name][Description]] [[`s`][
  3044. The string to use for the reason-phrase. ]] ]
  3045. [heading Remarks]
  3046. This function is only available when `isRequest == false`.
  3047. [endsect] [endsect] [section:result http::header::result] [indexterm2 result..http::header]
  3048. The response status-code result. ``` status ``[link beast.ref.boost__beast__http__header.result.overload1 result]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.result.overload1 more...]]`` ```
  3049. Set the response status-code. ``` void ``[link beast.ref.boost__beast__http__header.result.overload2 result]``( status v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.result.overload2 more...]]`` ```
  3050. Set the response status-code as an integer. ``` void ``[link beast.ref.boost__beast__http__header.result.overload3 result]``( unsigned v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.result.overload3 more...]]`` ``` [section:overload1 http::header::result (1 of 3 overloads)]
  3051. The response status-code result. [heading Synopsis] ``` status result() const; ``` [heading Description]
  3052. If the actual status code is not a known code, this function returns [link beast.ref.boost__beast__http__field `http::unknown`]. Use [link beast.ref.boost__beast__http__header.result_int `http::header::result_int`] to return the raw status code as a number.
  3053. [heading Remarks]
  3054. This member is only available when `isRequest == false`.
  3055. [endsect] [section:overload2 http::header::result (2 of 3 overloads)]
  3056. Set the response status-code. [heading Synopsis] ``` void result( status v); ``` [heading Description]
  3057. [heading Parameters] [table [[Name][Description]] [[`v`][
  3058. The code to set. ]] ]
  3059. [heading Remarks]
  3060. This member is only available when `isRequest == false`.
  3061. [endsect] [section:overload3 http::header::result (3 of 3 overloads)]
  3062. Set the response status-code as an integer. [heading Synopsis] ``` void result( unsigned v); ``` [heading Description]
  3063. This sets the status code to the exact number passed in. If the number does not correspond to one of the known status codes, the function [link beast.ref.boost__beast__http__header.result `http::header::result`] will return [link beast.ref.boost__beast__http__field `http::unknown`]. Use [link beast.ref.boost__beast__http__header.result_int `http::header::result_int`] to obtain the original raw status-code.
  3064. [heading Parameters] [table [[Name][Description]] [[`v`][
  3065. The status-code integer to set. ]] ]
  3066. [heading Exceptions] [table [[Type][Thrown On]] [[`std::invalid_argument`][
  3067. if `v > 999`. ]] ]
  3068. [endsect] [endsect] [section:result_int http::header::result_int] [indexterm2 result_int..http::header]
  3069. The response status-code expressed as an integer. [heading Synopsis] ``` unsigned result_int() const; ``` [heading Description]
  3070. This returns the raw status code as an integer, even when that code is not in the list of known status codes.
  3071. [heading Remarks]
  3072. This member is only available when `isRequest == false`.
  3073. [endsect] [section:target http::header::target] [indexterm2 target..http::header]
  3074. Returns the request-target string. ``` string_view ``[link beast.ref.boost__beast__http__header.target.overload1 target]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.target.overload1 more...]]`` ```
  3075. Set the request-target string. ``` void ``[link beast.ref.boost__beast__http__header.target.overload2 target]``( string_view s); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.target.overload2 more...]]`` ``` [section:overload1 http::header::target (1 of 2 overloads)]
  3076. Returns the request-target string. [heading Synopsis] ``` string_view target() const; ``` [heading Description]
  3077. The request target string returned is the same string which was received from the network or stored. In particular, it will contain url-encoded characters and should follow the syntax rules for URIs used with HTTP.
  3078. [heading Remarks]
  3079. This function is only available when `isRequest == true`.
  3080. [endsect] [section:overload2 http::header::target (2 of 2 overloads)]
  3081. Set the request-target string. [heading Synopsis] ``` void target( string_view s); ``` [heading Description]
  3082. It is the caller's responsibility to ensure that the request target string follows the syntax rules for URIs used with HTTP. In particular, reserved or special characters must be url-encoded. The implementation does not perform syntax checking on the passed string.
  3083. [heading Parameters] [table [[Name][Description]] [[`s`][
  3084. A string representing the request-target. ]] ]
  3085. [heading Remarks]
  3086. This function is only available when `isRequest == true`.
  3087. [endsect] [endsect] [section:version http::header::version] [indexterm2 version..http::header]
  3088. Return the HTTP-version. ``` unsigned ``[link beast.ref.boost__beast__http__header.version.overload1 version]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.version.overload1 more...]]`` ```
  3089. Set the HTTP-version. ``` void ``[link beast.ref.boost__beast__http__header.version.overload2 version]``( unsigned value); ``[''''&raquo;''' [link beast.ref.boost__beast__http__header.version.overload2 more...]]`` ``` [section:overload1 http::header::version (1 of 2 overloads)]
  3090. Return the HTTP-version. [heading Synopsis] ``` unsigned version() const; ``` [heading Description]
  3091. This holds both the major and minor version numbers, using these formulas: ``` unsigned major = version / 10;
  3092. unsigned minor = version % 10;
  3093. ```
  3094. Newly constructed headers will use HTTP/1.1 by default. [endsect] [section:overload2 http::header::version (2 of 2 overloads)]
  3095. Set the HTTP-version. [heading Synopsis] ``` void version( unsigned value); ``` [heading Description]
  3096. This holds both the major and minor version numbers, using these formulas: ``` unsigned major = version / 10;
  3097. unsigned minor = version % 10;
  3098. ```
  3099. Newly constructed headers will use HTTP/1.1 by default.
  3100. [heading Parameters] [table [[Name][Description]] [[`value`][
  3101. The version number to use ]] ]
  3102. [endsect] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__icy_stream http::icy_stream]
  3103. Stream wrapper to process Shoutcast HTTP responses. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/http/icy_stream.hpp] ``` template< class NextLayer> class icy_stream ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__icy_stream.executor_type [*executor_type]]] [ The type of the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__http__icy_stream.next_layer_type [*next_layer_type]]] [ The type of the next layer. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__icy_stream.async_read_some [*async_read_some]]] [ Start an asynchronous read. ] ] [ [[link beast.ref.boost__beast__http__icy_stream.async_write_some [*async_write_some]]] [ Start an asynchronous write. ] ] [ [[link beast.ref.boost__beast__http__icy_stream.get_executor [*get_executor]]] [ Get the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__http__icy_stream.icy_stream [*icy_stream]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__icy_stream.next_layer [*next_layer]]] [ Get a reference to the next layer. ] ] [ [[link beast.ref.boost__beast__http__icy_stream.operator_eq_ [*operator=]]] [ ] ] [ [[link beast.ref.boost__beast__http__icy_stream.read_some [*read_some]]] [ Read some data from the stream. ] ] [ [[link beast.ref.boost__beast__http__icy_stream.write_some [*write_some]]] [ Write some data to the stream. ] ] [ [[link beast.ref.boost__beast__http__icy_stream.icy_stream_dtor_ [*~icy_stream]]] [ Destructor. ] ] ] [heading Description]
  3104. This wrapper replaces the word "ICY" in the first HTTP response received on the connection, with "HTTP/1.1". This allows the Beast parser to be used with Shoutcast servers, which send a non-standard HTTP message as the response.
  3105. For asynchronous operations, the application must ensure that they are are all performed within the same implicit or explicit strand.
  3106. [heading Thread Safety]
  3107. ['Distinct] ['objects:] Safe. ['Shared] ['objects:] Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
  3108. [heading Example]
  3109. To use the [link beast.ref.boost__beast__http__icy_stream `http::icy_stream`] template with an [link beast.ref.boost__beast__tcp_stream `tcp_stream`] you would write: ``` http::icy_stream<tcp_stream> is(ioc);
  3110. ```
  3111. [heading Template Parameters] [table [[Type][Description]] [[`NextLayer`][
  3112. The type representing the next layer, to which data will be read and written during operations. For synchronous operations, the type must support the ['SyncStream] concept. For asynchronous operations, the type must support the ['AsyncStream] concept. ]] ]
  3113. [heading Remarks]
  3114. A stream object must not be moved or destroyed while there are pending asynchronous operations associated with it.
  3115. [heading Concepts]
  3116. ['AsyncStream], ['SyncStream]
  3117. [section:async_read_some http::icy_stream::async_read_some] [indexterm2 async_read_some..http::icy_stream]
  3118. Start an asynchronous read. [heading Synopsis] ``` template< class __MutableBufferSequence__, class __ReadHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_read_some( MutableBufferSequence const& buffers, ReadHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  3119. This function is used to asynchronously read one or more bytes of data from the stream. The function call always returns immediately.
  3120. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  3121. The buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  3122. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  3123. const boost::system::error_code& error, // Result of operation.
  3124. std::size_t bytes_transferred // Number of bytes read.
  3125. );
  3126. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  3127. [heading Remarks]
  3128. The `async_read_some` operation may not read all of the requested number of bytes. Consider using the function `net::async_read` if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
  3129. [endsect] [section:async_write_some http::icy_stream::async_write_some] [indexterm2 async_write_some..http::icy_stream]
  3130. Start an asynchronous write. [heading Synopsis] ``` template< class __ConstBufferSequence__, class __WriteHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_write_some( ConstBufferSequence const& buffers, WriteHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  3131. This function is used to asynchronously write one or more bytes of data to the stream. The function call always returns immediately.
  3132. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  3133. The data to be written to the stream. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  3134. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  3135. error_code const& error, // Result of operation.
  3136. std::size_t bytes_transferred // Number of bytes written.
  3137. );
  3138. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  3139. [heading Remarks]
  3140. The `async_write_some` operation may not transmit all of the data to the peer. Consider using the function `net::async_write` if you need to ensure that all data is written before the asynchronous operation completes.
  3141. [endsect] [section:executor_type http::icy_stream::executor_type] [indexterm2 executor_type..http::icy_stream]
  3142. The type of the executor associated with the object. [heading Synopsis] ``` using executor_type = typename next_layer_type::executor_type; ``` [heading Description] [endsect] [section:get_executor http::icy_stream::get_executor] [indexterm2 get_executor..http::icy_stream]
  3143. Get the executor associated with the object. [heading Synopsis] ``` executor_type get_executor(); ``` [heading Description]
  3144. This function may be used to obtain the executor object that the stream uses to dispatch handlers for asynchronous operations.
  3145. [heading Return Value]
  3146. A copy of the executor that stream will use to dispatch handlers.
  3147. [endsect] [section:icy_stream http::icy_stream::icy_stream] [indexterm2 icy_stream..http::icy_stream] ``` ``[link beast.ref.boost__beast__http__icy_stream.icy_stream.overload1 icy_stream]``( icy_stream&&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__icy_stream.icy_stream.overload1 more...]]`` ``[link beast.ref.boost__beast__http__icy_stream.icy_stream.overload2 icy_stream]``( icy_stream const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__icy_stream.icy_stream.overload2 more...]]`` ```
  3148. Constructor. ``` template< class... Args> explicit ``[link beast.ref.boost__beast__http__icy_stream.icy_stream.overload3 icy_stream]``( Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__http__icy_stream.icy_stream.overload3 more...]]`` ``` [section:overload1 http::icy_stream::icy_stream (1 of 3 overloads)] [heading Synopsis] ``` icy_stream( icy_stream&&); ``` [heading Description] [endsect] [section:overload2 http::icy_stream::icy_stream (2 of 3 overloads)] [heading Synopsis] ``` icy_stream( icy_stream const&); ``` [heading Description] [endsect] [section:overload3 http::icy_stream::icy_stream (3 of 3 overloads)]
  3149. Constructor. [heading Synopsis] ``` template< class... Args> icy_stream( Args&&... args); ``` [heading Description]
  3150. Arguments, if any, are forwarded to the next layer's constructor. [endsect] [endsect] [section:next_layer http::icy_stream::next_layer] [indexterm2 next_layer..http::icy_stream]
  3151. Get a reference to the next layer. ``` next_layer_type& ``[link beast.ref.boost__beast__http__icy_stream.next_layer.overload1 next_layer]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__icy_stream.next_layer.overload1 more...]]`` next_layer_type const & ``[link beast.ref.boost__beast__http__icy_stream.next_layer.overload2 next_layer]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__icy_stream.next_layer.overload2 more...]]`` ``` [section:overload1 http::icy_stream::next_layer (1 of 2 overloads)]
  3152. Get a reference to the next layer. [heading Synopsis] ``` next_layer_type& next_layer(); ``` [heading Description]
  3153. This function returns a reference to the next layer in a stack of stream layers.
  3154. [heading Return Value]
  3155. A reference to the next layer in the stack of stream layers.
  3156. [endsect] [section:overload2 http::icy_stream::next_layer (2 of 2 overloads)]
  3157. Get a reference to the next layer. [heading Synopsis] ``` next_layer_type const & next_layer() const; ``` [heading Description]
  3158. This function returns a reference to the next layer in a stack of stream layers.
  3159. [heading Return Value]
  3160. A reference to the next layer in the stack of stream layers.
  3161. [endsect] [endsect] [section:next_layer_type http::icy_stream::next_layer_type] [indexterm2 next_layer_type..http::icy_stream]
  3162. The type of the next layer. [heading Synopsis] ``` using next_layer_type = typename std::remove_reference< NextLayer >::type; ``` [heading Description] [endsect] [section:operator_eq_ http::icy_stream::operator=] [indexterm2 operator=..http::icy_stream] ``` icy_stream& ``[link beast.ref.boost__beast__http__icy_stream.operator_eq_.overload1 operator=]``( icy_stream&&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__icy_stream.operator_eq_.overload1 more...]]`` icy_stream& ``[link beast.ref.boost__beast__http__icy_stream.operator_eq_.overload2 operator=]``( icy_stream const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__icy_stream.operator_eq_.overload2 more...]]`` ``` [section:overload1 http::icy_stream::operator= (1 of 2 overloads)] [heading Synopsis] ``` icy_stream& operator=( icy_stream&&); ``` [heading Description] [endsect] [section:overload2 http::icy_stream::operator= (2 of 2 overloads)] [heading Synopsis] ``` icy_stream& operator=( icy_stream const&); ``` [heading Description] [endsect] [endsect] [section:read_some http::icy_stream::read_some] [indexterm2 read_some..http::icy_stream]
  3163. Read some data from the stream. ``` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__http__icy_stream.read_some.overload1 read_some]``( MutableBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__http__icy_stream.read_some.overload1 more...]]`` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__http__icy_stream.read_some.overload2 read_some]``( MutableBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__http__icy_stream.read_some.overload2 more...]]`` ``` [section:overload1 http::icy_stream::read_some (1 of 2 overloads)]
  3164. Read some data from the stream. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers); ``` [heading Description]
  3165. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  3166. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  3167. The buffers into which the data will be read. ]] ]
  3168. [heading Return Value]
  3169. The number of bytes read.
  3170. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  3171. Thrown on failure. ]] ]
  3172. [heading Remarks]
  3173. The `read_some` operation may not read all of the requested number of bytes. Consider using the function `net::read` if you need to ensure that the requested amount of data is read before the blocking operation completes.
  3174. [endsect] [section:overload2 http::icy_stream::read_some (2 of 2 overloads)]
  3175. Read some data from the stream. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  3176. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  3177. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  3178. The buffers into which the data will be read. ]] [[`ec`][
  3179. Set to indicate what error occurred, if any. ]] ]
  3180. [heading Return Value]
  3181. The number of bytes read.
  3182. [heading Remarks]
  3183. The `read_some` operation may not read all of the requested number of bytes. Consider using the function `net::read` if you need to ensure that the requested amount of data is read before the blocking operation completes.
  3184. [endsect] [endsect] [section:write_some http::icy_stream::write_some] [indexterm2 write_some..http::icy_stream]
  3185. Write some data to the stream. ``` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__http__icy_stream.write_some.overload1 write_some]``( ConstBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__http__icy_stream.write_some.overload1 more...]]`` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__http__icy_stream.write_some.overload2 write_some]``( ConstBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__http__icy_stream.write_some.overload2 more...]]`` ``` [section:overload1 http::icy_stream::write_some (1 of 2 overloads)]
  3186. Write some data to the stream. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers); ``` [heading Description]
  3187. This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
  3188. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  3189. The data to be written. ]] ]
  3190. [heading Return Value]
  3191. The number of bytes written.
  3192. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  3193. Thrown on failure. ]] ]
  3194. [heading Remarks]
  3195. The `write_some` operation may not transmit all of the data to the peer. Consider using the function `net::write` if you need to ensure that all data is written before the blocking operation completes.
  3196. [endsect] [section:overload2 http::icy_stream::write_some (2 of 2 overloads)]
  3197. Write some data to the stream. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  3198. This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
  3199. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  3200. The data to be written. ]] [[`ec`][
  3201. Set to indicate what error occurred, if any. ]] ]
  3202. [heading Return Value]
  3203. The number of bytes written.
  3204. [heading Remarks]
  3205. The `write_some` operation may not transmit all of the data to the peer. Consider using the function `net::write` if you need to ensure that all data is written before the blocking operation completes.
  3206. [endsect] [endsect] [section:icy_stream_dtor_ http::icy_stream::~icy_stream] [indexterm2 ~icy_stream..http::icy_stream]
  3207. Destructor. [heading Synopsis] ``` ~icy_stream(); ``` [heading Description]
  3208. The treatment of pending operations will be the same as that of the next layer. [endsect] [endsect] [section:boost__beast__http__int_to_status http::int_to_status] [indexterm1 http::int_to_status]
  3209. Converts the integer to a known status-code. [heading Synopsis] Defined in header [include_file boost/beast/http/status.hpp] ``` status int_to_status( unsigned v); ``` [heading Description]
  3210. If the integer does not match a known status code, [link beast.ref.boost__beast__http__field `http::unknown`] is returned. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__is_body http::is_body] [indexterm1 http::is_body]
  3211. Determine if a type meets the ['Body] named requirements. [heading Synopsis] Defined in header [include_file boost/beast/http/type_traits.hpp] ``` template< class T> using is_body = ``['see-below]``; ``` [heading Description]
  3212. This alias template is `std::true_type` if `T` meets the requirements, otherwise it is `std::false_type`.
  3213. [heading Template Parameters] [table [[Type][Description]] [[`T`][
  3214. The type to test. ]] ]
  3215. [heading Example]
  3216. ``` template<bool isRequest, class Body, class Fields>
  3217. void check_body(message<isRequest, Body, Fields> const&)
  3218. {
  3219. static_assert(is_body<Body>::value,
  3220. "Body type requirements not met");
  3221. }
  3222. ```
  3223. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__is_body_reader http::is_body_reader] [indexterm1 http::is_body_reader]
  3224. Determine if a type has a nested ['BodyReader]. [heading Synopsis] Defined in header [include_file boost/beast/http/type_traits.hpp] ``` template< class T> using is_body_reader = ``['see-below]``; ``` [heading Description]
  3225. This alias template is `std::true_type` when:
  3226. * `T` has a nested type named `reader`
  3227. * `reader` meets the requirements of ['BodyReader].
  3228. [heading Template Parameters] [table [[Type][Description]] [[`T`][
  3229. The body type to test. ]] ]
  3230. [heading Example]
  3231. ``` template<bool isRequest, class Body, class Fields>
  3232. void check_can_parse(message<isRequest, Body, Fields>&)
  3233. {
  3234. static_assert(is_body_reader<Body>::value,
  3235. "Cannot parse Body, no reader");
  3236. }
  3237. ```
  3238. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__is_body_writer http::is_body_writer] [indexterm1 http::is_body_writer]
  3239. Determine if a type has a nested ['BodyWriter]. [heading Synopsis] Defined in header [include_file boost/beast/http/type_traits.hpp] ``` template< class T> using is_body_writer = ``['see-below]``; ``` [heading Description]
  3240. This alias template is `std::true_type` when:
  3241. * `T` has a nested type named `writer`
  3242. * `writer` meets the requirements of ['BodyWriter].
  3243. [heading Template Parameters] [table [[Type][Description]] [[`T`][
  3244. The body type to test. ]] ]
  3245. [heading Example]
  3246. ``` template<bool isRequest, class Body, class Fields>
  3247. void check_can_serialize(message<isRequest, Body, Fields> const&)
  3248. {
  3249. static_assert(is_body_writer<Body>::value,
  3250. "Cannot serialize Body, no reader");
  3251. }
  3252. ```
  3253. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__is_fields http::is_fields] [indexterm1 http::is_fields]
  3254. Determine if a type meets the ['Fields] named requirements. [heading Synopsis] Defined in header [include_file boost/beast/http/type_traits.hpp] ``` template< class T> using is_fields = ``['see-below]``; ``` [heading Description]
  3255. This alias template is `std::true_type` if `T` meets the requirements, otherwise it is `std::false_type`.
  3256. [heading Template Parameters] [table [[Type][Description]] [[`T`][
  3257. The type to test. ]] ]
  3258. [heading Example]
  3259. Use with `static_assert`: ``` template<bool isRequest, class Body, class Fields>
  3260. void f(message<isRequest, Body, Fields> const&)
  3261. {
  3262. static_assert(is_fields<Fields>::value,
  3263. "Fields type requirements not met");
  3264. ...
  3265. ```
  3266. Use with `std::enable_if` (SFINAE): ``` template<bool isRequest, class Body, class Fields>
  3267. typename std::enable_if<is_fields<Fields>::value>::type
  3268. f(message<isRequest, Body, Fields> const&);
  3269. ``` Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__is_mutable_body_writer http::is_mutable_body_writer] [indexterm1 http::is_mutable_body_writer]
  3270. Determine if a type has a nested ['BodyWriter]. [heading Synopsis] Defined in header [include_file boost/beast/http/type_traits.hpp] ``` template< class T> using is_mutable_body_writer = ``['see-below]``; ``` [heading Description]
  3271. This alias template is `std::true_type` when:
  3272. * `T` has a nested type named `writer`
  3273. * `writer` meets the requirements of ['BodyWriter].
  3274. [heading Template Parameters] [table [[Type][Description]] [[`T`][
  3275. The body type to test. ]] ]
  3276. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__make_chunk http::make_chunk] [indexterm1 http::make_chunk]
  3277. Returns a [link beast.ref.boost__beast__http__chunk_body `http::chunk_body`]. [heading Synopsis] Defined in header [include_file boost/beast/http/chunk_encode.hpp] ``` template< class __ConstBufferSequence__, class... Args> auto make_chunk( ConstBufferSequence const& buffers, Args&&... args); ``` [heading Description]
  3278. This functions constructs and returns a complete [link beast.ref.boost__beast__http__chunk_body `http::chunk_body`] for a chunk body represented by the specified buffer sequence.
  3279. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  3280. The buffers representing the chunk body. ]] [[`args`][
  3281. Optional arguments passed to the [link beast.ref.boost__beast__http__chunk_body `http::chunk_body`] constructor. ]] ]
  3282. [heading Remarks]
  3283. This function is provided as a notational convenience to omit specification of the class template arguments.
  3284. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__make_chunk_last http::make_chunk_last] [indexterm1 http::make_chunk_last]
  3285. Returns a [link beast.ref.boost__beast__http__chunk_last `http::chunk_last`]. ``` chunk_last< chunk_crlf > ``[link beast.ref.boost__beast__http__make_chunk_last.overload1 make_chunk_last]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__make_chunk_last.overload1 more...]]`` template< class Trailer, class... Args> chunk_last< Trailer > ``[link beast.ref.boost__beast__http__make_chunk_last.overload2 make_chunk_last]``( Trailer const& trailer, Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__http__make_chunk_last.overload2 more...]]`` ``` [section:overload1 http::make_chunk_last (1 of 2 overloads)]
  3286. Returns a [link beast.ref.boost__beast__http__chunk_last `http::chunk_last`]. [heading Synopsis] Defined in header [include_file boost/beast/http/chunk_encode.hpp] ``` chunk_last< chunk_crlf > make_chunk_last(); ``` [heading Description]
  3287. [heading Remarks]
  3288. This function is provided as a notational convenience to omit specification of the class template arguments.
  3289. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::make_chunk_last (2 of 2 overloads)]
  3290. Returns a [link beast.ref.boost__beast__http__chunk_last `http::chunk_last`]. [heading Synopsis] Defined in header [include_file boost/beast/http/chunk_encode.hpp] ``` template< class Trailer, class... Args> chunk_last< Trailer > make_chunk_last( Trailer const& trailer, Args&&... args); ``` [heading Description]
  3291. This function construct and returns a complete [link beast.ref.boost__beast__http__chunk_last `http::chunk_last`] for a last chunk containing the specified trailers.
  3292. [heading Parameters] [table [[Name][Description]] [[`trailer`][
  3293. A ConstBufferSequence or ]] ]
  3294. [heading Remarks]
  3295. This function is provided as a notational convenience to omit specification of the class template arguments.
  3296. [heading Parameters] [table [[Name][Description]] [[`args`][
  3297. Optional arguments passed to the [link beast.ref.boost__beast__http__chunk_last `http::chunk_last`] constructor. ]] ]
  3298. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__message http::message]
  3299. A container for a complete HTTP message. [heading Synopsis] Defined in header [include_file boost/beast/http/message.hpp] ``` template< bool isRequest, class __Body__, class __Fields__ = fields> class message : public http::header< isRequest, Fields > ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__message.body_type [*body_type]]] [ The type providing the body traits. ] ] [ [[link beast.ref.boost__beast__http__message.fields_type [*fields_type]]] [ The type representing the fields. ] ] [ [[link beast.ref.boost__beast__http__message.header_type [*header_type]]] [ The base class used to hold the header portion of the message. ] ] [ [[link beast.ref.boost__beast__http__message.is_request [*is_request]]] [ Indicates if the header is a request or response. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__message.base [*base]]] [ Returns the header portion of the message. ] ] [ [[link beast.ref.boost__beast__http__message.body [*body]]] [ Returns the body. ] ] [ [[link beast.ref.boost__beast__http__message.chunked [*chunked]]] [ Returns true if the chunked Transfer-Encoding is specified. Set or clear the chunked Transfer-Encoding. ] ] [ [[link beast.ref.boost__beast__http__message.content_length [*content_length]]] [ Set or clear the Content-Length field. ] ] [ [[link beast.ref.boost__beast__http__message.has_content_length [*has_content_length]]] [ Returns true if the Content-Length field is present. ] ] [ [[link beast.ref.boost__beast__http__message.keep_alive [*keep_alive]]] [ Returns true if the message semantics indicate keep-alive. Set the keep-alive message semantic option. ] ] [ [[link beast.ref.boost__beast__http__message.message [*message]]] [ Constructor. Construct a message. ] ] [ [[link beast.ref.boost__beast__http__message.method [*method]]] [ Return the request-method verb. Set the request-method. ] ] [ [[link beast.ref.boost__beast__http__message.method_string [*method_string]]] [ Return the request-method as a string. ] ] [ [[link beast.ref.boost__beast__http__message.need_eof [*need_eof]]] [ Returns true if the message semantics require an end of file. ] ] [ [[link beast.ref.boost__beast__http__message.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__http__message.payload_size [*payload_size]]] [ Returns the payload size of the body in octets if possible. ] ] [ [[link beast.ref.boost__beast__http__message.prepare_payload [*prepare_payload]]] [ Prepare the message payload fields for the body. ] ] [ [[link beast.ref.boost__beast__http__message.reason [*reason]]] [ Return the response reason-phrase. Set the response reason-phrase (deprecated) ] ] [ [[link beast.ref.boost__beast__http__message.result [*result]]] [ The response status-code result. Set the response status-code. Set the response status-code as an integer. ] ] [ [[link beast.ref.boost__beast__http__message.result_int [*result_int]]] [ The response status-code expressed as an integer. ] ] [ [[link beast.ref.boost__beast__http__message.target [*target]]] [ Returns the request-target string. Set the request-target string. ] ] [ [[link beast.ref.boost__beast__http__message.version [*version]]] [ Return the HTTP-version. Set the HTTP-version. ] ] ] [heading Description]
  3300. This container is derived from the `Fields` template type. To understand all of the members of this class it is necessary to view the declaration for the `Fields` type. When using the default fields container, those declarations are in [link beast.ref.boost__beast__http__fields `http::fields`].
  3301. A message can be a request or response, depending on the `isRequest` template argument value. Requests and responses have different types; functions may be overloaded based on the type if desired.
  3302. The `Body` template argument type determines the model used to read or write the content body of the message.
  3303. Newly constructed messages objects have version set to HTTP/1.1. Newly constructed response objects also have result code set to [link beast.ref.boost__beast__http__status `http::ok`].
  3304. [heading Template Parameters] [table [[Type][Description]] [[`isRequest`][
  3305. `true` if this represents a request, or `false` if this represents a response. Some class data members are conditionally present depending on this value. ]] [[`Body`][
  3306. A type meeting the requirements of Body. ]] [[`Fields`][
  3307. The type of container used to hold the field value pairs. ]] ]
  3308. [section:base http::message::base] [indexterm2 base..http::message]
  3309. Returns the header portion of the message. ``` header_type const & ``[link beast.ref.boost__beast__http__message.base.overload1 base]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.base.overload1 more...]]`` header_type& ``[link beast.ref.boost__beast__http__message.base.overload2 base]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.base.overload2 more...]]`` ``` [section:overload1 http::message::base (1 of 2 overloads)]
  3310. Returns the header portion of the message. [heading Synopsis] ``` header_type const & base() const; ``` [heading Description] [endsect] [section:overload2 http::message::base (2 of 2 overloads)]
  3311. Returns the header portion of the message. [heading Synopsis] ``` header_type& base(); ``` [heading Description] [endsect] [endsect] [section:body http::message::body] [indexterm2 body..http::message]
  3312. Returns the body. ``` body_type::value_type& ``[link beast.ref.boost__beast__http__message.body.overload1 body]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.body.overload1 more...]]`` body_type::value_type&& ``[link beast.ref.boost__beast__http__message.body.overload2 body]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.body.overload2 more...]]`` body_type::value_type const & ``[link beast.ref.boost__beast__http__message.body.overload3 body]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.body.overload3 more...]]`` ``` [section:overload1 http::message::body (1 of 3 overloads)]
  3313. Returns the body. [heading Synopsis] ``` body_type::value_type& body(); ``` [heading Description] [endsect] [section:overload2 http::message::body (2 of 3 overloads)]
  3314. Returns the body. [heading Synopsis] ``` body_type::value_type&& body(); ``` [heading Description] [endsect] [section:overload3 http::message::body (3 of 3 overloads)]
  3315. Returns the body. [heading Synopsis] ``` body_type::value_type const & body() const; ``` [heading Description] [endsect] [endsect] [section:body_type http::message::body_type] [indexterm2 body_type..http::message]
  3316. The type providing the body traits. [heading Synopsis] ``` using body_type = Body; ``` [heading Description]
  3317. The [link beast.ref.boost__beast__http__message.body `http::message::body`] member will be of type `body_type::value_type`. [endsect] [section:chunked http::message::chunked] [indexterm2 chunked..http::message]
  3318. Returns `true` if the chunked Transfer-Encoding is specified. ``` bool ``[link beast.ref.boost__beast__http__message.chunked.overload1 chunked]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.chunked.overload1 more...]]`` ```
  3319. Set or clear the chunked Transfer-Encoding. ``` void ``[link beast.ref.boost__beast__http__message.chunked.overload2 chunked]``( bool value); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.chunked.overload2 more...]]`` ``` [section:overload1 http::message::chunked (1 of 2 overloads)]
  3320. Returns `true` if the chunked Transfer-Encoding is specified. [heading Synopsis] ``` bool chunked() const; ``` [heading Description] [endsect] [section:overload2 http::message::chunked (2 of 2 overloads)]
  3321. Set or clear the chunked Transfer-Encoding. [heading Synopsis] ``` void chunked( bool value); ``` [heading Description]
  3322. This function will set or remove the "chunked" transfer encoding as the last item in the list of encodings in the field.
  3323. If the result of removing the chunked token results in an empty string, the field is erased.
  3324. The Content-Length field is erased unconditionally. [endsect] [endsect] [section:content_length http::message::content_length] [indexterm2 content_length..http::message]
  3325. Set or clear the Content-Length field. [heading Synopsis] ``` void content_length( boost::optional< std::uint64_t > const& value); ``` [heading Description]
  3326. This function adjusts the Content-Length field as follows:
  3327. * If `value` specifies a value, the Content-Length field is set to the value. Otherwise
  3328. * The Content-Length field is erased.
  3329. If "chunked" token appears as the last item in the Transfer-Encoding field it is unconditionally removed.
  3330. [heading Parameters] [table [[Name][Description]] [[`value`][
  3331. The value to set for Content-Length. ]] ]
  3332. [endsect] [section:fields_type http::message::fields_type] (Inherited from `http::header`) [indexterm2 fields_type..http::message]
  3333. The type representing the fields. [heading Synopsis] ``` using fields_type = Fields; ``` [heading Description] [endsect] [section:has_content_length http::message::has_content_length] [indexterm2 has_content_length..http::message]
  3334. Returns `true` if the Content-Length field is present. [heading Synopsis] ``` bool has_content_length() const; ``` [heading Description]
  3335. This function inspects the fields and returns `true` if the Content-Length field is present. The properties of the body are not checked, this only looks for the field. [endsect] [section:header_type http::message::header_type] [indexterm2 header_type..http::message]
  3336. The base class used to hold the header portion of the message. [heading Synopsis] ``` using header_type = header< isRequest, Fields >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__header.fields_type [*fields_type]]] [ The type representing the fields. ] ] [ [[link beast.ref.boost__beast__http__header.is_request [*is_request]]] [ Indicates if the header is a request or response. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__header.header [*header]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__header.method [*method]]] [ Return the request-method verb. Set the request-method. ] ] [ [[link beast.ref.boost__beast__http__header.method_string [*method_string]]] [ Return the request-method as a string. ] ] [ [[link beast.ref.boost__beast__http__header.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__http__header.reason [*reason]]] [ Return the response reason-phrase. Set the response reason-phrase (deprecated) ] ] [ [[link beast.ref.boost__beast__http__header.result [*result]]] [ The response status-code result. Set the response status-code. Set the response status-code as an integer. ] ] [ [[link beast.ref.boost__beast__http__header.result_int [*result_int]]] [ The response status-code expressed as an integer. ] ] [ [[link beast.ref.boost__beast__http__header.target [*target]]] [ Returns the request-target string. Set the request-target string. ] ] [ [[link beast.ref.boost__beast__http__header.version [*version]]] [ Return the HTTP-version. Set the HTTP-version. ] ] ]
  3337. This container is derived from the `Fields` template type. To understand all of the members of this class it is necessary to view the declaration for the `Fields` type. When using the default fields container, those declarations are in [link beast.ref.boost__beast__http__fields `http::fields`].
  3338. Newly constructed header objects have version set to HTTP/1.1. Newly constructed response objects also have result code set to [link beast.ref.boost__beast__http__status `http::ok`].
  3339. A `header` includes the start-line and header-fields. [heading Description] [endsect] [section:is_request http::message::is_request] (Inherited from `http::header`) [indexterm2 is_request..http::message]
  3340. Indicates if the header is a request or response. [heading Synopsis] ``` using is_request = std::integral_constant< bool, isRequest >; ``` [heading Description] [endsect] [section:keep_alive http::message::keep_alive] [indexterm2 keep_alive..http::message]
  3341. Returns `true` if the message semantics indicate keep-alive. ``` bool ``[link beast.ref.boost__beast__http__message.keep_alive.overload1 keep_alive]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.keep_alive.overload1 more...]]`` ```
  3342. Set the keep-alive message semantic option. ``` void ``[link beast.ref.boost__beast__http__message.keep_alive.overload2 keep_alive]``( bool value); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.keep_alive.overload2 more...]]`` ``` [section:overload1 http::message::keep_alive (1 of 2 overloads)]
  3343. Returns `true` if the message semantics indicate keep-alive. [heading Synopsis] ``` bool keep_alive() const; ``` [heading Description]
  3344. The value depends on the version in the message, which must be set to the final value before this function is called or else the return value is unreliable. [endsect] [section:overload2 http::message::keep_alive (2 of 2 overloads)]
  3345. Set the keep-alive message semantic option. [heading Synopsis] ``` void keep_alive( bool value); ``` [heading Description]
  3346. This function adjusts the Connection field to indicate whether or not the connection should be kept open after the corresponding response. The result depends on the version set on the message, which must be set to the final value before making this call.
  3347. [heading Parameters] [table [[Name][Description]] [[`value`][
  3348. `true` if the connection should persist. ]] ]
  3349. [endsect] [endsect] [section:message http::message::message] [indexterm2 message..http::message]
  3350. Constructor. ``` ``[link beast.ref.boost__beast__http__message.message.overload1 message]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload1 more...]]`` ``[link beast.ref.boost__beast__http__message.message.overload2 message]``( message&&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload2 more...]]`` ``[link beast.ref.boost__beast__http__message.message.overload3 message]``( message const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload3 more...]]`` template< class... BodyArgs> explicit ``[link beast.ref.boost__beast__http__message.message.overload4 message]``( header_type&& h, BodyArgs&&... body_args); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload4 more...]]`` template< class... BodyArgs> explicit ``[link beast.ref.boost__beast__http__message.message.overload5 message]``( header_type const& h, BodyArgs&&... body_args); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload5 more...]]`` ``[link beast.ref.boost__beast__http__message.message.overload6 message]``( verb method, string_view target, unsigned version); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload6 more...]]`` template< class BodyArg> ``[link beast.ref.boost__beast__http__message.message.overload7 message]``( verb method, string_view target, unsigned version, BodyArg&& body_arg); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload7 more...]]`` template< class BodyArg, class FieldsArg> ``[link beast.ref.boost__beast__http__message.message.overload8 message]``( verb method, string_view target, unsigned version, BodyArg&& body_arg, FieldsArg&& fields_arg); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload8 more...]]`` ``[link beast.ref.boost__beast__http__message.message.overload9 message]``( status result, unsigned version); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload9 more...]]`` template< class BodyArg> ``[link beast.ref.boost__beast__http__message.message.overload10 message]``( status result, unsigned version, BodyArg&& body_arg); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload10 more...]]`` template< class BodyArg, class FieldsArg> ``[link beast.ref.boost__beast__http__message.message.overload11 message]``( status result, unsigned version, BodyArg&& body_arg, FieldsArg&& fields_arg); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload11 more...]]`` explicit ``[link beast.ref.boost__beast__http__message.message.overload12 message]``( std::piecewise_construct_t); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload12 more...]]`` ```
  3351. Construct a message. ``` template< class... BodyArgs> ``[link beast.ref.boost__beast__http__message.message.overload13 message]``( std::piecewise_construct_t, std::tuple< BodyArgs... > body_args); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload13 more...]]`` template< class... BodyArgs, class... FieldsArgs> ``[link beast.ref.boost__beast__http__message.message.overload14 message]``( std::piecewise_construct_t, std::tuple< BodyArgs... > body_args, std::tuple< FieldsArgs... > fields_args); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.message.overload14 more...]]`` ``` [section:overload1 http::message::message (1 of 14 overloads)]
  3352. Constructor. [heading Synopsis] ``` message(); ``` [heading Description] [endsect] [section:overload2 http::message::message (2 of 14 overloads)]
  3353. Constructor. [heading Synopsis] ``` message( message&&); ``` [heading Description] [endsect] [section:overload3 http::message::message (3 of 14 overloads)]
  3354. Constructor. [heading Synopsis] ``` message( message const&); ``` [heading Description] [endsect] [section:overload4 http::message::message (4 of 14 overloads)]
  3355. Constructor. [heading Synopsis] ``` template< class... BodyArgs> message( header_type&& h, BodyArgs&&... body_args); ``` [heading Description]
  3356. [heading Parameters] [table [[Name][Description]] [[`h`][
  3357. The header to move construct from. ]] [[`body_args`][
  3358. Optional arguments forwarded to the `body` constructor. ]] ]
  3359. [endsect] [section:overload5 http::message::message (5 of 14 overloads)]
  3360. Constructor. [heading Synopsis] ``` template< class... BodyArgs> message( header_type const& h, BodyArgs&&... body_args); ``` [heading Description]
  3361. [heading Parameters] [table [[Name][Description]] [[`h`][
  3362. The header to copy construct from. ]] [[`body_args`][
  3363. Optional arguments forwarded to the `body` constructor. ]] ]
  3364. [endsect] [section:overload6 http::message::message (6 of 14 overloads)]
  3365. Constructor. [heading Synopsis] ``` message( verb method, string_view target, unsigned version); ``` [heading Description]
  3366. [heading Parameters] [table [[Name][Description]] [[`method`][
  3367. The request-method to use. ]] [[`target`][
  3368. The request-target. ]] [[`version`][
  3369. The HTTP-version. ]] ]
  3370. [heading Remarks]
  3371. This function is only available when `isRequest == true`.
  3372. [endsect] [section:overload7 http::message::message (7 of 14 overloads)]
  3373. Constructor. [heading Synopsis] ``` template< class BodyArg> message( verb method, string_view target, unsigned version, BodyArg&& body_arg); ``` [heading Description]
  3374. [heading Parameters] [table [[Name][Description]] [[`method`][
  3375. The request-method to use. ]] [[`target`][
  3376. The request-target. ]] [[`version`][
  3377. The HTTP-version. ]] [[`body_arg`][
  3378. An argument forwarded to the `body` constructor. ]] ]
  3379. [heading Remarks]
  3380. This function is only available when `isRequest == true`.
  3381. [endsect] [section:overload8 http::message::message (8 of 14 overloads)]
  3382. Constructor. [heading Synopsis] ``` template< class BodyArg, class FieldsArg> message( verb method, string_view target, unsigned version, BodyArg&& body_arg, FieldsArg&& fields_arg); ``` [heading Description]
  3383. [heading Parameters] [table [[Name][Description]] [[`method`][
  3384. The request-method to use. ]] [[`target`][
  3385. The request-target. ]] [[`version`][
  3386. The HTTP-version. ]] [[`body_arg`][
  3387. An argument forwarded to the `body` constructor. ]] [[`fields_arg`][
  3388. An argument forwarded to the `Fields` constructor. ]] ]
  3389. [heading Remarks]
  3390. This function is only available when `isRequest == true`.
  3391. [endsect] [section:overload9 http::message::message (9 of 14 overloads)]
  3392. Constructor. [heading Synopsis] ``` message( status result, unsigned version); ``` [heading Description]
  3393. [heading Parameters] [table [[Name][Description]] [[`result`][
  3394. The status-code for the response. ]] [[`version`][
  3395. The HTTP-version. ]] ]
  3396. [heading Remarks]
  3397. This member is only available when `isRequest == false`.
  3398. [endsect] [section:overload10 http::message::message (10 of 14 overloads)]
  3399. Constructor. [heading Synopsis] ``` template< class BodyArg> message( status result, unsigned version, BodyArg&& body_arg); ``` [heading Description]
  3400. [heading Parameters] [table [[Name][Description]] [[`result`][
  3401. The status-code for the response. ]] [[`version`][
  3402. The HTTP-version. ]] [[`body_arg`][
  3403. An argument forwarded to the `body` constructor. ]] ]
  3404. [heading Remarks]
  3405. This member is only available when `isRequest == false`.
  3406. [endsect] [section:overload11 http::message::message (11 of 14 overloads)]
  3407. Constructor. [heading Synopsis] ``` template< class BodyArg, class FieldsArg> message( status result, unsigned version, BodyArg&& body_arg, FieldsArg&& fields_arg); ``` [heading Description]
  3408. [heading Parameters] [table [[Name][Description]] [[`result`][
  3409. The status-code for the response. ]] [[`version`][
  3410. The HTTP-version. ]] [[`body_arg`][
  3411. An argument forwarded to the `body` constructor. ]] [[`fields_arg`][
  3412. An argument forwarded to the `Fields` base class constructor. ]] ]
  3413. [heading Remarks]
  3414. This member is only available when `isRequest == false`.
  3415. [endsect] [section:overload12 http::message::message (12 of 14 overloads)]
  3416. Constructor. [heading Synopsis] ``` message( std::piecewise_construct_t); ``` [heading Description]
  3417. The header and body are default-constructed. [endsect] [section:overload13 http::message::message (13 of 14 overloads)]
  3418. Construct a message. [heading Synopsis] ``` template< class... BodyArgs> message( std::piecewise_construct_t, std::tuple< BodyArgs... > body_args); ``` [heading Description]
  3419. [heading Parameters] [table [[Name][Description]] [[`body_args`][
  3420. A tuple forwarded as a parameter pack to the body constructor. ]] ]
  3421. [endsect] [section:overload14 http::message::message (14 of 14 overloads)]
  3422. Construct a message. [heading Synopsis] ``` template< class... BodyArgs, class... FieldsArgs> message( std::piecewise_construct_t, std::tuple< BodyArgs... > body_args, std::tuple< FieldsArgs... > fields_args); ``` [heading Description]
  3423. [heading Parameters] [table [[Name][Description]] [[`body_args`][
  3424. A tuple forwarded as a parameter pack to the body constructor. ]] [[`fields_args`][
  3425. A tuple forwarded as a parameter pack to the `Fields` constructor. ]] ]
  3426. [endsect] [endsect] [section:method http::message::method] [indexterm2 method..http::message]
  3427. Return the request-method verb. ``` verb ``[link beast.ref.boost__beast__http__message.method.overload1 method]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.method.overload1 more...]]`` ```
  3428. Set the request-method. ``` void ``[link beast.ref.boost__beast__http__message.method.overload2 method]``( verb v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.method.overload2 more...]]`` ``` [section:overload1 http::message::method (1 of 2 overloads)] (Inherited from `http::header`)
  3429. Return the request-method verb. [heading Synopsis] ``` verb method() const; ``` [heading Description]
  3430. If the request-method is not one of the recognized verbs, [link beast.ref.boost__beast__http__field `http::unknown`] is returned. Callers may use [link beast.ref.boost__beast__http__header.method_string `http::header::method_string`] to retrieve the exact text.
  3431. [heading Remarks]
  3432. This function is only available when `isRequest == true`.
  3433. [heading See Also]
  3434. [link beast.ref.boost__beast__http__header.method_string `http::header::method_string`]
  3435. [endsect] [section:overload2 http::message::method (2 of 2 overloads)] (Inherited from `http::header`)
  3436. Set the request-method. [heading Synopsis] ``` void method( verb v); ``` [heading Description]
  3437. This function will set the method for requests to a known verb.
  3438. [heading Parameters] [table [[Name][Description]] [[`v`][
  3439. The request method verb to set. This may not be [link beast.ref.boost__beast__http__field `http::unknown`]. ]] ]
  3440. [heading Exceptions] [table [[Type][Thrown On]] [[`std::invalid_argument`][
  3441. when `v == verb::unknown`. ]] ]
  3442. [heading Remarks]
  3443. This function is only available when `isRequest == true`.
  3444. [endsect] [endsect] [section:method_string http::message::method_string] [indexterm2 method_string..http::message]
  3445. Return the request-method as a string. ``` string_view ``[link beast.ref.boost__beast__http__message.method_string.overload1 method_string]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.method_string.overload1 more...]]`` void ``[link beast.ref.boost__beast__http__message.method_string.overload2 method_string]``( string_view s); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.method_string.overload2 more...]]`` ``` [section:overload1 http::message::method_string (1 of 2 overloads)] (Inherited from `http::header`)
  3446. Return the request-method as a string. [heading Synopsis] ``` string_view method_string() const; ``` [heading Description]
  3447. [heading Remarks]
  3448. This function is only available when `isRequest == true`.
  3449. [heading See Also]
  3450. [link beast.ref.boost__beast__http__header.method `http::header::method`]
  3451. [endsect] [section:overload2 http::message::method_string (2 of 2 overloads)] (Inherited from `http::header`)
  3452. Set the request-method. [heading Synopsis] ``` void method_string( string_view s); ``` [heading Description]
  3453. This function will set the request-method a known verb if the string matches, otherwise it will store a copy of the passed string.
  3454. [heading Parameters] [table [[Name][Description]] [[`s`][
  3455. A string representing the request-method. ]] ]
  3456. [heading Remarks]
  3457. This function is only available when `isRequest == true`.
  3458. [endsect] [endsect] [section:need_eof http::message::need_eof] [indexterm2 need_eof..http::message]
  3459. Returns `true` if the message semantics require an end of file. [heading Synopsis] ``` bool need_eof() const; ``` [heading Description]
  3460. For HTTP requests, this function returns the logical NOT of a call to [link beast.ref.boost__beast__http__message.keep_alive `http::message::keep_alive`].
  3461. For HTTP responses, this function returns the logical NOT of a call to [link beast.ref.boost__beast__http__message.keep_alive `http::message::keep_alive`] if any of the following are true:
  3462. * [link beast.ref.boost__beast__http__message.has_content_length `http::message::has_content_length`] would return `true`
  3463. * [link beast.ref.boost__beast__http__message.chunked `http::message::chunked`] would return `true`
  3464. * [link beast.ref.boost__beast__http__header.result `http::header::result`] returns [link beast.ref.boost__beast__http__status `http::no_content`]
  3465. * [link beast.ref.boost__beast__http__header.result `http::header::result`] returns [link beast.ref.boost__beast__http__status `http::not_modified`]
  3466. * [link beast.ref.boost__beast__http__header.result `http::header::result`] returns any informational status class (100 to 199)
  3467. Otherwise, the function returns `true`.
  3468. [heading See Also]
  3469. [@https://tools.ietf.org/html/rfc7230#section-3.3 https://tools.ietf.org/html/rfc7230#section-3.3]
  3470. [endsect] [section:operator_eq_ http::message::operator=] [indexterm2 operator=..http::message]
  3471. Assignment. ``` message& ``[link beast.ref.boost__beast__http__message.operator_eq_.overload1 operator=]``( message&&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.operator_eq_.overload1 more...]]`` message& ``[link beast.ref.boost__beast__http__message.operator_eq_.overload2 operator=]``( message const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.operator_eq_.overload2 more...]]`` ``` [section:overload1 http::message::operator= (1 of 2 overloads)]
  3472. Assignment. [heading Synopsis] ``` message& operator=( message&&); ``` [heading Description] [endsect] [section:overload2 http::message::operator= (2 of 2 overloads)]
  3473. Assignment. [heading Synopsis] ``` message& operator=( message const&); ``` [heading Description] [endsect] [endsect] [section:payload_size http::message::payload_size] [indexterm2 payload_size..http::message]
  3474. Returns the payload size of the body in octets if possible. [heading Synopsis] ``` boost::optional< std::uint64_t > payload_size() const; ``` [heading Description]
  3475. This function invokes the ['Body] algorithm to measure the number of octets in the serialized body container. If there is no body, this will return zero. Otherwise, if the body exists but is not known ahead of time, `boost::none` is returned (usually indicating that a chunked Transfer-Encoding will be used).
  3476. [heading Remarks]
  3477. The value of the Content-Length field in the message is not inspected.
  3478. [endsect] [section:prepare_payload http::message::prepare_payload] [indexterm2 prepare_payload..http::message]
  3479. Prepare the message payload fields for the body. [heading Synopsis] ``` void prepare_payload(); ``` [heading Description]
  3480. This function will adjust the Content-Length and Transfer-Encoding field values based on the properties of the body.
  3481. [heading Example]
  3482. ``` request<string_body> req{verb::post, "/"};
  3483. req.set(field::user_agent, "Beast");
  3484. req.body() = "Hello, world!";
  3485. req.prepare_payload();
  3486. ```
  3487. [endsect] [section:reason http::message::reason] [indexterm2 reason..http::message]
  3488. Return the response reason-phrase. ``` string_view ``[link beast.ref.boost__beast__http__message.reason.overload1 reason]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.reason.overload1 more...]]`` ```
  3489. Set the response reason-phrase (deprecated) ``` void ``[link beast.ref.boost__beast__http__message.reason.overload2 reason]``( string_view s); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.reason.overload2 more...]]`` ``` [section:overload1 http::message::reason (1 of 2 overloads)] (Inherited from `http::header`)
  3490. Return the response reason-phrase. [heading Synopsis] ``` string_view reason() const; ``` [heading Description]
  3491. The reason-phrase is obsolete as of rfc7230.
  3492. [heading Remarks]
  3493. This function is only available when `isRequest == false`.
  3494. [endsect] [section:overload2 http::message::reason (2 of 2 overloads)] (Inherited from `http::header`)
  3495. Set the response reason-phrase (deprecated) [heading Synopsis] ``` void reason( string_view s); ``` [heading Description]
  3496. This function sets a custom reason-phrase to a copy of the string passed in. Normally it is not necessary to set the reason phrase on an outgoing response object; the implementation will automatically use the standard reason text for the corresponding status code.
  3497. To clear a previously set custom phrase, pass an empty string. This will restore the default standard reason text based on the status code used when serializing.
  3498. The reason-phrase is obsolete as of rfc7230.
  3499. [heading Parameters] [table [[Name][Description]] [[`s`][
  3500. The string to use for the reason-phrase. ]] ]
  3501. [heading Remarks]
  3502. This function is only available when `isRequest == false`.
  3503. [endsect] [endsect] [section:result http::message::result] [indexterm2 result..http::message]
  3504. The response status-code result. ``` status ``[link beast.ref.boost__beast__http__message.result.overload1 result]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.result.overload1 more...]]`` ```
  3505. Set the response status-code. ``` void ``[link beast.ref.boost__beast__http__message.result.overload2 result]``( status v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.result.overload2 more...]]`` ```
  3506. Set the response status-code as an integer. ``` void ``[link beast.ref.boost__beast__http__message.result.overload3 result]``( unsigned v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.result.overload3 more...]]`` ``` [section:overload1 http::message::result (1 of 3 overloads)] (Inherited from `http::header`)
  3507. The response status-code result. [heading Synopsis] ``` status result() const; ``` [heading Description]
  3508. If the actual status code is not a known code, this function returns [link beast.ref.boost__beast__http__field `http::unknown`]. Use [link beast.ref.boost__beast__http__header.result_int `http::header::result_int`] to return the raw status code as a number.
  3509. [heading Remarks]
  3510. This member is only available when `isRequest == false`.
  3511. [endsect] [section:overload2 http::message::result (2 of 3 overloads)] (Inherited from `http::header`)
  3512. Set the response status-code. [heading Synopsis] ``` void result( status v); ``` [heading Description]
  3513. [heading Parameters] [table [[Name][Description]] [[`v`][
  3514. The code to set. ]] ]
  3515. [heading Remarks]
  3516. This member is only available when `isRequest == false`.
  3517. [endsect] [section:overload3 http::message::result (3 of 3 overloads)] (Inherited from `http::header`)
  3518. Set the response status-code as an integer. [heading Synopsis] ``` void result( unsigned v); ``` [heading Description]
  3519. This sets the status code to the exact number passed in. If the number does not correspond to one of the known status codes, the function [link beast.ref.boost__beast__http__header.result `http::header::result`] will return [link beast.ref.boost__beast__http__field `http::unknown`]. Use [link beast.ref.boost__beast__http__header.result_int `http::header::result_int`] to obtain the original raw status-code.
  3520. [heading Parameters] [table [[Name][Description]] [[`v`][
  3521. The status-code integer to set. ]] ]
  3522. [heading Exceptions] [table [[Type][Thrown On]] [[`std::invalid_argument`][
  3523. if `v > 999`. ]] ]
  3524. [endsect] [endsect] [section:result_int http::message::result_int] (Inherited from `http::header`) [indexterm2 result_int..http::message]
  3525. The response status-code expressed as an integer. [heading Synopsis] ``` unsigned result_int() const; ``` [heading Description]
  3526. This returns the raw status code as an integer, even when that code is not in the list of known status codes.
  3527. [heading Remarks]
  3528. This member is only available when `isRequest == false`.
  3529. [endsect] [section:target http::message::target] [indexterm2 target..http::message]
  3530. Returns the request-target string. ``` string_view ``[link beast.ref.boost__beast__http__message.target.overload1 target]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.target.overload1 more...]]`` ```
  3531. Set the request-target string. ``` void ``[link beast.ref.boost__beast__http__message.target.overload2 target]``( string_view s); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.target.overload2 more...]]`` ``` [section:overload1 http::message::target (1 of 2 overloads)] (Inherited from `http::header`)
  3532. Returns the request-target string. [heading Synopsis] ``` string_view target() const; ``` [heading Description]
  3533. The request target string returned is the same string which was received from the network or stored. In particular, it will contain url-encoded characters and should follow the syntax rules for URIs used with HTTP.
  3534. [heading Remarks]
  3535. This function is only available when `isRequest == true`.
  3536. [endsect] [section:overload2 http::message::target (2 of 2 overloads)] (Inherited from `http::header`)
  3537. Set the request-target string. [heading Synopsis] ``` void target( string_view s); ``` [heading Description]
  3538. It is the caller's responsibility to ensure that the request target string follows the syntax rules for URIs used with HTTP. In particular, reserved or special characters must be url-encoded. The implementation does not perform syntax checking on the passed string.
  3539. [heading Parameters] [table [[Name][Description]] [[`s`][
  3540. A string representing the request-target. ]] ]
  3541. [heading Remarks]
  3542. This function is only available when `isRequest == true`.
  3543. [endsect] [endsect] [section:version http::message::version] [indexterm2 version..http::message]
  3544. Return the HTTP-version. ``` unsigned ``[link beast.ref.boost__beast__http__message.version.overload1 version]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.version.overload1 more...]]`` ```
  3545. Set the HTTP-version. ``` void ``[link beast.ref.boost__beast__http__message.version.overload2 version]``( unsigned value); ``[''''&raquo;''' [link beast.ref.boost__beast__http__message.version.overload2 more...]]`` ``` [section:overload1 http::message::version (1 of 2 overloads)] (Inherited from `http::header`)
  3546. Return the HTTP-version. [heading Synopsis] ``` unsigned version() const; ``` [heading Description]
  3547. This holds both the major and minor version numbers, using these formulas: ``` unsigned major = version / 10;
  3548. unsigned minor = version % 10;
  3549. ```
  3550. Newly constructed headers will use HTTP/1.1 by default. [endsect] [section:overload2 http::message::version (2 of 2 overloads)] (Inherited from `http::header`)
  3551. Set the HTTP-version. [heading Synopsis] ``` void version( unsigned value); ``` [heading Description]
  3552. This holds both the major and minor version numbers, using these formulas: ``` unsigned major = version / 10;
  3553. unsigned minor = version % 10;
  3554. ```
  3555. Newly constructed headers will use HTTP/1.1 by default.
  3556. [heading Parameters] [table [[Name][Description]] [[`value`][
  3557. The version number to use ]] ]
  3558. [endsect] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__obsolete_reason http::obsolete_reason] [indexterm1 http::obsolete_reason]
  3559. Returns the obsolete reason-phrase text for a status code. [heading Synopsis] Defined in header [include_file boost/beast/http/status.hpp] ``` string_view obsolete_reason( status v); ``` [heading Description]
  3560. [heading Parameters] [table [[Name][Description]] [[`v`][
  3561. The status code to use. ]] ]
  3562. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__operator_lt__lt_ http::operator<<] [indexterm1 http::operator<<]
  3563. Write the text for a field name to an output stream. ``` std::ostream& ``[link beast.ref.boost__beast__http__operator_lt__lt_.overload1 operator<<]``( std::ostream& os, field f); ``[''''&raquo;''' [link beast.ref.boost__beast__http__operator_lt__lt_.overload1 more...]]`` ```
  3564. Outputs the standard reason phrase of a status code to a stream. ``` std::ostream& ``[link beast.ref.boost__beast__http__operator_lt__lt_.overload2 operator<<]``( std::ostream&, status); ``[''''&raquo;''' [link beast.ref.boost__beast__http__operator_lt__lt_.overload2 more...]]`` ```
  3565. Write the text for a request method verb to an output stream. ``` std::ostream& ``[link beast.ref.boost__beast__http__operator_lt__lt_.overload3 operator<<]``( std::ostream& os, verb v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__operator_lt__lt_.overload3 more...]]`` ```
  3566. Serialize an HTTP/1 header to a `std::ostream`. ``` template< bool isRequest, class __Fields__> std::ostream& ``[link beast.ref.boost__beast__http__operator_lt__lt_.overload4 operator<<]``( std::ostream& os, header< isRequest, Fields > const& msg); ``[''''&raquo;''' [link beast.ref.boost__beast__http__operator_lt__lt_.overload4 more...]]`` ```
  3567. Serialize an HTTP/1 message to a `std::ostream`. ``` template< bool isRequest, class __Body__, class __Fields__> std::ostream& ``[link beast.ref.boost__beast__http__operator_lt__lt_.overload5 operator<<]``( std::ostream& os, message< isRequest, Body, Fields > const& msg); ``[''''&raquo;''' [link beast.ref.boost__beast__http__operator_lt__lt_.overload5 more...]]`` ``` [section:overload1 http::operator<< (1 of 5 overloads)]
  3568. Write the text for a field name to an output stream. [heading Synopsis] Defined in header [include_file boost/beast/http/field.hpp] ``` std::ostream& operator<<( std::ostream& os, field f); ``` [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::operator<< (2 of 5 overloads)]
  3569. Outputs the standard reason phrase of a status code to a stream. [heading Synopsis] Defined in header [include_file boost/beast/http/status.hpp] ``` std::ostream& operator<<( std::ostream&, status); ``` [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload3 http::operator<< (3 of 5 overloads)]
  3570. Write the text for a request method verb to an output stream. [heading Synopsis] Defined in header [include_file boost/beast/http/verb.hpp] ``` std::ostream& operator<<( std::ostream& os, verb v); ``` [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload4 http::operator<< (4 of 5 overloads)]
  3571. Serialize an HTTP/1 header to a `std::ostream`. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< bool isRequest, class __Fields__> std::ostream& operator<<( std::ostream& os, header< isRequest, Fields > const& msg); ``` [heading Description]
  3572. The function converts the header to its HTTP/1 serialized representation and stores the result in the output stream.
  3573. [heading Parameters] [table [[Name][Description]] [[`os`][
  3574. The output stream to write to. ]] [[`msg`][
  3575. The message fields to write. ]] ]
  3576. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload5 http::operator<< (5 of 5 overloads)]
  3577. Serialize an HTTP/1 message to a `std::ostream`. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< bool isRequest, class __Body__, class __Fields__> std::ostream& operator<<( std::ostream& os, message< isRequest, Body, Fields > const& msg); ``` [heading Description]
  3578. The function converts the message to its HTTP/1 serialized representation and stores the result in the output stream.
  3579. The implementation will automatically perform chunk encoding if the contents of the message indicate that chunk encoding is required.
  3580. [heading Parameters] [table [[Name][Description]] [[`os`][
  3581. The output stream to write to. ]] [[`msg`][
  3582. The message to write. ]] ]
  3583. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__opt_token_list http::opt_token_list] [indexterm1 http::opt_token_list]
  3584. A list of tokens in a comma separated HTTP field value. [heading Synopsis] Defined in header [include_file boost/beast/http/rfc7230.hpp] ``` using opt_token_list = detail::basic_parsed_list< detail::opt_token_list_policy >; ``` [heading Description]
  3585. This container allows iteration of a list of items in a header field value. The input is a comma separated list of tokens.
  3586. If a parsing error is encountered while iterating the string, the behavior of the container will be as if a string containing only characters up to but excluding the first invalid character was used to construct the list.
  3587. [heading BNF]
  3588. ``` token-list = *( "," OWS ) token *( OWS "," [ OWS token ] )
  3589. ```
  3590. To use this class, construct with the string to be parsed and then use `begin` and `end`, or range-for to iterate each item:
  3591. [heading Example]
  3592. ``` for(auto const& token : token_list{"apple, pear, banana"})
  3593. std::cout << token << "\n";
  3594. ```
  3595. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__param_list http::param_list]
  3596. A list of parameters in an HTTP extension field value. [heading Synopsis] Defined in header [include_file boost/beast/http/rfc7230.hpp] ``` class param_list ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__param_list.const_iterator [*const_iterator]]] [ A constant iterator to the list. ] ] [ [[link beast.ref.boost__beast__http__param_list.value_type [*value_type]]] [ The type of each element in the list. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__param_list.begin [*begin]]] [ Return a const iterator to the beginning of the list. ] ] [ [[link beast.ref.boost__beast__http__param_list.cbegin [*cbegin]]] [ Return a const iterator to the beginning of the list. ] ] [ [[link beast.ref.boost__beast__http__param_list.cend [*cend]]] [ Return a const iterator to the end of the list. ] ] [ [[link beast.ref.boost__beast__http__param_list.end [*end]]] [ Return a const iterator to the end of the list. ] ] [ [[link beast.ref.boost__beast__http__param_list.param_list [*param_list]]] [ Default constructor. Construct a list. ] ] ] [heading Description]
  3597. This container allows iteration of the parameter list in an HTTP extension. The parameter list is a series of name/value pairs with each pair starting with a semicolon. The value is optional.
  3598. If a parsing error is encountered while iterating the string, the behavior of the container will be as if a string containing only characters up to but excluding the first invalid character was used to construct the list.
  3599. [heading BNF]
  3600. ``` param-list = *( OWS ";" OWS param )
  3601. param = token OWS [ "=" OWS ( token / quoted-string ) ]
  3602. ```
  3603. To use this class, construct with the string to be parsed and then use [link beast.ref.boost__beast__http__param_list.begin `http::param_list::begin`] and [link beast.ref.boost__beast__http__param_list.end `http::param_list::end`], or range-for to iterate each item:
  3604. [heading Example]
  3605. ``` for(auto const& param : param_list{";level=9;no_context_takeover;bits=15"})
  3606. {
  3607. std::cout << ";" << param.first;
  3608. if(! param.second.empty())
  3609. std::cout << "=" << param.second;
  3610. std::cout << "\n";
  3611. }
  3612. ```
  3613. [section:begin http::param_list::begin] [indexterm2 begin..http::param_list]
  3614. Return a const iterator to the beginning of the list. [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:cbegin http::param_list::cbegin] [indexterm2 cbegin..http::param_list]
  3615. Return a const iterator to the beginning of the list. [heading Synopsis] ``` const_iterator cbegin() const; ``` [heading Description] [endsect] [section:cend http::param_list::cend] [indexterm2 cend..http::param_list]
  3616. Return a const iterator to the end of the list. [heading Synopsis] ``` const_iterator cend() const; ``` [heading Description] [endsect] [section:const_iterator http::param_list::const_iterator] [indexterm2 const_iterator..http::param_list]
  3617. A constant iterator to the list. [heading Synopsis] ``` using const_iterator = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:end http::param_list::end] [indexterm2 end..http::param_list]
  3618. Return a const iterator to the end of the list. [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:param_list http::param_list::param_list] [indexterm2 param_list..http::param_list]
  3619. Default constructor. ``` ``[link beast.ref.boost__beast__http__param_list.param_list.overload1 param_list]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__param_list.param_list.overload1 more...]]`` ```
  3620. Construct a list. ``` explicit ``[link beast.ref.boost__beast__http__param_list.param_list.overload2 param_list]``( string_view s); ``[''''&raquo;''' [link beast.ref.boost__beast__http__param_list.param_list.overload2 more...]]`` ``` [section:overload1 http::param_list::param_list (1 of 2 overloads)]
  3621. Default constructor. [heading Synopsis] ``` param_list(); ``` [heading Description] [endsect] [section:overload2 http::param_list::param_list (2 of 2 overloads)]
  3622. Construct a list. [heading Synopsis] ``` param_list( string_view s); ``` [heading Description]
  3623. [heading Parameters] [table [[Name][Description]] [[`s`][
  3624. A string containing the list contents. The string must remain valid for the lifetime of the container. ]] ]
  3625. [endsect] [endsect] [section:value_type http::param_list::value_type] [indexterm2 value_type..http::param_list]
  3626. The type of each element in the list. [heading Synopsis] ``` using value_type = std::pair< string_view, string_view >; ``` [heading Description]
  3627. The first string in the pair is the name of the parameter, and the second string in the pair is its value (which may be empty). [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__parser http::parser]
  3628. An HTTP/1 parser for producing a message. [heading Synopsis] Defined in header [include_file boost/beast/http/parser.hpp] ``` template< bool isRequest, class __Body__, class __Allocator__ = std::allocator<char>> class parser : public http::basic_parser< isRequest > ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__parser.is_request [*is_request]]] [ true if this parser parses requests, false for responses. ] ] [ [[link beast.ref.boost__beast__http__parser.value_type [*value_type]]] [ The type of message returned by the parser. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__parser.body_limit [*body_limit]]] [ Set the limit on the payload body. ] ] [ [[link beast.ref.boost__beast__http__parser.chunked [*chunked]]] [ Returns true if the last value for Transfer-Encoding is "chunked". ] ] [ [[link beast.ref.boost__beast__http__parser.content_length [*content_length]]] [ Returns the optional value of Content-Length if known. ] ] [ [[link beast.ref.boost__beast__http__parser.content_length_remaining [*content_length_remaining]]] [ Returns the remaining content length if known. ] ] [ [[link beast.ref.boost__beast__http__parser.eager [*eager]]] [ Returns true if the eager parse option is set. Set the eager parse option. ] ] [ [[link beast.ref.boost__beast__http__parser.get [*get]]] [ Returns the parsed message. ] ] [ [[link beast.ref.boost__beast__http__parser.got_some [*got_some]]] [ Returns true if the parser has received at least one byte of input. ] ] [ [[link beast.ref.boost__beast__http__parser.header_limit [*header_limit]]] [ Set a limit on the total size of the header. ] ] [ [[link beast.ref.boost__beast__http__parser.is_done [*is_done]]] [ Returns true if the message is complete. ] ] [ [[link beast.ref.boost__beast__http__parser.is_header_done [*is_header_done]]] [ Returns true if a the parser has produced the full header. ] ] [ [[link beast.ref.boost__beast__http__parser.keep_alive [*keep_alive]]] [ Returns true if the message has keep-alive connection semantics. ] ] [ [[link beast.ref.boost__beast__http__parser.need_eof [*need_eof]]] [ Returns true if the message semantics require an end of file. ] ] [ [[link beast.ref.boost__beast__http__parser.on_chunk_body [*on_chunk_body]]] [ Set a callback to be invoked on chunk body data. ] ] [ [[link beast.ref.boost__beast__http__parser.on_chunk_header [*on_chunk_header]]] [ Set a callback to be invoked on each chunk header. ] ] [ [[link beast.ref.boost__beast__http__parser.operator_eq_ [*operator=]]] [ Assignment (disallowed) ] ] [ [[link beast.ref.boost__beast__http__parser.parser [*parser]]] [ Constructor (disallowed) Constructor. Construct a parser from another parser, changing the Body type. ] ] [ [[link beast.ref.boost__beast__http__parser.put [*put]]] [ Write a buffer sequence to the parser. ] ] [ [[link beast.ref.boost__beast__http__parser.put_eof [*put_eof]]] [ Inform the parser that the end of stream was reached. ] ] [ [[link beast.ref.boost__beast__http__parser.release [*release]]] [ Returns ownership of the parsed message. ] ] [ [[link beast.ref.boost__beast__http__parser.skip [*skip]]] [ Returns true if the skip parse option is set. Set the skip parse option. ] ] [ [[link beast.ref.boost__beast__http__parser.upgrade [*upgrade]]] [ Returns true if the message is an upgrade message. ] ] [ [[link beast.ref.boost__beast__http__parser.parser_dtor_ [*~parser]]] [ Destructor. ] ] ] [heading Description]
  3629. This class uses the basic HTTP/1 wire format parser to convert a series of octets into a [link beast.ref.boost__beast__http__message `http::message`] using the [link beast.ref.boost__beast__http__basic_fields `http::basic_fields`] container to represent the fields.
  3630. [heading Template Parameters] [table [[Type][Description]] [[`isRequest`][
  3631. Indicates whether a request or response will be parsed. ]] [[`Body`][
  3632. The type used to represent the body. This must meet the requirements of ['Body]. ]] [[`Allocator`][
  3633. The type of allocator used with the [link beast.ref.boost__beast__http__basic_fields `http::basic_fields`] container. ]] ]
  3634. [heading Remarks]
  3635. A new instance of the parser is required for each message.
  3636. [section:body_limit http::parser::body_limit] (Inherited from `http::basic_parser`) [indexterm2 body_limit..http::parser]
  3637. Set the limit on the payload body. [heading Synopsis] ``` void body_limit( std::uint64_t v); ``` [heading Description]
  3638. This function sets the maximum allowed size of the payload body, before any encodings except chunked have been removed. Depending on the message semantics, one of these cases will apply:
  3639. * The Content-Length is specified and exceeds the limit. In this case the result [link beast.ref.boost__beast__http__error `http::body_limit`] is returned immediately after the header is parsed.
  3640. * The Content-Length is unspecified and the chunked encoding is not specified as the last encoding. In this case the end of message is determined by the end of file indicator on the associated stream or input source. If a sufficient number of body payload octets are presented to the parser to exceed the configured limit, the parse fails with the result [link beast.ref.boost__beast__http__error `http::body_limit`]
  3641. * The Transfer-Encoding specifies the chunked encoding as the last encoding. In this case, when the number of payload body octets produced by removing the chunked encoding exceeds the configured limit, the parse fails with the result [link beast.ref.boost__beast__http__error `http::body_limit`].
  3642. Setting the limit after any body octets have been parsed results in undefined behavior.
  3643. The default limit is 1MB for requests and 8MB for responses.
  3644. [heading Parameters] [table [[Name][Description]] [[`v`][
  3645. The payload body limit to set ]] ]
  3646. [endsect] [section:chunked http::parser::chunked] (Inherited from `http::basic_parser`) [indexterm2 chunked..http::parser]
  3647. Returns `true` if the last value for Transfer-Encoding is "chunked". [heading Synopsis] ``` bool chunked() const; ``` [heading Description]
  3648. [heading Remarks]
  3649. The return value is undefined unless [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] would return `true`.
  3650. [endsect] [section:content_length http::parser::content_length] (Inherited from `http::basic_parser`) [indexterm2 content_length..http::parser]
  3651. Returns the optional value of Content-Length if known. [heading Synopsis] ``` boost::optional< std::uint64_t > content_length() const; ``` [heading Description]
  3652. [heading Remarks]
  3653. The return value is undefined unless [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] would return `true`.
  3654. [endsect] [section:content_length_remaining http::parser::content_length_remaining] (Inherited from `http::basic_parser`) [indexterm2 content_length_remaining..http::parser]
  3655. Returns the remaining content length if known. [heading Synopsis] ``` boost::optional< std::uint64_t > content_length_remaining() const; ``` [heading Description]
  3656. If the message header specifies a Content-Length, the return value will be the number of bytes remaining in the payload body have not yet been parsed.
  3657. [heading Remarks]
  3658. The return value is undefined unless [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] would return `true`.
  3659. [endsect] [section:eager http::parser::eager] [indexterm2 eager..http::parser]
  3660. Returns `true` if the eager parse option is set. ``` bool ``[link beast.ref.boost__beast__http__parser.eager.overload1 eager]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__parser.eager.overload1 more...]]`` ```
  3661. Set the eager parse option. ``` void ``[link beast.ref.boost__beast__http__parser.eager.overload2 eager]``( bool v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__parser.eager.overload2 more...]]`` ``` [section:overload1 http::parser::eager (1 of 2 overloads)] (Inherited from `http::basic_parser`)
  3662. Returns `true` if the eager parse option is set. [heading Synopsis] ``` bool eager() const; ``` [heading Description] [endsect] [section:overload2 http::parser::eager (2 of 2 overloads)] (Inherited from `http::basic_parser`)
  3663. Set the eager parse option. [heading Synopsis] ``` void eager( bool v); ``` [heading Description]
  3664. Normally the parser returns after successfully parsing a structured element (header, chunk header, or chunk body) even if there are octets remaining in the input. This is necessary when attempting to parse the header first, or when the caller wants to inspect information which may be invalidated by subsequent parsing, such as a chunk extension. The `eager` option controls whether the parser keeps going after parsing structured element if there are octets remaining in the buffer and no error occurs. This option is automatically set or cleared during certain stream operations to improve performance with no change in functionality.
  3665. The default setting is `false`.
  3666. [heading Parameters] [table [[Name][Description]] [[`v`][
  3667. `true` to set the eager parse option or `false` to disable it. ]] ]
  3668. [endsect] [endsect] [section:get http::parser::get] [indexterm2 get..http::parser]
  3669. Returns the parsed message. ``` value_type const & ``[link beast.ref.boost__beast__http__parser.get.overload1 get]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__parser.get.overload1 more...]]`` value_type& ``[link beast.ref.boost__beast__http__parser.get.overload2 get]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__parser.get.overload2 more...]]`` ``` [section:overload1 http::parser::get (1 of 2 overloads)]
  3670. Returns the parsed message. [heading Synopsis] ``` value_type const & get() const; ``` [heading Description]
  3671. Depending on the parser's progress, parts of this object may be incomplete. [endsect] [section:overload2 http::parser::get (2 of 2 overloads)]
  3672. Returns the parsed message. [heading Synopsis] ``` value_type& get(); ``` [heading Description]
  3673. Depending on the parser's progress, parts of this object may be incomplete. [endsect] [endsect] [section:got_some http::parser::got_some] (Inherited from `http::basic_parser`) [indexterm2 got_some..http::parser]
  3674. Returns `true` if the parser has received at least one byte of input. [heading Synopsis] ``` bool got_some() const; ``` [heading Description] [endsect] [section:header_limit http::parser::header_limit] (Inherited from `http::basic_parser`) [indexterm2 header_limit..http::parser]
  3675. Set a limit on the total size of the header. [heading Synopsis] ``` void header_limit( std::uint32_t v); ``` [heading Description]
  3676. This function sets the maximum allowed size of the header including all field name, value, and delimiter characters and also including the CRLF sequences in the serialized input. If the end of the header is not found within the limit of the header size, the error [link beast.ref.boost__beast__http__error `http::header_limit`] is returned by [link beast.ref.boost__beast__http__basic_parser.put `http::basic_parser::put`].
  3677. Setting the limit after any header octets have been parsed results in undefined behavior. [endsect] [section:is_done http::parser::is_done] (Inherited from `http::basic_parser`) [indexterm2 is_done..http::parser]
  3678. Returns `true` if the message is complete. [heading Synopsis] ``` bool is_done() const; ``` [heading Description]
  3679. The message is complete after the full header is prduced and one of the following is true:
  3680. * The skip body option was set.
  3681. * The semantics of the message indicate there is no body.
  3682. * The semantics of the message indicate a body is expected, and the entire body was parsed.
  3683. [endsect] [section:is_header_done http::parser::is_header_done] (Inherited from `http::basic_parser`) [indexterm2 is_header_done..http::parser]
  3684. Returns `true` if a the parser has produced the full header. [heading Synopsis] ``` bool is_header_done() const; ``` [heading Description] [endsect] [section:is_request http::parser::is_request] (Inherited from `http::basic_parser`) [indexterm2 is_request..http::parser]
  3685. `true` if this parser parses requests, `false` for responses. [heading Synopsis] ``` using is_request = std::integral_constant< bool, isRequest >; ``` [heading Description] [endsect] [section:keep_alive http::parser::keep_alive] (Inherited from `http::basic_parser`) [indexterm2 keep_alive..http::parser]
  3686. Returns `true` if the message has keep-alive connection semantics. [heading Synopsis] ``` bool keep_alive() const; ``` [heading Description]
  3687. This function always returns `false` if [link beast.ref.boost__beast__http__basic_parser.need_eof `http::basic_parser::need_eof`] would return `false`.
  3688. [heading Remarks]
  3689. The return value is undefined unless [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] would return `true`.
  3690. [endsect] [section:need_eof http::parser::need_eof] (Inherited from `http::basic_parser`) [indexterm2 need_eof..http::parser]
  3691. Returns `true` if the message semantics require an end of file. [heading Synopsis] ``` bool need_eof() const; ``` [heading Description]
  3692. Depending on the contents of the header, the parser may require and end of file notification to know where the end of the body lies. If this function returns `true` it will be necessary to call [link beast.ref.boost__beast__http__basic_parser.put_eof `http::basic_parser::put_eof`] when there will never be additional data from the input. [endsect] [section:on_chunk_body http::parser::on_chunk_body] [indexterm2 on_chunk_body..http::parser]
  3693. Set a callback to be invoked on chunk body data. [heading Synopsis] ``` template< class Callback> void on_chunk_body( Callback& cb); ``` [heading Description]
  3694. The provided function object will be invoked one or more times to provide buffers corresponding to the chunk body for the current chunk. The callback receives the number of octets remaining in this chunk body including the octets in the buffer provided.
  3695. The callback must return the number of octets actually consumed. Any octets not consumed will be presented again in a subsequent invocation of the callback. The implementation type-erases the callback without requiring a dynamic allocation. For this reason, the callback object is passed by a non-constant reference.
  3696. [heading Example]
  3697. ``` auto callback =
  3698. [](std::uint64_t remain, string_view body, error_code& ec)
  3699. {
  3700. //...
  3701. };
  3702. parser.on_chunk_body(callback);
  3703. ```
  3704. [heading Parameters] [table [[Name][Description]] [[`cb`][
  3705. The function to set, which must be invocable with this equivalent signature: ``` std::size_t
  3706. on_chunk_header(
  3707. std::uint64_t remain, // Octets remaining in this chunk, includes `body`
  3708. string_view body, // A buffer holding some or all of the remainder of the chunk body
  3709. error_code& ec); // May be set by the callback to indicate an error
  3710. ``` ]] ]
  3711. [endsect] [section:on_chunk_header http::parser::on_chunk_header] [indexterm2 on_chunk_header..http::parser]
  3712. Set a callback to be invoked on each chunk header. [heading Synopsis] ``` template< class Callback> void on_chunk_header( Callback& cb); ``` [heading Description]
  3713. The callback will be invoked once for every chunk in the message payload, as well as once for the last chunk. The invocation happens after the chunk header is available but before any body octets have been parsed.
  3714. The extensions are provided in raw, validated form, use [link beast.ref.boost__beast__http__basic_chunk_extensions.parse `http::basic_chunk_extensions::parse`] to parse the extensions into a structured container for easier access. The implementation type-erases the callback without requiring a dynamic allocation. For this reason, the callback object is passed by a non-constant reference.
  3715. [heading Example]
  3716. ``` auto callback =
  3717. [](std::uint64_t size, string_view extensions, error_code& ec)
  3718. {
  3719. //...
  3720. };
  3721. parser.on_chunk_header(callback);
  3722. ```
  3723. [heading Parameters] [table [[Name][Description]] [[`cb`][
  3724. The function to set, which must be invocable with this equivalent signature: ``` void
  3725. on_chunk_header(
  3726. std::uint64_t size, // Size of the chunk, zero for the last chunk
  3727. string_view extensions, // The chunk-extensions in raw form
  3728. error_code& ec); // May be set by the callback to indicate an error
  3729. ``` ]] ]
  3730. [endsect] [section:operator_eq_ http::parser::operator=] [indexterm2 operator=..http::parser]
  3731. Assignment (disallowed) [heading Synopsis] ``` parser& operator=( parser const&); ``` [heading Description] [endsect] [section:parser http::parser::parser] [indexterm2 parser..http::parser]
  3732. Constructor (disallowed) ``` ``[link beast.ref.boost__beast__http__parser.parser.overload1 parser]``( parser const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__parser.parser.overload1 more...]]`` ``[link beast.ref.boost__beast__http__parser.parser.overload2 parser]``( parser&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__http__parser.parser.overload2 more...]]`` ```
  3733. Constructor. ``` ``[link beast.ref.boost__beast__http__parser.parser.overload3 parser]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__parser.parser.overload3 more...]]`` template< class... Args> explicit ``[link beast.ref.boost__beast__http__parser.parser.overload4 parser]``( Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__http__parser.parser.overload4 more...]]`` ```
  3734. Construct a parser from another parser, changing the Body type. ``` template< class OtherBody, class... Args> explicit ``[link beast.ref.boost__beast__http__parser.parser.overload5 parser]``( parser< isRequest, OtherBody, Allocator >&& parser, Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__http__parser.parser.overload5 more...]]`` ``` [section:overload1 http::parser::parser (1 of 5 overloads)]
  3735. Constructor (disallowed) [heading Synopsis] ``` parser( parser const&); ``` [heading Description] [endsect] [section:overload2 http::parser::parser (2 of 5 overloads)]
  3736. Constructor (disallowed) [heading Synopsis] ``` parser( parser&& other); ``` [heading Description] [endsect] [section:overload3 http::parser::parser (3 of 5 overloads)]
  3737. Constructor. [heading Synopsis] ``` parser(); ``` [heading Description] [endsect] [section:overload4 http::parser::parser (4 of 5 overloads)]
  3738. Constructor. [heading Synopsis] ``` template< class... Args> parser( Args&&... args); ``` [heading Description]
  3739. [heading Parameters] [table [[Name][Description]] [[`args`][
  3740. Optional arguments forwarded to the [link beast.ref.boost__beast__http__message `http::message`] constructor. ]] ]
  3741. [heading Remarks]
  3742. This function participates in overload resolution only if the first argument is not a [link beast.ref.boost__beast__http__parser `http::parser`].
  3743. [endsect] [section:overload5 http::parser::parser (5 of 5 overloads)]
  3744. Construct a parser from another parser, changing the Body type. [heading Synopsis] ``` template< class OtherBody, class... Args> parser( parser< isRequest, OtherBody, Allocator >&& parser, Args&&... args); ``` [heading Description]
  3745. This constructs a new parser by move constructing the header from another parser with a different body type. The constructed-from parser must not have any parsed body octets or initialized ['BodyReader], otherwise an exception is generated.
  3746. [heading Example]
  3747. ``` // Deferred body type commitment
  3748. request_parser<empty_body> req0;
  3749. ...
  3750. request_parser<string_body> req{std::move(req0)};
  3751. ```
  3752. If an exception is thrown, the state of the constructed-from parser is undefined.
  3753. [heading Parameters] [table [[Name][Description]] [[`parser`][
  3754. The other parser to construct from. After this call returns, the constructed-from parser may only be destroyed. ]] [[`args`][
  3755. Optional arguments forwarded to the message constructor. ]] ]
  3756. [heading Exceptions] [table [[Type][Thrown On]] [[`std::invalid_argument`][
  3757. Thrown when the constructed-from parser has already initialized a body reader. ]] ]
  3758. [heading Remarks]
  3759. This function participates in overload resolution only if the other parser uses a different body type.
  3760. [endsect] [endsect] [section:put http::parser::put] (Inherited from `http::basic_parser`) [indexterm2 put..http::parser]
  3761. Write a buffer sequence to the parser. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t put( ConstBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  3762. This function attempts to incrementally parse the HTTP message data stored in the caller provided buffers. Upon success, a positive return value indicates that the parser made forward progress, consuming that number of bytes.
  3763. In some cases there may be an insufficient number of octets in the input buffer in order to make forward progress. This is indicated by the code [link beast.ref.boost__beast__http__error `http::need_more`]. When this happens, the caller should place additional bytes into the buffer sequence and call [link beast.ref.boost__beast__http__basic_parser.put `http::basic_parser::put`] again.
  3764. The error code [link beast.ref.boost__beast__http__error `http::need_more`] is special. When this error is returned, a subsequent call to [link beast.ref.boost__beast__http__basic_parser.put `http::basic_parser::put`] may succeed if the buffers have been updated. Otherwise, upon error the parser may not be restarted.
  3765. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  3766. An object meeting the requirements of ['ConstBufferSequence] that represents the next chunk of message data. If the length of this buffer sequence is one, the implementation will not allocate additional memory. The class [link beast.ref.boost__beast__basic_flat_buffer `basic_flat_buffer`] is provided as one way to meet this requirement ]] [[`ec`][
  3767. Set to the error, if any occurred. ]] ]
  3768. [heading Return Value]
  3769. The number of octets consumed in the buffer sequence. The caller should remove these octets even if the error is set.
  3770. [endsect] [section:put_eof http::parser::put_eof] (Inherited from `http::basic_parser`) [indexterm2 put_eof..http::parser]
  3771. Inform the parser that the end of stream was reached. [heading Synopsis] ``` void put_eof( error_code& ec); ``` [heading Description]
  3772. In certain cases, HTTP needs to know where the end of the stream is. For example, sometimes servers send responses without Content-Length and expect the client to consume input (for the body) until EOF. Callbacks and errors will still be processed as usual.
  3773. This is typically called when a read from the underlying stream object sets the error code to `net::error::eof`.
  3774. [heading Remarks]
  3775. Only valid after parsing a complete header.
  3776. [heading Parameters] [table [[Name][Description]] [[`ec`][
  3777. Set to the error, if any occurred. ]] ]
  3778. [endsect] [section:release http::parser::release] [indexterm2 release..http::parser]
  3779. Returns ownership of the parsed message. [heading Synopsis] ``` value_type release(); ``` [heading Description]
  3780. Ownership is transferred to the caller. Depending on the parser's progress, parts of this object may be incomplete.
  3781. [heading Requires]
  3782. [link beast.ref.boost__beast__http__parser.value_type `http::parser::value_type`] is [*MoveConstructible] [endsect] [section:skip http::parser::skip] [indexterm2 skip..http::parser]
  3783. Returns `true` if the skip parse option is set. ``` bool ``[link beast.ref.boost__beast__http__parser.skip.overload1 skip]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__http__parser.skip.overload1 more...]]`` ```
  3784. Set the skip parse option. ``` void ``[link beast.ref.boost__beast__http__parser.skip.overload2 skip]``( bool v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__parser.skip.overload2 more...]]`` ``` [section:overload1 http::parser::skip (1 of 2 overloads)] (Inherited from `http::basic_parser`)
  3785. Returns `true` if the skip parse option is set. [heading Synopsis] ``` bool skip() const; ``` [heading Description] [endsect] [section:overload2 http::parser::skip (2 of 2 overloads)] (Inherited from `http::basic_parser`)
  3786. Set the skip parse option. [heading Synopsis] ``` void skip( bool v); ``` [heading Description]
  3787. This option controls whether or not the parser expects to see an HTTP body, regardless of the presence or absence of certain fields such as Content-Length or a chunked Transfer-Encoding. Depending on the request, some responses do not carry a body. For example, a 200 response to a CONNECT request from a tunneling proxy, or a response to a HEAD request. In these cases, callers may use this function inform the parser that no body is expected. The parser will consider the message complete after the header has been received.
  3788. [heading Parameters] [table [[Name][Description]] [[`v`][
  3789. `true` to set the skip body option or `false` to disable it. ]] ]
  3790. [heading Remarks]
  3791. This function must called before any bytes are processed.
  3792. [endsect] [endsect] [section:upgrade http::parser::upgrade] (Inherited from `http::basic_parser`) [indexterm2 upgrade..http::parser]
  3793. Returns `true` if the message is an upgrade message. [heading Synopsis] ``` bool upgrade() const; ``` [heading Description]
  3794. [heading Remarks]
  3795. The return value is undefined unless [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] would return `true`.
  3796. [endsect] [section:value_type http::parser::value_type] [indexterm2 value_type..http::parser]
  3797. The type of message returned by the parser. [heading Synopsis] ``` using value_type = message< isRequest, Body, basic_fields< Allocator > >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__message.body_type [*body_type]]] [ The type providing the body traits. ] ] [ [[link beast.ref.boost__beast__http__message.fields_type [*fields_type]]] [ The type representing the fields. ] ] [ [[link beast.ref.boost__beast__http__message.header_type [*header_type]]] [ The base class used to hold the header portion of the message. ] ] [ [[link beast.ref.boost__beast__http__message.is_request [*is_request]]] [ Indicates if the header is a request or response. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__message.base [*base]]] [ Returns the header portion of the message. ] ] [ [[link beast.ref.boost__beast__http__message.body [*body]]] [ Returns the body. ] ] [ [[link beast.ref.boost__beast__http__message.chunked [*chunked]]] [ Returns true if the chunked Transfer-Encoding is specified. Set or clear the chunked Transfer-Encoding. ] ] [ [[link beast.ref.boost__beast__http__message.content_length [*content_length]]] [ Set or clear the Content-Length field. ] ] [ [[link beast.ref.boost__beast__http__message.has_content_length [*has_content_length]]] [ Returns true if the Content-Length field is present. ] ] [ [[link beast.ref.boost__beast__http__message.keep_alive [*keep_alive]]] [ Returns true if the message semantics indicate keep-alive. Set the keep-alive message semantic option. ] ] [ [[link beast.ref.boost__beast__http__message.message [*message]]] [ Constructor. Construct a message. ] ] [ [[link beast.ref.boost__beast__http__message.method [*method]]] [ Return the request-method verb. Set the request-method. ] ] [ [[link beast.ref.boost__beast__http__message.method_string [*method_string]]] [ Return the request-method as a string. ] ] [ [[link beast.ref.boost__beast__http__message.need_eof [*need_eof]]] [ Returns true if the message semantics require an end of file. ] ] [ [[link beast.ref.boost__beast__http__message.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__http__message.payload_size [*payload_size]]] [ Returns the payload size of the body in octets if possible. ] ] [ [[link beast.ref.boost__beast__http__message.prepare_payload [*prepare_payload]]] [ Prepare the message payload fields for the body. ] ] [ [[link beast.ref.boost__beast__http__message.reason [*reason]]] [ Return the response reason-phrase. Set the response reason-phrase (deprecated) ] ] [ [[link beast.ref.boost__beast__http__message.result [*result]]] [ The response status-code result. Set the response status-code. Set the response status-code as an integer. ] ] [ [[link beast.ref.boost__beast__http__message.result_int [*result_int]]] [ The response status-code expressed as an integer. ] ] [ [[link beast.ref.boost__beast__http__message.target [*target]]] [ Returns the request-target string. Set the request-target string. ] ] [ [[link beast.ref.boost__beast__http__message.version [*version]]] [ Return the HTTP-version. Set the HTTP-version. ] ] ]
  3798. This container is derived from the `Fields` template type. To understand all of the members of this class it is necessary to view the declaration for the `Fields` type. When using the default fields container, those declarations are in [link beast.ref.boost__beast__http__fields `http::fields`].
  3799. A message can be a request or response, depending on the `isRequest` template argument value. Requests and responses have different types; functions may be overloaded based on the type if desired.
  3800. The `Body` template argument type determines the model used to read or write the content body of the message.
  3801. Newly constructed messages objects have version set to HTTP/1.1. Newly constructed response objects also have result code set to [link beast.ref.boost__beast__http__status `http::ok`].
  3802. [heading Template Parameters] [table [[Type][Description]] [[`isRequest`][
  3803. `true` if this represents a request, or `false` if this represents a response. Some class data members are conditionally present depending on this value. ]] [[`Body`][
  3804. A type meeting the requirements of Body. ]] [[`Fields`][
  3805. The type of container used to hold the field value pairs. ]] ]
  3806. [heading Description] [endsect] [section:parser_dtor_ http::parser::~parser] [indexterm2 ~parser..http::parser]
  3807. Destructor. [heading Synopsis] ``` ~parser(); ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__read http::read] [indexterm1 http::read]
  3808. Read a complete message from a stream using a parser. ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t ``[link beast.ref.boost__beast__http__read.overload1 read]``( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser); ``[''''&raquo;''' [link beast.ref.boost__beast__http__read.overload1 more...]]`` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t ``[link beast.ref.boost__beast__http__read.overload2 read]``( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__http__read.overload2 more...]]`` ```
  3809. Read a complete message from a stream. ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest, class __Body__, class __Allocator__> std::size_t ``[link beast.ref.boost__beast__http__read.overload3 read]``( SyncReadStream& stream, DynamicBuffer& buffer, message< isRequest, Body, basic_fields< Allocator >>& msg); ``[''''&raquo;''' [link beast.ref.boost__beast__http__read.overload3 more...]]`` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest, class __Body__, class __Allocator__> std::size_t ``[link beast.ref.boost__beast__http__read.overload4 read]``( SyncReadStream& stream, DynamicBuffer& buffer, message< isRequest, Body, basic_fields< Allocator >>& msg, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__http__read.overload4 more...]]`` ``` [section:overload1 http::read (1 of 4 overloads)]
  3810. Read a complete message from a stream using a parser. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t read( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser); ``` [heading Description]
  3811. This function is used to read a complete message from a stream into an instance of [link beast.ref.boost__beast__http__basic_parser `http::basic_parser`]. The call will block until one of the following conditions is true:
  3812. * [link beast.ref.boost__beast__http__basic_parser.is_done `http::basic_parser::is_done`] returns `true`
  3813. * An error occurs.
  3814. This operation is implemented in terms of one or more calls to the stream's `read_some` function. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  3815. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  3816. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  3817. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  3818. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  3819. [heading Parameters] [table [[Name][Description]] [[`stream`][
  3820. The stream from which the data is to be read. The type must meet the ['SyncReadStream] requirements. ]] [[`buffer`][
  3821. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. ]] [[`parser`][
  3822. The parser to use. ]] ]
  3823. [heading Return Value]
  3824. The number of bytes transferred from the stream.
  3825. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  3826. Thrown on failure. ]] ]
  3827. [heading Remarks]
  3828. The function returns the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer. The implementation will call [link beast.ref.boost__beast__http__basic_parser.eager `http::basic_parser::eager`] with the value `true` on the parser passed in.
  3829. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::read (2 of 4 overloads)]
  3830. Read a complete message from a stream using a parser. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t read( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser, error_code& ec); ``` [heading Description]
  3831. This function is used to read a complete message from a stream into an instance of [link beast.ref.boost__beast__http__basic_parser `http::basic_parser`]. The call will block until one of the following conditions is true:
  3832. * [link beast.ref.boost__beast__http__basic_parser.is_done `http::basic_parser::is_done`] returns `true`
  3833. * An error occurs.
  3834. This operation is implemented in terms of one or more calls to the stream's `read_some` function. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  3835. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  3836. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  3837. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  3838. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  3839. [heading Parameters] [table [[Name][Description]] [[`stream`][
  3840. The stream from which the data is to be read. The type must meet the ['SyncReadStream] requirements. ]] [[`buffer`][
  3841. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. ]] [[`parser`][
  3842. The parser to use. ]] [[`ec`][
  3843. Set to the error, if any occurred. ]] ]
  3844. [heading Return Value]
  3845. The number of bytes transferred from the stream.
  3846. [heading Remarks]
  3847. The function returns the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer. The implementation will call [link beast.ref.boost__beast__http__basic_parser.eager `http::basic_parser::eager`] with the value `true` on the parser passed in.
  3848. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload3 http::read (3 of 4 overloads)]
  3849. Read a complete message from a stream. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest, class __Body__, class __Allocator__> std::size_t read( SyncReadStream& stream, DynamicBuffer& buffer, message< isRequest, Body, basic_fields< Allocator >>& msg); ``` [heading Description]
  3850. This function is used to read a complete message from a stream into an instance of [link beast.ref.boost__beast__http__message `http::message`]. The call will block until one of the following conditions is true:
  3851. * The entire message is read in.
  3852. * An error occurs.
  3853. This operation is implemented in terms of one or more calls to the stream's `read_some` function. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  3854. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  3855. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  3856. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  3857. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  3858. [heading Parameters] [table [[Name][Description]] [[`stream`][
  3859. The stream from which the data is to be read. The type must meet the ['SyncReadStream] requirements. ]] [[`buffer`][
  3860. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. ]] [[`msg`][
  3861. The container in which to store the message contents. This message container should not have previous contents, otherwise the behavior is undefined. The type must be meet the ['MoveAssignable] and ['MoveConstructible] requirements. ]] ]
  3862. [heading Return Value]
  3863. The number of bytes transferred from the stream.
  3864. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  3865. Thrown on failure. ]] ]
  3866. [heading Remarks]
  3867. The function returns the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer. The implementation will call [link beast.ref.boost__beast__http__basic_parser.eager `http::basic_parser::eager`] with the value `true` on the parser passed in.
  3868. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload4 http::read (4 of 4 overloads)]
  3869. Read a complete message from a stream. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest, class __Body__, class __Allocator__> std::size_t read( SyncReadStream& stream, DynamicBuffer& buffer, message< isRequest, Body, basic_fields< Allocator >>& msg, error_code& ec); ``` [heading Description]
  3870. This function is used to read a complete message from a stream into an instance of [link beast.ref.boost__beast__http__message `http::message`]. The call will block until one of the following conditions is true:
  3871. * The entire message is read in.
  3872. * An error occurs.
  3873. This operation is implemented in terms of one or more calls to the stream's `read_some` function. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  3874. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  3875. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  3876. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  3877. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  3878. [heading Parameters] [table [[Name][Description]] [[`stream`][
  3879. The stream from which the data is to be read. The type must meet the ['SyncReadStream] requirements. ]] [[`buffer`][
  3880. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. ]] [[`msg`][
  3881. The container in which to store the message contents. This message container should not have previous contents, otherwise the behavior is undefined. The type must be meet the ['MoveAssignable] and ['MoveConstructible] requirements. ]] [[`ec`][
  3882. Set to the error, if any occurred. ]] ]
  3883. [heading Return Value]
  3884. The number of bytes transferred from the stream.
  3885. [heading Remarks]
  3886. The function returns the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer. The implementation will call [link beast.ref.boost__beast__http__basic_parser.eager `http::basic_parser::eager`] with the value `true` on the parser passed in.
  3887. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__read_header http::read_header] [indexterm1 http::read_header]
  3888. Read a complete message header from a stream using a parser. ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t ``[link beast.ref.boost__beast__http__read_header.overload1 read_header]``( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser); ``[''''&raquo;''' [link beast.ref.boost__beast__http__read_header.overload1 more...]]`` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t ``[link beast.ref.boost__beast__http__read_header.overload2 read_header]``( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__http__read_header.overload2 more...]]`` ``` [section:overload1 http::read_header (1 of 2 overloads)]
  3889. Read a complete message header from a stream using a parser. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t read_header( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser); ``` [heading Description]
  3890. This function is used to read a complete message header from a stream into an instance of [link beast.ref.boost__beast__http__basic_parser `http::basic_parser`]. The call will block until one of the following conditions is true:
  3891. * [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] returns `true`
  3892. * An error occurs.
  3893. This operation is implemented in terms of one or more calls to the stream's `read_some` function. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  3894. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  3895. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  3896. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  3897. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  3898. [heading Parameters] [table [[Name][Description]] [[`stream`][
  3899. The stream from which the data is to be read. The type must meet the ['SyncReadStream] requirements. ]] [[`buffer`][
  3900. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. ]] [[`parser`][
  3901. The parser to use. ]] ]
  3902. [heading Return Value]
  3903. The number of bytes transferred from the stream.
  3904. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  3905. Thrown on failure. ]] ]
  3906. [heading Remarks]
  3907. The function returns the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer. The implementation will call [link beast.ref.boost__beast__http__basic_parser.eager `http::basic_parser::eager`] with the value `false` on the parser passed in.
  3908. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::read_header (2 of 2 overloads)]
  3909. Read a complete message header from a stream using a parser. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t read_header( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser, error_code& ec); ``` [heading Description]
  3910. This function is used to read a complete message header from a stream into an instance of [link beast.ref.boost__beast__http__basic_parser `http::basic_parser`]. The call will block until one of the following conditions is true:
  3911. * [link beast.ref.boost__beast__http__basic_parser.is_header_done `http::basic_parser::is_header_done`] returns `true`
  3912. * An error occurs.
  3913. This operation is implemented in terms of one or more calls to the stream's `read_some` function. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  3914. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  3915. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  3916. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  3917. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  3918. [heading Parameters] [table [[Name][Description]] [[`stream`][
  3919. The stream from which the data is to be read. The type must meet the ['SyncReadStream] requirements. ]] [[`buffer`][
  3920. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. ]] [[`parser`][
  3921. The parser to use. ]] [[`ec`][
  3922. Set to the error, if any occurred. ]] ]
  3923. [heading Return Value]
  3924. The number of bytes transferred from the stream.
  3925. [heading Remarks]
  3926. The function returns the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer. The implementation will call [link beast.ref.boost__beast__http__basic_parser.eager `http::basic_parser::eager`] with the value `false` on the parser passed in.
  3927. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__read_some http::read_some] [indexterm1 http::read_some]
  3928. Read part of a message from a stream using a parser. ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t ``[link beast.ref.boost__beast__http__read_some.overload1 read_some]``( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser); ``[''''&raquo;''' [link beast.ref.boost__beast__http__read_some.overload1 more...]]`` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t ``[link beast.ref.boost__beast__http__read_some.overload2 read_some]``( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__http__read_some.overload2 more...]]`` ``` [section:overload1 http::read_some (1 of 2 overloads)]
  3929. Read part of a message from a stream using a parser. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t read_some( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser); ``` [heading Description]
  3930. This function is used to read part of a message from a stream into an instance of [link beast.ref.boost__beast__http__basic_parser `http::basic_parser`]. The call will block until one of the following conditions is true:
  3931. * A call to [link beast.ref.boost__beast__http__basic_parser.put `http::basic_parser::put`] with a non-empty buffer sequence is successful.
  3932. * An error occurs.
  3933. This operation is implemented in terms of one or more calls to the stream's `read_some` function. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  3934. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  3935. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  3936. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  3937. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  3938. [heading Parameters] [table [[Name][Description]] [[`stream`][
  3939. The stream from which the data is to be read. The type must meet the ['SyncReadStream] requirements. ]] [[`buffer`][
  3940. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. ]] [[`parser`][
  3941. The parser to use. ]] ]
  3942. [heading Return Value]
  3943. The number of bytes transferred from the stream.
  3944. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  3945. Thrown on failure. ]] ]
  3946. [heading Remarks]
  3947. The function returns the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer.
  3948. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::read_some (2 of 2 overloads)]
  3949. Read part of a message from a stream using a parser. [heading Synopsis] Defined in header [include_file boost/beast/http/read.hpp] ``` template< class __SyncReadStream__, class __DynamicBuffer__, bool isRequest> std::size_t read_some( SyncReadStream& stream, DynamicBuffer& buffer, basic_parser< isRequest >& parser, error_code& ec); ``` [heading Description]
  3950. This function is used to read part of a message from a stream into an instance of [link beast.ref.boost__beast__http__basic_parser `http::basic_parser`]. The call will block until one of the following conditions is true:
  3951. * A call to [link beast.ref.boost__beast__http__basic_parser.put `http::basic_parser::put`] with a non-empty buffer sequence is successful.
  3952. * An error occurs.
  3953. This operation is implemented in terms of one or more calls to the stream's `read_some` function. The implementation may read additional bytes from the stream that lie past the end of the message being read. These additional bytes are stored in the dynamic buffer, which must be preserved for subsequent reads.
  3954. If the end of file error is received while reading from the stream, then the error returned from this function will be:
  3955. * [link beast.ref.boost__beast__http__error `http::end_of_stream`] if no bytes were parsed, or
  3956. * [link beast.ref.boost__beast__http__error `http::partial_message`] if any bytes were parsed but the message was incomplete, otherwise:
  3957. * A successful result. The next attempt to read will return [link beast.ref.boost__beast__http__error `http::end_of_stream`]
  3958. [heading Parameters] [table [[Name][Description]] [[`stream`][
  3959. The stream from which the data is to be read. The type must support the ['SyncReadStream] requirements. ]] [[`buffer`][
  3960. Storage for additional bytes read by the implementation from the stream. This is both an input and an output parameter; on entry, the parser will be presented with any remaining data in the dynamic buffer's readable bytes sequence first. The type must meet the ['DynamicBuffer] requirements. ]] [[`parser`][
  3961. The parser to use. ]] [[`ec`][
  3962. Set to the error, if any occurred. ]] ]
  3963. [heading Return Value]
  3964. The number of bytes transferred from the stream.
  3965. [heading Remarks]
  3966. The function returns the total number of bytes transferred from the stream. This may be zero for the case where there is sufficient pre-existing message data in the dynamic buffer.
  3967. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__request http::request] [indexterm1 http::request]
  3968. A typical HTTP request. [heading Synopsis] Defined in header [include_file boost/beast/http/message.hpp] ``` template< class __Body__, class __Fields__ = fields> using request = message< true, Body, Fields >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__message.body_type [*body_type]]] [ The type providing the body traits. ] ] [ [[link beast.ref.boost__beast__http__message.fields_type [*fields_type]]] [ The type representing the fields. ] ] [ [[link beast.ref.boost__beast__http__message.header_type [*header_type]]] [ The base class used to hold the header portion of the message. ] ] [ [[link beast.ref.boost__beast__http__message.is_request [*is_request]]] [ Indicates if the header is a request or response. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__message.base [*base]]] [ Returns the header portion of the message. ] ] [ [[link beast.ref.boost__beast__http__message.body [*body]]] [ Returns the body. ] ] [ [[link beast.ref.boost__beast__http__message.chunked [*chunked]]] [ Returns true if the chunked Transfer-Encoding is specified. Set or clear the chunked Transfer-Encoding. ] ] [ [[link beast.ref.boost__beast__http__message.content_length [*content_length]]] [ Set or clear the Content-Length field. ] ] [ [[link beast.ref.boost__beast__http__message.has_content_length [*has_content_length]]] [ Returns true if the Content-Length field is present. ] ] [ [[link beast.ref.boost__beast__http__message.keep_alive [*keep_alive]]] [ Returns true if the message semantics indicate keep-alive. Set the keep-alive message semantic option. ] ] [ [[link beast.ref.boost__beast__http__message.message [*message]]] [ Constructor. Construct a message. ] ] [ [[link beast.ref.boost__beast__http__message.method [*method]]] [ Return the request-method verb. Set the request-method. ] ] [ [[link beast.ref.boost__beast__http__message.method_string [*method_string]]] [ Return the request-method as a string. ] ] [ [[link beast.ref.boost__beast__http__message.need_eof [*need_eof]]] [ Returns true if the message semantics require an end of file. ] ] [ [[link beast.ref.boost__beast__http__message.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__http__message.payload_size [*payload_size]]] [ Returns the payload size of the body in octets if possible. ] ] [ [[link beast.ref.boost__beast__http__message.prepare_payload [*prepare_payload]]] [ Prepare the message payload fields for the body. ] ] [ [[link beast.ref.boost__beast__http__message.reason [*reason]]] [ Return the response reason-phrase. Set the response reason-phrase (deprecated) ] ] [ [[link beast.ref.boost__beast__http__message.result [*result]]] [ The response status-code result. Set the response status-code. Set the response status-code as an integer. ] ] [ [[link beast.ref.boost__beast__http__message.result_int [*result_int]]] [ The response status-code expressed as an integer. ] ] [ [[link beast.ref.boost__beast__http__message.target [*target]]] [ Returns the request-target string. Set the request-target string. ] ] [ [[link beast.ref.boost__beast__http__message.version [*version]]] [ Return the HTTP-version. Set the HTTP-version. ] ] ]
  3969. This container is derived from the `Fields` template type. To understand all of the members of this class it is necessary to view the declaration for the `Fields` type. When using the default fields container, those declarations are in [link beast.ref.boost__beast__http__fields `http::fields`].
  3970. A message can be a request or response, depending on the `isRequest` template argument value. Requests and responses have different types; functions may be overloaded based on the type if desired.
  3971. The `Body` template argument type determines the model used to read or write the content body of the message.
  3972. Newly constructed messages objects have version set to HTTP/1.1. Newly constructed response objects also have result code set to [link beast.ref.boost__beast__http__status `http::ok`].
  3973. [heading Template Parameters] [table [[Type][Description]] [[`isRequest`][
  3974. `true` if this represents a request, or `false` if this represents a response. Some class data members are conditionally present depending on this value. ]] [[`Body`][
  3975. A type meeting the requirements of Body. ]] [[`Fields`][
  3976. The type of container used to hold the field value pairs. ]] ]
  3977. [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__request_header http::request_header] [indexterm1 http::request_header]
  3978. A typical HTTP request header. [heading Synopsis] Defined in header [include_file boost/beast/http/message.hpp] ``` template< class __Fields__ = fields> using request_header = header< true, Fields >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__header.fields_type [*fields_type]]] [ The type representing the fields. ] ] [ [[link beast.ref.boost__beast__http__header.is_request [*is_request]]] [ Indicates if the header is a request or response. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__header.header [*header]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__header.method [*method]]] [ Return the request-method verb. Set the request-method. ] ] [ [[link beast.ref.boost__beast__http__header.method_string [*method_string]]] [ Return the request-method as a string. ] ] [ [[link beast.ref.boost__beast__http__header.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__http__header.reason [*reason]]] [ Return the response reason-phrase. Set the response reason-phrase (deprecated) ] ] [ [[link beast.ref.boost__beast__http__header.result [*result]]] [ The response status-code result. Set the response status-code. Set the response status-code as an integer. ] ] [ [[link beast.ref.boost__beast__http__header.result_int [*result_int]]] [ The response status-code expressed as an integer. ] ] [ [[link beast.ref.boost__beast__http__header.target [*target]]] [ Returns the request-target string. Set the request-target string. ] ] [ [[link beast.ref.boost__beast__http__header.version [*version]]] [ Return the HTTP-version. Set the HTTP-version. ] ] ]
  3979. This container is derived from the `Fields` template type. To understand all of the members of this class it is necessary to view the declaration for the `Fields` type. When using the default fields container, those declarations are in [link beast.ref.boost__beast__http__fields `http::fields`].
  3980. Newly constructed header objects have version set to HTTP/1.1. Newly constructed response objects also have result code set to [link beast.ref.boost__beast__http__status `http::ok`].
  3981. A `header` includes the start-line and header-fields. [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__request_parser http::request_parser] [indexterm1 http::request_parser]
  3982. An HTTP/1 parser for producing a request message. [heading Synopsis] Defined in header [include_file boost/beast/http/parser.hpp] ``` template< class __Body__, class __Allocator__ = std::allocator<char>> using request_parser = parser< true, Body, Allocator >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__parser.is_request [*is_request]]] [ true if this parser parses requests, false for responses. ] ] [ [[link beast.ref.boost__beast__http__parser.value_type [*value_type]]] [ The type of message returned by the parser. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__parser.body_limit [*body_limit]]] [ Set the limit on the payload body. ] ] [ [[link beast.ref.boost__beast__http__parser.chunked [*chunked]]] [ Returns true if the last value for Transfer-Encoding is "chunked". ] ] [ [[link beast.ref.boost__beast__http__parser.content_length [*content_length]]] [ Returns the optional value of Content-Length if known. ] ] [ [[link beast.ref.boost__beast__http__parser.content_length_remaining [*content_length_remaining]]] [ Returns the remaining content length if known. ] ] [ [[link beast.ref.boost__beast__http__parser.eager [*eager]]] [ Returns true if the eager parse option is set. Set the eager parse option. ] ] [ [[link beast.ref.boost__beast__http__parser.get [*get]]] [ Returns the parsed message. ] ] [ [[link beast.ref.boost__beast__http__parser.got_some [*got_some]]] [ Returns true if the parser has received at least one byte of input. ] ] [ [[link beast.ref.boost__beast__http__parser.header_limit [*header_limit]]] [ Set a limit on the total size of the header. ] ] [ [[link beast.ref.boost__beast__http__parser.is_done [*is_done]]] [ Returns true if the message is complete. ] ] [ [[link beast.ref.boost__beast__http__parser.is_header_done [*is_header_done]]] [ Returns true if a the parser has produced the full header. ] ] [ [[link beast.ref.boost__beast__http__parser.keep_alive [*keep_alive]]] [ Returns true if the message has keep-alive connection semantics. ] ] [ [[link beast.ref.boost__beast__http__parser.need_eof [*need_eof]]] [ Returns true if the message semantics require an end of file. ] ] [ [[link beast.ref.boost__beast__http__parser.on_chunk_body [*on_chunk_body]]] [ Set a callback to be invoked on chunk body data. ] ] [ [[link beast.ref.boost__beast__http__parser.on_chunk_header [*on_chunk_header]]] [ Set a callback to be invoked on each chunk header. ] ] [ [[link beast.ref.boost__beast__http__parser.operator_eq_ [*operator=]]] [ Assignment (disallowed) ] ] [ [[link beast.ref.boost__beast__http__parser.parser [*parser]]] [ Constructor (disallowed) Constructor. Construct a parser from another parser, changing the Body type. ] ] [ [[link beast.ref.boost__beast__http__parser.put [*put]]] [ Write a buffer sequence to the parser. ] ] [ [[link beast.ref.boost__beast__http__parser.put_eof [*put_eof]]] [ Inform the parser that the end of stream was reached. ] ] [ [[link beast.ref.boost__beast__http__parser.release [*release]]] [ Returns ownership of the parsed message. ] ] [ [[link beast.ref.boost__beast__http__parser.skip [*skip]]] [ Returns true if the skip parse option is set. Set the skip parse option. ] ] [ [[link beast.ref.boost__beast__http__parser.upgrade [*upgrade]]] [ Returns true if the message is an upgrade message. ] ] [ [[link beast.ref.boost__beast__http__parser.parser_dtor_ [*~parser]]] [ Destructor. ] ] ]
  3983. This class uses the basic HTTP/1 wire format parser to convert a series of octets into a [link beast.ref.boost__beast__http__message `http::message`] using the [link beast.ref.boost__beast__http__basic_fields `http::basic_fields`] container to represent the fields.
  3984. [heading Template Parameters] [table [[Type][Description]] [[`isRequest`][
  3985. Indicates whether a request or response will be parsed. ]] [[`Body`][
  3986. The type used to represent the body. This must meet the requirements of ['Body]. ]] [[`Allocator`][
  3987. The type of allocator used with the [link beast.ref.boost__beast__http__basic_fields `http::basic_fields`] container. ]] ]
  3988. [heading Remarks]
  3989. A new instance of the parser is required for each message.
  3990. [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__request_serializer http::request_serializer] [indexterm1 http::request_serializer]
  3991. A serializer for HTTP/1 requests. [heading Synopsis] Defined in header [include_file boost/beast/http/serializer.hpp] ``` template< class __Body__, class __Fields__ = fields> using request_serializer = serializer< true, Body, Fields >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__serializer.value_type [*value_type]]] [ The type of message this serializer uses. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__serializer.consume [*consume]]] [ Consume buffer octets in the serialization. ] ] [ [[link beast.ref.boost__beast__http__serializer.get [*get]]] [ Returns the message being serialized. ] ] [ [[link beast.ref.boost__beast__http__serializer.is_done [*is_done]]] [ Return true if serialization is complete. ] ] [ [[link beast.ref.boost__beast__http__serializer.is_header_done [*is_header_done]]] [ Return true if serialization of the header is complete. ] ] [ [[link beast.ref.boost__beast__http__serializer.limit [*limit]]] [ Returns the serialized buffer size limit. Set the serialized buffer size limit. ] ] [ [[link beast.ref.boost__beast__http__serializer.next [*next]]] [ Returns the next set of buffers in the serialization. ] ] [ [[link beast.ref.boost__beast__http__serializer.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__http__serializer.serializer [*serializer]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__serializer.split [*split]]] [ Returns true if we will pause after writing the complete header. Set whether the header and body are written separately. ] ] [ [[link beast.ref.boost__beast__http__serializer.writer_impl [*writer_impl]]] [ Provides low-level access to the associated BodyWriter ] ] ]
  3992. An object of this type is used to serialize a complete HTTP message into a sequence of octets. To use this class, construct an instance with the message to be serialized. The implementation will automatically perform chunk encoding if the contents of the message indicate that chunk encoding is required.
  3993. Chunked output produced by the serializer never contains chunk extensions or trailers, and the location of chunk boundaries is not specified. If callers require chunk extensions, trailers, or control over the exact contents of each chunk they should use the serializer to write just the message header, and then assume control over serializing the chunked payload by using the chunk buffer sequence types [link beast.ref.boost__beast__http__chunk_body `http::chunk_body`], [link beast.ref.boost__beast__http__chunk_crlf `http::chunk_crlf`], [link beast.ref.boost__beast__http__chunk_header `http::chunk_header`], and [link beast.ref.boost__beast__http__chunk_last `http::chunk_last`].
  3994. [heading Template Parameters] [table [[Type][Description]] [[`isRequest`][
  3995. `true` if the message is a request. ]] [[`Body`][
  3996. The body type of the message. ]] [[`Fields`][
  3997. The type of fields in the message. ]] ]
  3998. [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__response http::response] [indexterm1 http::response]
  3999. A typical HTTP response. [heading Synopsis] Defined in header [include_file boost/beast/http/message.hpp] ``` template< class __Body__, class __Fields__ = fields> using response = message< false, Body, Fields >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__message.body_type [*body_type]]] [ The type providing the body traits. ] ] [ [[link beast.ref.boost__beast__http__message.fields_type [*fields_type]]] [ The type representing the fields. ] ] [ [[link beast.ref.boost__beast__http__message.header_type [*header_type]]] [ The base class used to hold the header portion of the message. ] ] [ [[link beast.ref.boost__beast__http__message.is_request [*is_request]]] [ Indicates if the header is a request or response. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__message.base [*base]]] [ Returns the header portion of the message. ] ] [ [[link beast.ref.boost__beast__http__message.body [*body]]] [ Returns the body. ] ] [ [[link beast.ref.boost__beast__http__message.chunked [*chunked]]] [ Returns true if the chunked Transfer-Encoding is specified. Set or clear the chunked Transfer-Encoding. ] ] [ [[link beast.ref.boost__beast__http__message.content_length [*content_length]]] [ Set or clear the Content-Length field. ] ] [ [[link beast.ref.boost__beast__http__message.has_content_length [*has_content_length]]] [ Returns true if the Content-Length field is present. ] ] [ [[link beast.ref.boost__beast__http__message.keep_alive [*keep_alive]]] [ Returns true if the message semantics indicate keep-alive. Set the keep-alive message semantic option. ] ] [ [[link beast.ref.boost__beast__http__message.message [*message]]] [ Constructor. Construct a message. ] ] [ [[link beast.ref.boost__beast__http__message.method [*method]]] [ Return the request-method verb. Set the request-method. ] ] [ [[link beast.ref.boost__beast__http__message.method_string [*method_string]]] [ Return the request-method as a string. ] ] [ [[link beast.ref.boost__beast__http__message.need_eof [*need_eof]]] [ Returns true if the message semantics require an end of file. ] ] [ [[link beast.ref.boost__beast__http__message.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__http__message.payload_size [*payload_size]]] [ Returns the payload size of the body in octets if possible. ] ] [ [[link beast.ref.boost__beast__http__message.prepare_payload [*prepare_payload]]] [ Prepare the message payload fields for the body. ] ] [ [[link beast.ref.boost__beast__http__message.reason [*reason]]] [ Return the response reason-phrase. Set the response reason-phrase (deprecated) ] ] [ [[link beast.ref.boost__beast__http__message.result [*result]]] [ The response status-code result. Set the response status-code. Set the response status-code as an integer. ] ] [ [[link beast.ref.boost__beast__http__message.result_int [*result_int]]] [ The response status-code expressed as an integer. ] ] [ [[link beast.ref.boost__beast__http__message.target [*target]]] [ Returns the request-target string. Set the request-target string. ] ] [ [[link beast.ref.boost__beast__http__message.version [*version]]] [ Return the HTTP-version. Set the HTTP-version. ] ] ]
  4000. This container is derived from the `Fields` template type. To understand all of the members of this class it is necessary to view the declaration for the `Fields` type. When using the default fields container, those declarations are in [link beast.ref.boost__beast__http__fields `http::fields`].
  4001. A message can be a request or response, depending on the `isRequest` template argument value. Requests and responses have different types; functions may be overloaded based on the type if desired.
  4002. The `Body` template argument type determines the model used to read or write the content body of the message.
  4003. Newly constructed messages objects have version set to HTTP/1.1. Newly constructed response objects also have result code set to [link beast.ref.boost__beast__http__status `http::ok`].
  4004. [heading Template Parameters] [table [[Type][Description]] [[`isRequest`][
  4005. `true` if this represents a request, or `false` if this represents a response. Some class data members are conditionally present depending on this value. ]] [[`Body`][
  4006. A type meeting the requirements of Body. ]] [[`Fields`][
  4007. The type of container used to hold the field value pairs. ]] ]
  4008. [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__response_header http::response_header] [indexterm1 http::response_header]
  4009. A typical HTTP response header. [heading Synopsis] Defined in header [include_file boost/beast/http/message.hpp] ``` template< class __Fields__ = fields> using response_header = header< false, Fields >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__header.fields_type [*fields_type]]] [ The type representing the fields. ] ] [ [[link beast.ref.boost__beast__http__header.is_request [*is_request]]] [ Indicates if the header is a request or response. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__header.header [*header]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__header.method [*method]]] [ Return the request-method verb. Set the request-method. ] ] [ [[link beast.ref.boost__beast__http__header.method_string [*method_string]]] [ Return the request-method as a string. ] ] [ [[link beast.ref.boost__beast__http__header.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__http__header.reason [*reason]]] [ Return the response reason-phrase. Set the response reason-phrase (deprecated) ] ] [ [[link beast.ref.boost__beast__http__header.result [*result]]] [ The response status-code result. Set the response status-code. Set the response status-code as an integer. ] ] [ [[link beast.ref.boost__beast__http__header.result_int [*result_int]]] [ The response status-code expressed as an integer. ] ] [ [[link beast.ref.boost__beast__http__header.target [*target]]] [ Returns the request-target string. Set the request-target string. ] ] [ [[link beast.ref.boost__beast__http__header.version [*version]]] [ Return the HTTP-version. Set the HTTP-version. ] ] ]
  4010. This container is derived from the `Fields` template type. To understand all of the members of this class it is necessary to view the declaration for the `Fields` type. When using the default fields container, those declarations are in [link beast.ref.boost__beast__http__fields `http::fields`].
  4011. Newly constructed header objects have version set to HTTP/1.1. Newly constructed response objects also have result code set to [link beast.ref.boost__beast__http__status `http::ok`].
  4012. A `header` includes the start-line and header-fields. [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__response_parser http::response_parser] [indexterm1 http::response_parser]
  4013. An HTTP/1 parser for producing a response message. [heading Synopsis] Defined in header [include_file boost/beast/http/parser.hpp] ``` template< class __Body__, class __Allocator__ = std::allocator<char>> using response_parser = parser< false, Body, Allocator >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__parser.is_request [*is_request]]] [ true if this parser parses requests, false for responses. ] ] [ [[link beast.ref.boost__beast__http__parser.value_type [*value_type]]] [ The type of message returned by the parser. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__parser.body_limit [*body_limit]]] [ Set the limit on the payload body. ] ] [ [[link beast.ref.boost__beast__http__parser.chunked [*chunked]]] [ Returns true if the last value for Transfer-Encoding is "chunked". ] ] [ [[link beast.ref.boost__beast__http__parser.content_length [*content_length]]] [ Returns the optional value of Content-Length if known. ] ] [ [[link beast.ref.boost__beast__http__parser.content_length_remaining [*content_length_remaining]]] [ Returns the remaining content length if known. ] ] [ [[link beast.ref.boost__beast__http__parser.eager [*eager]]] [ Returns true if the eager parse option is set. Set the eager parse option. ] ] [ [[link beast.ref.boost__beast__http__parser.get [*get]]] [ Returns the parsed message. ] ] [ [[link beast.ref.boost__beast__http__parser.got_some [*got_some]]] [ Returns true if the parser has received at least one byte of input. ] ] [ [[link beast.ref.boost__beast__http__parser.header_limit [*header_limit]]] [ Set a limit on the total size of the header. ] ] [ [[link beast.ref.boost__beast__http__parser.is_done [*is_done]]] [ Returns true if the message is complete. ] ] [ [[link beast.ref.boost__beast__http__parser.is_header_done [*is_header_done]]] [ Returns true if a the parser has produced the full header. ] ] [ [[link beast.ref.boost__beast__http__parser.keep_alive [*keep_alive]]] [ Returns true if the message has keep-alive connection semantics. ] ] [ [[link beast.ref.boost__beast__http__parser.need_eof [*need_eof]]] [ Returns true if the message semantics require an end of file. ] ] [ [[link beast.ref.boost__beast__http__parser.on_chunk_body [*on_chunk_body]]] [ Set a callback to be invoked on chunk body data. ] ] [ [[link beast.ref.boost__beast__http__parser.on_chunk_header [*on_chunk_header]]] [ Set a callback to be invoked on each chunk header. ] ] [ [[link beast.ref.boost__beast__http__parser.operator_eq_ [*operator=]]] [ Assignment (disallowed) ] ] [ [[link beast.ref.boost__beast__http__parser.parser [*parser]]] [ Constructor (disallowed) Constructor. Construct a parser from another parser, changing the Body type. ] ] [ [[link beast.ref.boost__beast__http__parser.put [*put]]] [ Write a buffer sequence to the parser. ] ] [ [[link beast.ref.boost__beast__http__parser.put_eof [*put_eof]]] [ Inform the parser that the end of stream was reached. ] ] [ [[link beast.ref.boost__beast__http__parser.release [*release]]] [ Returns ownership of the parsed message. ] ] [ [[link beast.ref.boost__beast__http__parser.skip [*skip]]] [ Returns true if the skip parse option is set. Set the skip parse option. ] ] [ [[link beast.ref.boost__beast__http__parser.upgrade [*upgrade]]] [ Returns true if the message is an upgrade message. ] ] [ [[link beast.ref.boost__beast__http__parser.parser_dtor_ [*~parser]]] [ Destructor. ] ] ]
  4014. This class uses the basic HTTP/1 wire format parser to convert a series of octets into a [link beast.ref.boost__beast__http__message `http::message`] using the [link beast.ref.boost__beast__http__basic_fields `http::basic_fields`] container to represent the fields.
  4015. [heading Template Parameters] [table [[Type][Description]] [[`isRequest`][
  4016. Indicates whether a request or response will be parsed. ]] [[`Body`][
  4017. The type used to represent the body. This must meet the requirements of ['Body]. ]] [[`Allocator`][
  4018. The type of allocator used with the [link beast.ref.boost__beast__http__basic_fields `http::basic_fields`] container. ]] ]
  4019. [heading Remarks]
  4020. A new instance of the parser is required for each message.
  4021. [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__response_serializer http::response_serializer] [indexterm1 http::response_serializer]
  4022. A serializer for HTTP/1 responses. [heading Synopsis] Defined in header [include_file boost/beast/http/serializer.hpp] ``` template< class __Body__, class __Fields__ = fields> using response_serializer = serializer< false, Body, Fields >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__serializer.value_type [*value_type]]] [ The type of message this serializer uses. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__serializer.consume [*consume]]] [ Consume buffer octets in the serialization. ] ] [ [[link beast.ref.boost__beast__http__serializer.get [*get]]] [ Returns the message being serialized. ] ] [ [[link beast.ref.boost__beast__http__serializer.is_done [*is_done]]] [ Return true if serialization is complete. ] ] [ [[link beast.ref.boost__beast__http__serializer.is_header_done [*is_header_done]]] [ Return true if serialization of the header is complete. ] ] [ [[link beast.ref.boost__beast__http__serializer.limit [*limit]]] [ Returns the serialized buffer size limit. Set the serialized buffer size limit. ] ] [ [[link beast.ref.boost__beast__http__serializer.next [*next]]] [ Returns the next set of buffers in the serialization. ] ] [ [[link beast.ref.boost__beast__http__serializer.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__http__serializer.serializer [*serializer]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__serializer.split [*split]]] [ Returns true if we will pause after writing the complete header. Set whether the header and body are written separately. ] ] [ [[link beast.ref.boost__beast__http__serializer.writer_impl [*writer_impl]]] [ Provides low-level access to the associated BodyWriter ] ] ]
  4023. An object of this type is used to serialize a complete HTTP message into a sequence of octets. To use this class, construct an instance with the message to be serialized. The implementation will automatically perform chunk encoding if the contents of the message indicate that chunk encoding is required.
  4024. Chunked output produced by the serializer never contains chunk extensions or trailers, and the location of chunk boundaries is not specified. If callers require chunk extensions, trailers, or control over the exact contents of each chunk they should use the serializer to write just the message header, and then assume control over serializing the chunked payload by using the chunk buffer sequence types [link beast.ref.boost__beast__http__chunk_body `http::chunk_body`], [link beast.ref.boost__beast__http__chunk_crlf `http::chunk_crlf`], [link beast.ref.boost__beast__http__chunk_header `http::chunk_header`], and [link beast.ref.boost__beast__http__chunk_last `http::chunk_last`].
  4025. [heading Template Parameters] [table [[Type][Description]] [[`isRequest`][
  4026. `true` if the message is a request. ]] [[`Body`][
  4027. The body type of the message. ]] [[`Fields`][
  4028. The type of fields in the message. ]] ]
  4029. [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__serializer http::serializer]
  4030. Provides buffer oriented HTTP message serialization functionality. [heading Synopsis] Defined in header [include_file boost/beast/http/serializer.hpp] ``` template< bool isRequest, class __Body__, class __Fields__ = fields> class serializer ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__serializer.value_type [*value_type]]] [ The type of message this serializer uses. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__serializer.consume [*consume]]] [ Consume buffer octets in the serialization. ] ] [ [[link beast.ref.boost__beast__http__serializer.get [*get]]] [ Returns the message being serialized. ] ] [ [[link beast.ref.boost__beast__http__serializer.is_done [*is_done]]] [ Return true if serialization is complete. ] ] [ [[link beast.ref.boost__beast__http__serializer.is_header_done [*is_header_done]]] [ Return true if serialization of the header is complete. ] ] [ [[link beast.ref.boost__beast__http__serializer.limit [*limit]]] [ Returns the serialized buffer size limit. Set the serialized buffer size limit. ] ] [ [[link beast.ref.boost__beast__http__serializer.next [*next]]] [ Returns the next set of buffers in the serialization. ] ] [ [[link beast.ref.boost__beast__http__serializer.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__http__serializer.serializer [*serializer]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__http__serializer.split [*split]]] [ Returns true if we will pause after writing the complete header. Set whether the header and body are written separately. ] ] [ [[link beast.ref.boost__beast__http__serializer.writer_impl [*writer_impl]]] [ Provides low-level access to the associated BodyWriter ] ] ] [heading Description]
  4031. An object of this type is used to serialize a complete HTTP message into a sequence of octets. To use this class, construct an instance with the message to be serialized. The implementation will automatically perform chunk encoding if the contents of the message indicate that chunk encoding is required.
  4032. Chunked output produced by the serializer never contains chunk extensions or trailers, and the location of chunk boundaries is not specified. If callers require chunk extensions, trailers, or control over the exact contents of each chunk they should use the serializer to write just the message header, and then assume control over serializing the chunked payload by using the chunk buffer sequence types [link beast.ref.boost__beast__http__chunk_body `http::chunk_body`], [link beast.ref.boost__beast__http__chunk_crlf `http::chunk_crlf`], [link beast.ref.boost__beast__http__chunk_header `http::chunk_header`], and [link beast.ref.boost__beast__http__chunk_last `http::chunk_last`].
  4033. [heading Template Parameters] [table [[Type][Description]] [[`isRequest`][
  4034. `true` if the message is a request. ]] [[`Body`][
  4035. The body type of the message. ]] [[`Fields`][
  4036. The type of fields in the message. ]] ]
  4037. [section:consume http::serializer::consume] [indexterm2 consume..http::serializer]
  4038. Consume buffer octets in the serialization. [heading Synopsis] ``` void consume( std::size_t n); ``` [heading Description]
  4039. This function should be called after one or more octets contained in the buffers provided in the prior call to [link beast.ref.boost__beast__http__serializer.next `http::serializer::next`] have been used.
  4040. After a call to [link beast.ref.boost__beast__http__serializer.consume `http::serializer::consume`], callers should check the return value of [link beast.ref.boost__beast__http__serializer.is_done `http::serializer::is_done`] to determine if the entire message has been serialized.
  4041. [heading Parameters] [table [[Name][Description]] [[`n`][
  4042. The number of octets to consume. This number must be greater than zero and no greater than the number of octets in the buffers provided in the prior call to [link beast.ref.boost__beast__http__serializer.next `http::serializer::next`]. ]] ]
  4043. [endsect] [section:get http::serializer::get] [indexterm2 get..http::serializer]
  4044. Returns the message being serialized. [heading Synopsis] ``` value_type& get(); ``` [heading Description] [endsect] [section:is_done http::serializer::is_done] [indexterm2 is_done..http::serializer]
  4045. Return `true` if serialization is complete. [heading Synopsis] ``` bool is_done(); ``` [heading Description]
  4046. The operation is complete when all octets corresponding to the serialized representation of the message have been successfully retrieved. [endsect] [section:is_header_done http::serializer::is_header_done] [indexterm2 is_header_done..http::serializer]
  4047. Return `true` if serialization of the header is complete. [heading Synopsis] ``` bool is_header_done(); ``` [heading Description]
  4048. This function indicates whether or not all buffers containing serialized header octets have been retrieved. [endsect] [section:limit http::serializer::limit] [indexterm2 limit..http::serializer]
  4049. Returns the serialized buffer size limit. ``` std::size_t ``[link beast.ref.boost__beast__http__serializer.limit.overload1 limit]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__serializer.limit.overload1 more...]]`` ```
  4050. Set the serialized buffer size limit. ``` void ``[link beast.ref.boost__beast__http__serializer.limit.overload2 limit]``( std::size_t limit); ``[''''&raquo;''' [link beast.ref.boost__beast__http__serializer.limit.overload2 more...]]`` ``` [section:overload1 http::serializer::limit (1 of 2 overloads)]
  4051. Returns the serialized buffer size limit. [heading Synopsis] ``` std::size_t limit(); ``` [heading Description] [endsect] [section:overload2 http::serializer::limit (2 of 2 overloads)]
  4052. Set the serialized buffer size limit. [heading Synopsis] ``` void limit( std::size_t limit); ``` [heading Description]
  4053. This function adjusts the limit on the maximum size of the buffers passed to the visitor. The new size limit takes effect in the following call to [link beast.ref.boost__beast__http__serializer.next `http::serializer::next`].
  4054. The default is no buffer size limit.
  4055. [heading Parameters] [table [[Name][Description]] [[`limit`][
  4056. The new buffer size limit. If this number is zero, the size limit is removed. ]] ]
  4057. [endsect] [endsect] [section:next http::serializer::next] [indexterm2 next..http::serializer]
  4058. Returns the next set of buffers in the serialization. [heading Synopsis] ``` template< class Visit> void next( error_code& ec, Visit&& visit); ``` [heading Description]
  4059. This function will attempt to call the `visit` function object with a ['ConstBufferSequence] of unspecified type representing the next set of buffers in the serialization of the message represented by this object.
  4060. If there are no more buffers in the serialization, the visit function will not be called. In this case, no error will be indicated, and the function [link beast.ref.boost__beast__http__serializer.is_done `http::serializer::is_done`] will return `true`.
  4061. [heading Parameters] [table [[Name][Description]] [[`ec`][
  4062. Set to the error, if any occurred. ]] [[`visit`][
  4063. The function to call. The equivalent function signature of this object must be: ``` template<class ConstBufferSequence>
  4064. void visit(error_code&, ConstBufferSequence const&);
  4065. ``` The function is not copied, if no error occurs it will be invoked before the call to [link beast.ref.boost__beast__http__serializer.next `http::serializer::next`] returns. ]] ]
  4066. [endsect] [section:operator_eq_ http::serializer::operator=] [indexterm2 operator=..http::serializer]
  4067. Assignment. [heading Synopsis] ``` serializer& operator=( serializer const&); ``` [heading Description] [endsect] [section:serializer http::serializer::serializer] [indexterm2 serializer..http::serializer]
  4068. Constructor. ``` ``[link beast.ref.boost__beast__http__serializer.serializer.overload1 serializer]``( serializer&&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__serializer.serializer.overload1 more...]]`` ``[link beast.ref.boost__beast__http__serializer.serializer.overload2 serializer]``( serializer const&); ``[''''&raquo;''' [link beast.ref.boost__beast__http__serializer.serializer.overload2 more...]]`` explicit ``[link beast.ref.boost__beast__http__serializer.serializer.overload3 serializer]``( value_type& msg); ``[''''&raquo;''' [link beast.ref.boost__beast__http__serializer.serializer.overload3 more...]]`` ``` [section:overload1 http::serializer::serializer (1 of 3 overloads)]
  4069. Constructor. [heading Synopsis] ``` serializer( serializer&&); ``` [heading Description] [endsect] [section:overload2 http::serializer::serializer (2 of 3 overloads)]
  4070. Constructor. [heading Synopsis] ``` serializer( serializer const&); ``` [heading Description] [endsect] [section:overload3 http::serializer::serializer (3 of 3 overloads)]
  4071. Constructor. [heading Synopsis] ``` serializer( value_type& msg); ``` [heading Description]
  4072. The implementation guarantees that the message passed on construction will not be accessed until the first call to [link beast.ref.boost__beast__http__serializer.next `http::serializer::next`]. This allows the message to be lazily created. For example, if the header is filled in before serialization.
  4073. [heading Parameters] [table [[Name][Description]] [[`msg`][
  4074. A reference to the message to serialize, which must remain valid for the lifetime of the serializer. Depending on the type of Body used, this may or may not be a `const` reference. ]] ]
  4075. [heading Remarks]
  4076. This function participates in overload resolution only if Body::writer is constructible from a `const` message reference.
  4077. [endsect] [endsect] [section:split http::serializer::split] [indexterm2 split..http::serializer]
  4078. Returns `true` if we will pause after writing the complete header. ``` bool ``[link beast.ref.boost__beast__http__serializer.split.overload1 split]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__http__serializer.split.overload1 more...]]`` ```
  4079. Set whether the header and body are written separately. ``` void ``[link beast.ref.boost__beast__http__serializer.split.overload2 split]``( bool v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__serializer.split.overload2 more...]]`` ``` [section:overload1 http::serializer::split (1 of 2 overloads)]
  4080. Returns `true` if we will pause after writing the complete header. [heading Synopsis] ``` bool split(); ``` [heading Description] [endsect] [section:overload2 http::serializer::split (2 of 2 overloads)]
  4081. Set whether the header and body are written separately. [heading Synopsis] ``` void split( bool v); ``` [heading Description]
  4082. When the split feature is enabled, the implementation will write only the octets corresponding to the serialized header first. If the header has already been written, this function will have no effect on output. [endsect] [endsect] [section:value_type http::serializer::value_type] [indexterm2 value_type..http::serializer]
  4083. The type of message this serializer uses. [heading Synopsis] ``` using value_type = ``['implementation-defined]``; ``` [heading Description]
  4084. This may be const or non-const depending on the implementation of the corresponding ['BodyWriter]. [endsect] [section:writer_impl http::serializer::writer_impl] [indexterm2 writer_impl..http::serializer]
  4085. Provides low-level access to the associated ['BodyWriter] [heading Synopsis] ``` writer& writer_impl(); ``` [heading Description]
  4086. This function provides access to the instance of the writer associated with the body and created by the serializer upon construction. The behavior of accessing this object is defined by the specification of the particular writer and its associated body.
  4087. [heading Return Value]
  4088. A reference to the writer.
  4089. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__span_body http::span_body]
  4090. A ['Body] using [link beast.ref.boost__beast__span `span`]. [heading Synopsis] Defined in header [include_file boost/beast/http/span_body.hpp] ``` template< class T> struct span_body ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__span_body.reader [*reader]]] [ The algorithm for parsing the body. ] ] [ [[link beast.ref.boost__beast__http__span_body.value_type [*value_type]]] [ The type of container used for the body. ] ] [ [[link beast.ref.boost__beast__http__span_body.writer [*writer]]] [ The algorithm for serializing the body. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__span_body.size [*size]]] [ Returns the payload size of the body. ] ] ] [heading Description]
  4091. This body uses [link beast.ref.boost__beast__span `span`] as a memory-based container for holding message payloads. The container represents a non-owning reference to a contiguous area of memory. Messages using this body type may be serialized and parsed.
  4092. Unlike [link beast.ref.boost__beast__http__buffer_body `http::buffer_body`], only one buffer may be provided during a parse or serialize operation. [section:reader http::span_body::reader] [indexterm2 reader..http::span_body]
  4093. The algorithm for parsing the body. [heading Synopsis] ``` using reader = ``['implementation-defined]``; ``` [heading Description]
  4094. Meets the requirements of ['BodyReader]. [endsect] [section:size http::span_body::size] [indexterm2 size..http::span_body]
  4095. Returns the payload size of the body. [heading Synopsis] ``` static std::uint64_t size( value_type const& body); ``` [heading Description]
  4096. When this body is used with [link beast.ref.boost__beast__http__message.prepare_payload `http::message::prepare_payload`], the Content-Length will be set to the payload size, and any chunked Transfer-Encoding will be removed. [endsect] [section:value_type http::span_body::value_type] [indexterm2 value_type..http::span_body]
  4097. The type of container used for the body. [heading Synopsis] ``` using value_type = span< T >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__span.const_iterator [*const_iterator]]] [ The const iterator used by the container. ] ] [ [[link beast.ref.boost__beast__span.const_pointer [*const_pointer]]] [ The const pointer used by the container. ] ] [ [[link beast.ref.boost__beast__span.const_reference [*const_reference]]] [ The const reference used by the container. ] ] [ [[link beast.ref.boost__beast__span.element_type [*element_type]]] [ The type of value, including cv qualifiers. ] ] [ [[link beast.ref.boost__beast__span.index_type [*index_type]]] [ The type of integer used to index the span. ] ] [ [[link beast.ref.boost__beast__span.iterator [*iterator]]] [ The iterator used by the container. ] ] [ [[link beast.ref.boost__beast__span.pointer [*pointer]]] [ A pointer to a span element. ] ] [ [[link beast.ref.boost__beast__span.reference [*reference]]] [ A reference to a span element. ] ] [ [[link beast.ref.boost__beast__span.value_type [*value_type]]] [ The type of value of each span element. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__span.begin [*begin]]] [ Returns an iterator to the beginning of the span. ] ] [ [[link beast.ref.boost__beast__span.cbegin [*cbegin]]] [ Returns an iterator to the beginning of the span. ] ] [ [[link beast.ref.boost__beast__span.cend [*cend]]] [ Returns an iterator to one past the end of the span. ] ] [ [[link beast.ref.boost__beast__span.data [*data]]] [ Returns a pointer to the beginning of the span. ] ] [ [[link beast.ref.boost__beast__span.empty [*empty]]] [ Returns true if the span is empty. ] ] [ [[link beast.ref.boost__beast__span.end [*end]]] [ Returns an iterator to one past the end of the span. ] ] [ [[link beast.ref.boost__beast__span.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__span.size [*size]]] [ Returns the number of elements in the span. ] ] [ [[link beast.ref.boost__beast__span.span [*span]]] [ Constructor. ] ] ]
  4098. This class implements a non-owning reference to a storage area of a certain size and having an underlying integral type with size of 1.
  4099. [heading Template Parameters] [table [[Type][Description]] [[`T`][
  4100. The type pointed to by span iterators ]] ]
  4101. [heading Description]
  4102. This determines the type of [link beast.ref.boost__beast__http__message.body `http::message::body`] when this body type is used with a message container. [endsect] [section:writer http::span_body::writer] [indexterm2 writer..http::span_body]
  4103. The algorithm for serializing the body. [heading Synopsis] ``` using writer = ``['implementation-defined]``; ``` [heading Description]
  4104. Meets the requirements of ['BodyWriter]. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__status http::status] [indexterm1 http::status] [heading Synopsis] Defined in header [include_file boost/beast/http/status.hpp] ``` enum status ``` [indexterm2 unknown..http::status] [indexterm2 continue_..http::status] [indexterm2 switching_protocols..http::status] [indexterm2 processing..http::status] [indexterm2 ok..http::status] [indexterm2 created..http::status] [indexterm2 accepted..http::status] [indexterm2 non_authoritative_information..http::status] [indexterm2 no_content..http::status] [indexterm2 reset_content..http::status] [indexterm2 partial_content..http::status] [indexterm2 multi_status..http::status] [indexterm2 already_reported..http::status] [indexterm2 im_used..http::status] [indexterm2 multiple_choices..http::status] [indexterm2 moved_permanently..http::status] [indexterm2 found..http::status] [indexterm2 see_other..http::status] [indexterm2 not_modified..http::status] [indexterm2 use_proxy..http::status] [indexterm2 temporary_redirect..http::status] [indexterm2 permanent_redirect..http::status] [indexterm2 bad_request..http::status] [indexterm2 unauthorized..http::status] [indexterm2 payment_required..http::status] [indexterm2 forbidden..http::status] [indexterm2 not_found..http::status] [indexterm2 method_not_allowed..http::status] [indexterm2 not_acceptable..http::status] [indexterm2 proxy_authentication_required..http::status] [indexterm2 request_timeout..http::status] [indexterm2 conflict..http::status] [indexterm2 gone..http::status] [indexterm2 length_required..http::status] [indexterm2 precondition_failed..http::status] [indexterm2 payload_too_large..http::status] [indexterm2 uri_too_long..http::status] [indexterm2 unsupported_media_type..http::status] [indexterm2 range_not_satisfiable..http::status] [indexterm2 expectation_failed..http::status] [indexterm2 misdirected_request..http::status] [indexterm2 unprocessable_entity..http::status] [indexterm2 locked..http::status] [indexterm2 failed_dependency..http::status] [indexterm2 upgrade_required..http::status] [indexterm2 precondition_required..http::status] [indexterm2 too_many_requests..http::status] [indexterm2 request_header_fields_too_large..http::status] [indexterm2 connection_closed_without_response..http::status] [indexterm2 unavailable_for_legal_reasons..http::status] [indexterm2 client_closed_request..http::status] [indexterm2 internal_server_error..http::status] [indexterm2 not_implemented..http::status] [indexterm2 bad_gateway..http::status] [indexterm2 service_unavailable..http::status] [indexterm2 gateway_timeout..http::status] [indexterm2 http_version_not_supported..http::status] [indexterm2 variant_also_negotiates..http::status] [indexterm2 insufficient_storage..http::status] [indexterm2 loop_detected..http::status] [indexterm2 not_extended..http::status] [indexterm2 network_authentication_required..http::status] [indexterm2 network_connect_timeout_error..http::status] [heading Values] [table [[Name][Description]] [[[^unknown]][An unknown status-code. This value indicates that the value for the status code
  4105. is not in the list of commonly recognized status codes.
  4106. Callers interested in the exactly value should use the
  4107. interface which provides the raw integer.
  4108. ]] [[[^continue_]][ ]] [[[^switching_protocols]][Switching Protocols. This status indicates that a request to switch to a new
  4109. protocol was accepted and applied by the server. A successful
  4110. response to a WebSocket Upgrade HTTP request will have this
  4111. code.
  4112. ]] [[[^processing]][ ]] [[[^ok]][ ]] [[[^created]][ ]] [[[^accepted]][ ]] [[[^non_authoritative_information]][ ]] [[[^no_content]][ ]] [[[^reset_content]][ ]] [[[^partial_content]][ ]] [[[^multi_status]][ ]] [[[^already_reported]][ ]] [[[^im_used]][ ]] [[[^multiple_choices]][ ]] [[[^moved_permanently]][ ]] [[[^found]][ ]] [[[^see_other]][ ]] [[[^not_modified]][ ]] [[[^use_proxy]][ ]] [[[^temporary_redirect]][ ]] [[[^permanent_redirect]][ ]] [[[^bad_request]][ ]] [[[^unauthorized]][ ]] [[[^payment_required]][ ]] [[[^forbidden]][ ]] [[[^not_found]][ ]] [[[^method_not_allowed]][ ]] [[[^not_acceptable]][ ]] [[[^proxy_authentication_required]][ ]] [[[^request_timeout]][ ]] [[[^conflict]][ ]] [[[^gone]][ ]] [[[^length_required]][ ]] [[[^precondition_failed]][ ]] [[[^payload_too_large]][ ]] [[[^uri_too_long]][ ]] [[[^unsupported_media_type]][ ]] [[[^range_not_satisfiable]][ ]] [[[^expectation_failed]][ ]] [[[^misdirected_request]][ ]] [[[^unprocessable_entity]][ ]] [[[^locked]][ ]] [[[^failed_dependency]][ ]] [[[^upgrade_required]][ ]] [[[^precondition_required]][ ]] [[[^too_many_requests]][ ]] [[[^request_header_fields_too_large]][ ]] [[[^connection_closed_without_response]][ ]] [[[^unavailable_for_legal_reasons]][ ]] [[[^client_closed_request]][ ]] [[[^internal_server_error]][ ]] [[[^not_implemented]][ ]] [[[^bad_gateway]][ ]] [[[^service_unavailable]][ ]] [[[^gateway_timeout]][ ]] [[[^http_version_not_supported]][ ]] [[[^variant_also_negotiates]][ ]] [[[^insufficient_storage]][ ]] [[[^loop_detected]][ ]] [[[^not_extended]][ ]] [[[^network_authentication_required]][ ]] [[[^network_connect_timeout_error]][ ]] ] [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__status_class http::status_class] [indexterm1 http::status_class]
  4113. Represents the class of a status-code. [heading Synopsis] Defined in header [include_file boost/beast/http/status.hpp] ``` enum status_class ``` [indexterm2 unknown..http::status_class] [indexterm2 informational..http::status_class] [indexterm2 successful..http::status_class] [indexterm2 redirection..http::status_class] [indexterm2 client_error..http::status_class] [indexterm2 server_error..http::status_class] [heading Values] [table [[Name][Description]] [[[^unknown]][Unknown status-class. ]] [[[^informational]][The request was received, continuing processing. ]] [[[^successful]][The request was successfully received, understood, and accepted. ]] [[[^redirection]][Further action needs to be taken in order to complete the request. ]] [[[^client_error]][The request contains bad syntax or cannot be fulfilled. ]] [[[^server_error]][The server failed to fulfill an apparently valid request. ]] ] [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__string_body http::string_body] [indexterm1 http::string_body]
  4114. A ['Body] using `std::string` [heading Synopsis] Defined in header [include_file boost/beast/http/string_body.hpp] ``` using string_body = basic_string_body< char >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_string_body.reader [*reader]]] [ The algorithm for parsing the body. ] ] [ [[link beast.ref.boost__beast__http__basic_string_body.value_type [*value_type]]] [ The type of container used for the body. ] ] [ [[link beast.ref.boost__beast__http__basic_string_body.writer [*writer]]] [ The algorithm for serializing the body. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__basic_string_body.size [*size]]] [ Returns the payload size of the body. ] ] ]
  4115. This body uses `std::basic_string` as a memory-based container for holding message payloads. Messages using this body type may be serialized and parsed. [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__string_to_field http::string_to_field] [indexterm1 http::string_to_field]
  4116. Attempt to convert a string to a field enum. [heading Synopsis] Defined in header [include_file boost/beast/http/field.hpp] ``` field string_to_field( string_view s); ``` [heading Description]
  4117. The string comparison is case-insensitive.
  4118. [heading Return Value]
  4119. The corresponding field, or [link beast.ref.boost__beast__http__field `http::unknown`] if no known field matches.
  4120. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__string_to_verb http::string_to_verb] [indexterm1 http::string_to_verb]
  4121. Converts a string to the request method verb. [heading Synopsis] Defined in header [include_file boost/beast/http/verb.hpp] ``` verb string_to_verb( string_view s); ``` [heading Description]
  4122. If the string does not match a known request method, [link beast.ref.boost__beast__http__field `http::unknown`] is returned. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__swap http::swap] [indexterm1 http::swap]
  4123. Swap two header objects. ``` template< bool isRequest, class __Fields__> void ``[link beast.ref.boost__beast__http__swap.overload1 swap]``( header< isRequest, Fields >& m1, header< isRequest, Fields >& m2); ``[''''&raquo;''' [link beast.ref.boost__beast__http__swap.overload1 more...]]`` ```
  4124. Swap two message objects. ``` template< bool isRequest, class __Body__, class __Fields__> void ``[link beast.ref.boost__beast__http__swap.overload2 swap]``( message< isRequest, Body, Fields >& m1, message< isRequest, Body, Fields >& m2); ``[''''&raquo;''' [link beast.ref.boost__beast__http__swap.overload2 more...]]`` ``` [section:overload1 http::swap (1 of 2 overloads)]
  4125. Swap two header objects. [heading Synopsis] Defined in header [include_file boost/beast/http/message.hpp] ``` template< bool isRequest, class __Fields__> void swap( header< isRequest, Fields >& m1, header< isRequest, Fields >& m2); ``` [heading Description]
  4126. [heading Requirements]
  4127. `Fields` is [*Swappable].
  4128. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::swap (2 of 2 overloads)]
  4129. Swap two message objects. [heading Synopsis] Defined in header [include_file boost/beast/http/message.hpp] ``` template< bool isRequest, class __Body__, class __Fields__> void swap( message< isRequest, Body, Fields >& m1, message< isRequest, Body, Fields >& m2); ``` [heading Description]
  4130. [heading Requirements:]
  4131. `Body::value_type` and `Fields` are [*Swappable].
  4132. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__to_status_class http::to_status_class] [indexterm1 http::to_status_class]
  4133. Convert an integer to a status\_class. ``` status_class ``[link beast.ref.boost__beast__http__to_status_class.overload1 to_status_class]``( unsigned v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__to_status_class.overload1 more...]]`` ```
  4134. Convert a status\_code to a status\_class. ``` status_class ``[link beast.ref.boost__beast__http__to_status_class.overload2 to_status_class]``( status v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__to_status_class.overload2 more...]]`` ``` [section:overload1 http::to_status_class (1 of 2 overloads)]
  4135. Convert an integer to a status\_class. [heading Synopsis] Defined in header [include_file boost/beast/http/status.hpp] ``` status_class to_status_class( unsigned v); ``` [heading Description]
  4136. [heading Parameters] [table [[Name][Description]] [[`v`][
  4137. The integer representing a status code. ]] ]
  4138. [heading Return Value]
  4139. The status class. If the integer does not match a known status class, [link beast.ref.boost__beast__http__field `http::unknown`] is returned.
  4140. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::to_status_class (2 of 2 overloads)]
  4141. Convert a status\_code to a status\_class. [heading Synopsis] Defined in header [include_file boost/beast/http/status.hpp] ``` status_class to_status_class( status v); ``` [heading Description]
  4142. [heading Parameters] [table [[Name][Description]] [[`v`][
  4143. The status code to convert. ]] ]
  4144. [heading Return Value]
  4145. The status class.
  4146. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__to_string http::to_string] [indexterm1 http::to_string]
  4147. Convert a field enum to a string. ``` string_view ``[link beast.ref.boost__beast__http__to_string.overload1 to_string]``( field f); ``[''''&raquo;''' [link beast.ref.boost__beast__http__to_string.overload1 more...]]`` ```
  4148. Returns the text representation of a request method verb. ``` string_view ``[link beast.ref.boost__beast__http__to_string.overload2 to_string]``( verb v); ``[''''&raquo;''' [link beast.ref.boost__beast__http__to_string.overload2 more...]]`` ``` [section:overload1 http::to_string (1 of 2 overloads)]
  4149. Convert a field enum to a string. [heading Synopsis] Defined in header [include_file boost/beast/http/field.hpp] ``` string_view to_string( field f); ``` [heading Description]
  4150. [heading Parameters] [table [[Name][Description]] [[`f`][
  4151. The field to convert ]] ]
  4152. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::to_string (2 of 2 overloads)]
  4153. Returns the text representation of a request method verb. [heading Synopsis] Defined in header [include_file boost/beast/http/verb.hpp] ``` string_view to_string( verb v); ``` [heading Description] Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__token_list http::token_list]
  4154. A list of tokens in a comma separated HTTP field value. [heading Synopsis] Defined in header [include_file boost/beast/http/rfc7230.hpp] ``` class token_list ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__token_list.const_iterator [*const_iterator]]] [ A constant iterator to the list. ] ] [ [[link beast.ref.boost__beast__http__token_list.value_type [*value_type]]] [ The type of each element in the token list. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__token_list.begin [*begin]]] [ Return a const iterator to the beginning of the list. ] ] [ [[link beast.ref.boost__beast__http__token_list.cbegin [*cbegin]]] [ Return a const iterator to the beginning of the list. ] ] [ [[link beast.ref.boost__beast__http__token_list.cend [*cend]]] [ Return a const iterator to the end of the list. ] ] [ [[link beast.ref.boost__beast__http__token_list.end [*end]]] [ Return a const iterator to the end of the list. ] ] [ [[link beast.ref.boost__beast__http__token_list.exists [*exists]]] [ Return true if a token is present in the list. ] ] [ [[link beast.ref.boost__beast__http__token_list.token_list [*token_list]]] [ Construct a list. ] ] ] [heading Description]
  4155. This container allows iteration of a list of items in a header field value. The input is a comma separated list of tokens.
  4156. If a parsing error is encountered while iterating the string, the behavior of the container will be as if a string containing only characters up to but excluding the first invalid character was used to construct the list.
  4157. [heading BNF]
  4158. ``` token-list = *( "," OWS ) token *( OWS "," [ OWS token ] )
  4159. ```
  4160. To use this class, construct with the string to be parsed and then use [link beast.ref.boost__beast__http__token_list.begin `http::token_list::begin`] and [link beast.ref.boost__beast__http__token_list.end `http::token_list::end`], or range-for to iterate each item:
  4161. [heading Example]
  4162. ``` for(auto const& token : token_list{"apple, pear, banana"})
  4163. std::cout << token << "\n";
  4164. ```
  4165. [section:begin http::token_list::begin] [indexterm2 begin..http::token_list]
  4166. Return a const iterator to the beginning of the list. [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:cbegin http::token_list::cbegin] [indexterm2 cbegin..http::token_list]
  4167. Return a const iterator to the beginning of the list. [heading Synopsis] ``` const_iterator cbegin() const; ``` [heading Description] [endsect] [section:cend http::token_list::cend] [indexterm2 cend..http::token_list]
  4168. Return a const iterator to the end of the list. [heading Synopsis] ``` const_iterator cend() const; ``` [heading Description] [endsect] [section:const_iterator http::token_list::const_iterator] [indexterm2 const_iterator..http::token_list]
  4169. A constant iterator to the list. [heading Synopsis] ``` using const_iterator = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:end http::token_list::end] [indexterm2 end..http::token_list]
  4170. Return a const iterator to the end of the list. [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:exists http::token_list::exists] [indexterm2 exists..http::token_list]
  4171. Return `true` if a token is present in the list. [heading Synopsis] ``` bool exists( string_view const& s); ``` [heading Description]
  4172. [heading Parameters] [table [[Name][Description]] [[`s`][
  4173. The token to find. A case-insensitive comparison is used. ]] ]
  4174. [endsect] [section:token_list http::token_list::token_list] [indexterm2 token_list..http::token_list]
  4175. Construct a list. [heading Synopsis] ``` token_list( string_view s); ``` [heading Description]
  4176. [heading Parameters] [table [[Name][Description]] [[`s`][
  4177. A string containing the list contents. The string must remain valid for the lifetime of the container. ]] ]
  4178. [endsect] [section:value_type http::token_list::value_type] [indexterm2 value_type..http::token_list]
  4179. The type of each element in the token list. [heading Synopsis] ``` using value_type = string_view; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__validate_list http::validate_list] [indexterm1 http::validate_list]
  4180. Returns `true` if a parsed list is parsed without errors. [heading Synopsis] Defined in header [include_file boost/beast/http/rfc7230.hpp] ``` template< class Policy> bool validate_list( detail::basic_parsed_list< Policy > const& list); ``` [heading Description]
  4181. This function iterates a single pass through a parsed list and returns `true` if there were no parsing errors, else returns `false`. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__vector_body http::vector_body]
  4182. A ['Body] using `std::vector` [heading Synopsis] Defined in header [include_file boost/beast/http/vector_body.hpp] ``` template< class T, class __Allocator__ = std::allocator<T>> struct vector_body ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__vector_body.reader [*reader]]] [ The algorithm for parsing the body. ] ] [ [[link beast.ref.boost__beast__http__vector_body.value_type [*value_type]]] [ The type of container used for the body. ] ] [ [[link beast.ref.boost__beast__http__vector_body.writer [*writer]]] [ The algorithm for serializing the body. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__http__vector_body.size [*size]]] [ Returns the payload size of the body. ] ] ] [heading Description]
  4183. This body uses `std::vector` as a memory-based container for holding message payloads. Messages using this body type may be serialized and parsed. [section:reader http::vector_body::reader] [indexterm2 reader..http::vector_body]
  4184. The algorithm for parsing the body. [heading Synopsis] ``` using reader = ``['implementation-defined]``; ``` [heading Description]
  4185. Meets the requirements of ['BodyReader]. [endsect] [section:size http::vector_body::size] [indexterm2 size..http::vector_body]
  4186. Returns the payload size of the body. [heading Synopsis] ``` static std::uint64_t size( value_type const& body); ``` [heading Description]
  4187. When this body is used with [link beast.ref.boost__beast__http__message.prepare_payload `http::message::prepare_payload`], the Content-Length will be set to the payload size, and any chunked Transfer-Encoding will be removed. [endsect] [section:value_type http::vector_body::value_type] [indexterm2 value_type..http::vector_body]
  4188. The type of container used for the body. [heading Synopsis] ``` using value_type = std::vector< T, Allocator >; ``` [heading Description]
  4189. This determines the type of [link beast.ref.boost__beast__http__message.body `http::message::body`] when this body type is used with a message container. [endsect] [section:writer http::vector_body::writer] [indexterm2 writer..http::vector_body]
  4190. The algorithm for serializing the body. [heading Synopsis] ``` using writer = ``['implementation-defined]``; ``` [heading Description]
  4191. Meets the requirements of ['BodyWriter]. [endsect] Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__verb http::verb] [indexterm1 http::verb]
  4192. HTTP request method verbs. [heading Synopsis] Defined in header [include_file boost/beast/http/verb.hpp] ``` enum verb ``` [indexterm2 unknown..http::verb] [indexterm2 delete_..http::verb] [indexterm2 get..http::verb] [indexterm2 head..http::verb] [indexterm2 post..http::verb] [indexterm2 put..http::verb] [indexterm2 connect..http::verb] [indexterm2 options..http::verb] [indexterm2 trace..http::verb] [indexterm2 copy..http::verb] [indexterm2 lock..http::verb] [indexterm2 mkcol..http::verb] [indexterm2 move..http::verb] [indexterm2 propfind..http::verb] [indexterm2 proppatch..http::verb] [indexterm2 search..http::verb] [indexterm2 unlock..http::verb] [indexterm2 bind..http::verb] [indexterm2 rebind..http::verb] [indexterm2 unbind..http::verb] [indexterm2 acl..http::verb] [indexterm2 report..http::verb] [indexterm2 mkactivity..http::verb] [indexterm2 checkout..http::verb] [indexterm2 merge..http::verb] [indexterm2 msearch..http::verb] [indexterm2 notify..http::verb] [indexterm2 subscribe..http::verb] [indexterm2 unsubscribe..http::verb] [indexterm2 patch..http::verb] [indexterm2 purge..http::verb] [indexterm2 mkcalendar..http::verb] [indexterm2 link..http::verb] [indexterm2 unlink..http::verb] [heading Values] [table [[Name][Description]] [[[^unknown]][An unknown method. This value indicates that the request method string is not
  4193. one of the recognized verbs. Callers interested in the method
  4194. should use an interface which returns the original string.
  4195. ]] [[[^delete_]][The DELETE method deletes the specified resource. ]] [[[^get]][The GET method requests a representation of the specified resource. Requests using GET should only retrieve data and should have no other effect.
  4196. ]] [[[^head]][The HEAD method asks for a response identical to that of a GET request, but without the response body. This is useful for retrieving meta-information written in response
  4197. headers, without having to transport the entire content.
  4198. ]] [[[^post]][The POST method requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI. The data POSTed might be, for example, an annotation for existing
  4199. resources; a message for a bulletin board, newsgroup, mailing list,
  4200. or comment thread; a block of data that is the result of submitting
  4201. a web form to a data-handling process; or an item to add to a database
  4202. ]] [[[^put]][The PUT method requests that the enclosed entity be stored under the supplied URI. If the URI refers to an already existing resource, it is modified;
  4203. if the URI does not point to an existing resource, then the server
  4204. can create the resource with that URI.
  4205. ]] [[[^connect]][The CONNECT method converts the request connection to a transparent TCP/IP tunnel. This is usually to facilitate SSL-encrypted communication (HTTPS)
  4206. through an unencrypted HTTP proxy.
  4207. ]] [[[^options]][The OPTIONS method returns the HTTP methods that the server supports for the specified URL. This can be used to check the functionality of a web server by requesting
  4208. '*' instead of a specific resource.
  4209. ]] [[[^trace]][The TRACE method echoes the received request so that a client can see what (if any) changes or additions have been made by intermediate servers. ]] [[[^copy]][ ]] [[[^lock]][ ]] [[[^mkcol]][ ]] [[[^move]][ ]] [[[^propfind]][ ]] [[[^proppatch]][ ]] [[[^search]][ ]] [[[^unlock]][ ]] [[[^bind]][ ]] [[[^rebind]][ ]] [[[^unbind]][ ]] [[[^acl]][ ]] [[[^report]][ ]] [[[^mkactivity]][ ]] [[[^checkout]][ ]] [[[^merge]][ ]] [[[^msearch]][ ]] [[[^notify]][ ]] [[[^subscribe]][ ]] [[[^unsubscribe]][ ]] [[[^patch]][ ]] [[[^purge]][ ]] [[[^mkcalendar]][ ]] [[[^link]][ ]] [[[^unlink]][ ]] ] [heading Description]
  4210. Each verb corresponds to a particular method string used in HTTP request messages. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:boost__beast__http__write http::write] [indexterm1 http::write]
  4211. Write a complete message to a stream using a serializer. ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t ``[link beast.ref.boost__beast__http__write.overload1 write]``( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr); ``[''''&raquo;''' [link beast.ref.boost__beast__http__write.overload1 more...]]`` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t ``[link beast.ref.boost__beast__http__write.overload2 write]``( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__http__write.overload2 more...]]`` ```
  4212. Write a complete message to a stream. ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t ``[link beast.ref.boost__beast__http__write.overload3 write]``( SyncWriteStream& stream, message< isRequest, Body, Fields >& msg); ``[''''&raquo;''' [link beast.ref.boost__beast__http__write.overload3 more...]]`` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t ``[link beast.ref.boost__beast__http__write.overload4 write]``( SyncWriteStream& stream, message< isRequest, Body, Fields > const& msg); ``[''''&raquo;''' [link beast.ref.boost__beast__http__write.overload4 more...]]`` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t ``[link beast.ref.boost__beast__http__write.overload5 write]``( SyncWriteStream& stream, message< isRequest, Body, Fields >& msg, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__http__write.overload5 more...]]`` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t ``[link beast.ref.boost__beast__http__write.overload6 write]``( SyncWriteStream& stream, message< isRequest, Body, Fields > const& msg, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__http__write.overload6 more...]]`` ``` [section:overload1 http::write (1 of 6 overloads)]
  4213. Write a complete message to a stream using a serializer. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t write( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr); ``` [heading Description]
  4214. This function is used to write a complete message to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:
  4215. * The function [link beast.ref.boost__beast__http__serializer.is_done `http::serializer::is_done`] returns `true`
  4216. * An error occurs.
  4217. This operation is implemented in terms of one or more calls to the stream's `write_some` function.
  4218. [heading Parameters] [table [[Name][Description]] [[`stream`][
  4219. The stream to which the data is to be written. The type must support the ['SyncWriteStream] concept. ]] [[`sr`][
  4220. The serializer to use. ]] ]
  4221. [heading Return Value]
  4222. The number of bytes written to the stream.
  4223. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  4224. Thrown on failure. ]] ]
  4225. [heading See Also]
  4226. [link beast.ref.boost__beast__http__serializer `http::serializer`]
  4227. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::write (2 of 6 overloads)]
  4228. Write a complete message to a stream using a serializer. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t write( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr, error_code& ec); ``` [heading Description]
  4229. This function is used to write a complete message to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:
  4230. * The function [link beast.ref.boost__beast__http__serializer.is_done `http::serializer::is_done`] returns `true`
  4231. * An error occurs.
  4232. This operation is implemented in terms of one or more calls to the stream's `write_some` function.
  4233. [heading Parameters] [table [[Name][Description]] [[`stream`][
  4234. The stream to which the data is to be written. The type must support the ['SyncWriteStream] concept. ]] [[`sr`][
  4235. The serializer to use. ]] [[`ec`][
  4236. Set to the error, if any occurred. ]] ]
  4237. [heading Return Value]
  4238. The number of bytes written to the stream.
  4239. [heading See Also]
  4240. [link beast.ref.boost__beast__http__serializer `http::serializer`]
  4241. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload3 http::write (3 of 6 overloads)]
  4242. Write a complete message to a stream. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t write( SyncWriteStream& stream, message< isRequest, Body, Fields >& msg); ``` [heading Description]
  4243. This function is used to write a complete message to a stream using HTTP/1. The call will block until one of the following conditions is true:
  4244. * The entire message is written.
  4245. * An error occurs.
  4246. This operation is implemented in terms of one or more calls to the stream's `write_some` function. The algorithm will use a temporary [link beast.ref.boost__beast__http__serializer `http::serializer`] with an empty chunk decorator to produce buffers.
  4247. [heading Remarks]
  4248. This function only participates in overload resolution if [link beast.ref.boost__beast__http__is_mutable_body_writer `http::is_mutable_body_writer`] for ['Body] returns `true`.
  4249. [heading Parameters] [table [[Name][Description]] [[`stream`][
  4250. The stream to which the data is to be written. The type must support the ['SyncWriteStream] concept. ]] [[`msg`][
  4251. The message to write. ]] ]
  4252. [heading Return Value]
  4253. The number of bytes written to the stream.
  4254. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  4255. Thrown on failure. ]] ]
  4256. [heading See Also]
  4257. [link beast.ref.boost__beast__http__message `http::message`]
  4258. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload4 http::write (4 of 6 overloads)]
  4259. Write a complete message to a stream. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t write( SyncWriteStream& stream, message< isRequest, Body, Fields > const& msg); ``` [heading Description]
  4260. This function is used to write a complete message to a stream using HTTP/1. The call will block until one of the following conditions is true:
  4261. * The entire message is written.
  4262. * An error occurs.
  4263. This operation is implemented in terms of one or more calls to the stream's `write_some` function. The algorithm will use a temporary [link beast.ref.boost__beast__http__serializer `http::serializer`] with an empty chunk decorator to produce buffers.
  4264. [heading Remarks]
  4265. This function only participates in overload resolution if [link beast.ref.boost__beast__http__is_mutable_body_writer `http::is_mutable_body_writer`] for ['Body] returns `false`.
  4266. [heading Parameters] [table [[Name][Description]] [[`stream`][
  4267. The stream to which the data is to be written. The type must support the ['SyncWriteStream] concept. ]] [[`msg`][
  4268. The message to write. ]] ]
  4269. [heading Return Value]
  4270. The number of bytes written to the stream.
  4271. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  4272. Thrown on failure. ]] ]
  4273. [heading See Also]
  4274. [link beast.ref.boost__beast__http__message `http::message`]
  4275. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload5 http::write (5 of 6 overloads)]
  4276. Write a complete message to a stream. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t write( SyncWriteStream& stream, message< isRequest, Body, Fields >& msg, error_code& ec); ``` [heading Description]
  4277. This function is used to write a complete message to a stream using HTTP/1. The call will block until one of the following conditions is true:
  4278. * The entire message is written.
  4279. * An error occurs.
  4280. This operation is implemented in terms of one or more calls to the stream's `write_some` function. The algorithm will use a temporary [link beast.ref.boost__beast__http__serializer `http::serializer`] with an empty chunk decorator to produce buffers.
  4281. [heading Remarks]
  4282. This function only participates in overload resolution if [link beast.ref.boost__beast__http__is_mutable_body_writer `http::is_mutable_body_writer`] for ['Body] returns `true`.
  4283. [heading Parameters] [table [[Name][Description]] [[`stream`][
  4284. The stream to which the data is to be written. The type must support the ['SyncWriteStream] concept. ]] [[`msg`][
  4285. The message to write. ]] [[`ec`][
  4286. Set to the error, if any occurred. ]] ]
  4287. [heading Return Value]
  4288. The number of bytes written to the stream.
  4289. [heading See Also]
  4290. [link beast.ref.boost__beast__http__message `http::message`]
  4291. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload6 http::write (6 of 6 overloads)]
  4292. Write a complete message to a stream. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t write( SyncWriteStream& stream, message< isRequest, Body, Fields > const& msg, error_code& ec); ``` [heading Description]
  4293. This function is used to write a complete message to a stream using HTTP/1. The call will block until one of the following conditions is true:
  4294. * The entire message is written.
  4295. * An error occurs.
  4296. This operation is implemented in terms of one or more calls to the stream's `write_some` function. The algorithm will use a temporary [link beast.ref.boost__beast__http__serializer `http::serializer`] with an empty chunk decorator to produce buffers.
  4297. [heading Remarks]
  4298. This function only participates in overload resolution if [link beast.ref.boost__beast__http__is_mutable_body_writer `http::is_mutable_body_writer`] for ['Body] returns `false`.
  4299. [heading Parameters] [table [[Name][Description]] [[`stream`][
  4300. The stream to which the data is to be written. The type must support the ['SyncWriteStream] concept. ]] [[`msg`][
  4301. The message to write. ]] [[`ec`][
  4302. Set to the error, if any occurred. ]] ]
  4303. [heading Return Value]
  4304. The number of bytes written to the stream.
  4305. [heading See Also]
  4306. [link beast.ref.boost__beast__http__message `http::message`]
  4307. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__write_header http::write_header] [indexterm1 http::write_header]
  4308. Write a header to a stream using a serializer. ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t ``[link beast.ref.boost__beast__http__write_header.overload1 write_header]``( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr); ``[''''&raquo;''' [link beast.ref.boost__beast__http__write_header.overload1 more...]]`` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t ``[link beast.ref.boost__beast__http__write_header.overload2 write_header]``( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__http__write_header.overload2 more...]]`` ``` [section:overload1 http::write_header (1 of 2 overloads)]
  4309. Write a header to a stream using a serializer. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t write_header( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr); ``` [heading Description]
  4310. This function is used to write a header to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:
  4311. * The function [link beast.ref.boost__beast__http__serializer.is_header_done `http::serializer::is_header_done`] returns `true`
  4312. * An error occurs.
  4313. This operation is implemented in terms of one or more calls to the stream's `write_some` function.
  4314. [heading Parameters] [table [[Name][Description]] [[`stream`][
  4315. The stream to which the data is to be written. The type must support the ['SyncWriteStream] concept. ]] [[`sr`][
  4316. The serializer to use. ]] ]
  4317. [heading Return Value]
  4318. The number of bytes written to the stream.
  4319. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  4320. Thrown on failure. ]] ]
  4321. [heading Remarks]
  4322. The implementation will call [link beast.ref.boost__beast__http__serializer.split `http::serializer::split`] with the value `true` on the serializer passed in.
  4323. [heading See Also]
  4324. [link beast.ref.boost__beast__http__serializer `http::serializer`]
  4325. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::write_header (2 of 2 overloads)]
  4326. Write a header to a stream using a serializer. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t write_header( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr, error_code& ec); ``` [heading Description]
  4327. This function is used to write a header to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:
  4328. * The function [link beast.ref.boost__beast__http__serializer.is_header_done `http::serializer::is_header_done`] returns `true`
  4329. * An error occurs.
  4330. This operation is implemented in terms of one or more calls to the stream's `write_some` function.
  4331. [heading Parameters] [table [[Name][Description]] [[`stream`][
  4332. The stream to which the data is to be written. The type must support the ['SyncWriteStream] concept. ]] [[`sr`][
  4333. The serializer to use. ]] [[`ec`][
  4334. Set to indicate what error occurred, if any. ]] ]
  4335. [heading Return Value]
  4336. The number of bytes written to the stream.
  4337. [heading Remarks]
  4338. The implementation will call [link beast.ref.boost__beast__http__serializer.split `http::serializer::split`] with the value `true` on the serializer passed in.
  4339. [heading See Also]
  4340. [link beast.ref.boost__beast__http__serializer `http::serializer`]
  4341. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__http__write_some http::write_some] [indexterm1 http::write_some]
  4342. Write part of a message to a stream using a serializer. ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t ``[link beast.ref.boost__beast__http__write_some.overload1 write_some]``( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr); ``[''''&raquo;''' [link beast.ref.boost__beast__http__write_some.overload1 more...]]`` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t ``[link beast.ref.boost__beast__http__write_some.overload2 write_some]``( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__http__write_some.overload2 more...]]`` ``` [section:overload1 http::write_some (1 of 2 overloads)]
  4343. Write part of a message to a stream using a serializer. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t write_some( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr); ``` [heading Description]
  4344. This function is used to write part of a message to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:
  4345. * One or more bytes have been transferred.
  4346. * The function [link beast.ref.boost__beast__http__serializer.is_done `http::serializer::is_done`] returns `true`
  4347. * An error occurs on the stream.
  4348. This operation is implemented in terms of one or more calls to the stream's `write_some` function.
  4349. The amount of data actually transferred is controlled by the behavior of the underlying stream, subject to the buffer size limit of the serializer obtained or set through a call to [link beast.ref.boost__beast__http__serializer.limit `http::serializer::limit`]. Setting a limit and performing bounded work helps applications set reasonable timeouts. It also allows application-level flow control to function correctly. For example when using a TCP/IP based stream.
  4350. [heading Parameters] [table [[Name][Description]] [[`stream`][
  4351. The stream to which the data is to be written. The type must support the ['SyncWriteStream] concept. ]] [[`sr`][
  4352. The serializer to use. ]] ]
  4353. [heading Return Value]
  4354. The number of bytes written to the stream.
  4355. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  4356. Thrown on failure. ]] ]
  4357. [heading See Also]
  4358. [link beast.ref.boost__beast__http__serializer `http::serializer`]
  4359. Convenience header [include_file boost/beast/http.hpp] [endsect] [section:overload2 http::write_some (2 of 2 overloads)]
  4360. Write part of a message to a stream using a serializer. [heading Synopsis] Defined in header [include_file boost/beast/http/write.hpp] ``` template< class __SyncWriteStream__, bool isRequest, class __Body__, class __Fields__> std::size_t write_some( SyncWriteStream& stream, serializer< isRequest, Body, Fields >& sr, error_code& ec); ``` [heading Description]
  4361. This function is used to write part of a message to a stream using a caller-provided HTTP/1 serializer. The call will block until one of the following conditions is true:
  4362. * One or more bytes have been transferred.
  4363. * The function [link beast.ref.boost__beast__http__serializer.is_done `http::serializer::is_done`] returns `true`
  4364. * An error occurs on the stream.
  4365. This operation is implemented in terms of one or more calls to the stream's `write_some` function.
  4366. The amount of data actually transferred is controlled by the behavior of the underlying stream, subject to the buffer size limit of the serializer obtained or set through a call to [link beast.ref.boost__beast__http__serializer.limit `http::serializer::limit`]. Setting a limit and performing bounded work helps applications set reasonable timeouts. It also allows application-level flow control to function correctly. For example when using a TCP/IP based stream.
  4367. [heading Parameters] [table [[Name][Description]] [[`stream`][
  4368. The stream to which the data is to be written. The type must support the ['SyncWriteStream] concept. ]] [[`sr`][
  4369. The serializer to use. ]] [[`ec`][
  4370. Set to indicate what error occurred, if any. ]] ]
  4371. [heading Return Value]
  4372. The number of bytes written to the stream.
  4373. [heading See Also]
  4374. [link beast.ref.boost__beast__http__async_write_some `http::async_write_some`], [link beast.ref.boost__beast__http__serializer `http::serializer`]
  4375. Convenience header [include_file boost/beast/http.hpp] [endsect] [endsect] [section:boost__beast__iequal iequal]
  4376. A case-insensitive equality predicate for strings. [heading Synopsis] Defined in header [include_file boost/beast/core/string.hpp] ``` struct iequal ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__iequal.operator_lp__rp_ [*operator()]]] [ ] ] ] [heading Description]
  4377. The case-comparison operation is defined only for low-ASCII characters. [section:operator_lp__rp_ iequal::operator()] [indexterm2 operator()..iequal] [heading Synopsis] ``` bool operator()( string_view lhs, string_view rhs) const; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__iequals iequals] [indexterm1 iequals]
  4378. Returns `true` if two strings are equal, using a case-insensitive comparison. [heading Synopsis] Defined in header [include_file boost/beast/core/string.hpp] ``` bool iequals( beast::string_view lhs, beast::string_view rhs); ``` [heading Description]
  4379. The case-comparison operation is defined only for low-ASCII characters.
  4380. [heading Parameters] [table [[Name][Description]] [[`lhs`][
  4381. The string on the left side of the equality ]] [[`rhs`][
  4382. The string on the right side of the equality ]] ]
  4383. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__iless iless]
  4384. A case-insensitive less predicate for strings. [heading Synopsis] Defined in header [include_file boost/beast/core/string.hpp] ``` struct iless ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__iless.operator_lp__rp_ [*operator()]]] [ ] ] ] [heading Description]
  4385. The case-comparison operation is defined only for low-ASCII characters. [section:operator_lp__rp_ iless::operator()] [indexterm2 operator()..iless] [heading Synopsis] ``` bool operator()( string_view lhs, string_view rhs) const; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__is_async_read_stream is_async_read_stream] [indexterm1 is_async_read_stream]
  4386. Determine if `T` meets the requirements of ['AsyncReadStream]. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class T> using is_async_read_stream = ``['see-below]``; ``` [heading Description]
  4387. Metafunctions are used to perform compile time checking of template types. This type will be `std::true_type` if `T` meets the requirements, else the type will be `std::false_type`.
  4388. [heading Example]
  4389. Use with `static_assert`:
  4390. ``` template<class AsyncReadStream>
  4391. void f(AsyncReadStream& stream)
  4392. {
  4393. static_assert(is_async_read_stream<AsyncReadStream>::value,
  4394. "AsyncReadStream type requirements not met");
  4395. ...
  4396. ```
  4397. Use with `std::enable_if` (SFINAE):
  4398. ``` template<class AsyncReadStream>
  4399. typename std::enable_if<is_async_read_stream<AsyncReadStream>::value>::type
  4400. f(AsyncReadStream& stream);
  4401. ``` Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__is_async_stream is_async_stream] [indexterm1 is_async_stream]
  4402. Determine if `T` meets the requirements of [*AsyncStream]. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class T> using is_async_stream = ``['see-below]``; ``` [heading Description]
  4403. Metafunctions are used to perform compile time checking of template types. This type will be `std::true_type` if `T` meets the requirements, else the type will be `std::false_type`.
  4404. [heading Example]
  4405. Use with `static_assert`:
  4406. ``` template<class AsyncStream>
  4407. void f(AsyncStream& stream)
  4408. {
  4409. static_assert(is_async_stream<AsyncStream>::value,
  4410. "AsyncStream type requirements not met");
  4411. ...
  4412. ```
  4413. Use with `std::enable_if` (SFINAE):
  4414. ``` template<class AsyncStream>
  4415. typename std::enable_if<is_async_stream<AsyncStream>::value>::type
  4416. f(AsyncStream& stream);
  4417. ``` Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__is_async_write_stream is_async_write_stream] [indexterm1 is_async_write_stream]
  4418. Determine if `T` meets the requirements of ['AsyncWriteStream]. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class T> using is_async_write_stream = ``['see-below]``; ``` [heading Description]
  4419. Metafunctions are used to perform compile time checking of template types. This type will be `std::true_type` if `T` meets the requirements, else the type will be `std::false_type`.
  4420. [heading Example]
  4421. Use with `static_assert`:
  4422. ``` template<class AsyncWriteStream>
  4423. void f(AsyncWriteStream& stream)
  4424. {
  4425. static_assert(is_async_write_stream<AsyncWriteStream>::value,
  4426. "AsyncWriteStream type requirements not met");
  4427. ...
  4428. ```
  4429. Use with `std::enable_if` (SFINAE):
  4430. ``` template<class AsyncWriteStream>
  4431. typename std::enable_if<is_async_write_stream<AsyncWriteStream>::value>::type
  4432. f(AsyncWriteStream& stream);
  4433. ``` Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__is_const_buffer_sequence is_const_buffer_sequence] [indexterm1 is_const_buffer_sequence]
  4434. Determine if a list of types satisfy the ['ConstBufferSequence] requirements. [heading Synopsis] Defined in header [include_file boost/beast/core/buffer_traits.hpp] ``` template< class... __BufferSequence__> using is_const_buffer_sequence = ``['see-below]``; ``` [heading Description]
  4435. This metafunction is used to determine if all of the specified types meet the requirements for constant buffer sequences. This type alias will be `std::true_type` if each specified type meets the requirements, otherwise, this type alias will be `std::false_type`.
  4436. [heading Template Parameters] [table [[Type][Description]] [[`BufferSequence`][
  4437. A list of zero or more types to check. If this list is empty, the resulting type alias will be `std::true_type`. ]] ]
  4438. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__is_file is_file]
  4439. Determine if `T` meets the requirements of ['File]. [heading Synopsis] Defined in header [include_file boost/beast/core/file_base.hpp] ``` template< class T> struct is_file : public std::integral_constant< bool,... > ``` [heading Description]
  4440. Metafunctions are used to perform compile time checking of template types. This type will be `std::true_type` if `T` meets the requirements, else the type will be `std::false_type`.
  4441. [heading Example]
  4442. Use with `static_assert`:
  4443. ``` template<class File>
  4444. void f(File& file)
  4445. {
  4446. static_assert(is_file<File>::value,
  4447. "File type requirements not met");
  4448. ...
  4449. ```
  4450. Use with `std::enable_if` (SFINAE):
  4451. ``` template<class File>
  4452. typename std::enable_if<is_file<File>::value>::type
  4453. f(File& file);
  4454. ``` Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__is_mutable_buffer_sequence is_mutable_buffer_sequence] [indexterm1 is_mutable_buffer_sequence]
  4455. Determine if a list of types satisfy the ['MutableBufferSequence] requirements. [heading Synopsis] Defined in header [include_file boost/beast/core/buffer_traits.hpp] ``` template< class... __BufferSequence__> using is_mutable_buffer_sequence = ``['see-below]``; ``` [heading Description]
  4456. This metafunction is used to determine if all of the specified types meet the requirements for mutable buffer sequences. This type alias will be `std::true_type` if each specified type meets the requirements, otherwise, this type alias will be `std::false_type`.
  4457. [heading Template Parameters] [table [[Type][Description]] [[`BufferSequence`][
  4458. A list of zero or more types to check. If this list is empty, the resulting type alias will be `std::true_type`. ]] ]
  4459. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__is_sync_read_stream is_sync_read_stream] [indexterm1 is_sync_read_stream]
  4460. Determine if at type meets the requirements of ['SyncReadStream]. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class T> using is_sync_read_stream = ``['see-below]``; ``` [heading Description]
  4461. Metafunctions are used to perform compile time checking of template types. This type will be `std::true_type` if `T` meets the requirements, else the type will be `std::false_type`.
  4462. [heading Example]
  4463. Use with `static_assert`: ``` template<class SyncReadStream>
  4464. void f(SyncReadStream& stream)
  4465. {
  4466. static_assert(is_sync_read_stream<SyncReadStream>::value,
  4467. "SyncReadStream type requirements not met");
  4468. ...
  4469. ```
  4470. Use with `std::enable_if` (SFINAE): ``` template<class SyncReadStream>
  4471. typename std::enable_if<is_sync_read_stream<SyncReadStream>::value>::type
  4472. f(SyncReadStream& stream);
  4473. ``` Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__is_sync_stream is_sync_stream] [indexterm1 is_sync_stream]
  4474. Determine if `T` meets the requirements of [*SyncStream]. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class T> using is_sync_stream = ``['see-below]``; ``` [heading Description]
  4475. Metafunctions are used to perform compile time checking of template types. This type will be `std::true_type` if `T` meets the requirements, else the type will be `std::false_type`.
  4476. [heading Example]
  4477. Use with `static_assert`:
  4478. ``` template<class SyncStream>
  4479. void f(SyncStream& stream)
  4480. {
  4481. static_assert(is_sync_stream<SyncStream>::value,
  4482. "SyncStream type requirements not met");
  4483. ...
  4484. ```
  4485. Use with `std::enable_if` (SFINAE):
  4486. ``` template<class SyncStream>
  4487. typename std::enable_if<is_sync_stream<SyncStream>::value>::type
  4488. f(SyncStream& stream);
  4489. ``` Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__is_sync_write_stream is_sync_write_stream] [indexterm1 is_sync_write_stream]
  4490. Determine if `T` meets the requirements of ['SyncWriteStream]. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class T> using is_sync_write_stream = ``['see-below]``; ``` [heading Description]
  4491. Metafunctions are used to perform compile time checking of template types. This type will be `std::true_type` if `T` meets the requirements, else the type will be `std::false_type`.
  4492. [heading Example]
  4493. Use with `static_assert`:
  4494. ``` template<class SyncReadStream>
  4495. void f(SyncReadStream& stream)
  4496. {
  4497. static_assert(is_sync_read_stream<SyncReadStream>::value,
  4498. "SyncReadStream type requirements not met");
  4499. ...
  4500. ```
  4501. Use with `std::enable_if` (SFINAE):
  4502. ``` template<class SyncReadStream>
  4503. typename std::enable_if<is_sync_read_stream<SyncReadStream>::value>::type
  4504. f(SyncReadStream& stream);
  4505. ``` Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__lowest_layer_type lowest_layer_type] [indexterm1 lowest_layer_type]
  4506. A trait to determine the lowest layer type of a stack of stream layers. [heading Synopsis] Defined in header [include_file boost/beast/core/stream_traits.hpp] ``` template< class T> using lowest_layer_type = ``['see-below]``; ``` [heading Description]
  4507. If `t.next_layer()` is well-defined for an object `t` of type `T`, then `lowest_layer_type<T>` will be an alias for `lowest_layer_type<decltype(t.next_layer())>`, otherwise it will be the type `std::remove_reference<T>`.
  4508. [heading Parameters] [table [[Name][Description]] [[`T`][
  4509. The type to determine the lowest layer type of. ]] ]
  4510. [heading Return Value]
  4511. The type of the lowest layer.
  4512. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__make_printable make_printable] [indexterm1 make_printable]
  4513. Helper to permit a buffer sequence to be printed to a std::ostream. [heading Synopsis] Defined in header [include_file boost/beast/core/make_printable.hpp] ``` template< class __ConstBufferSequence__> ``['implementation-defined]`` make_printable( ConstBufferSequence const& buffers); ``` [heading Description]
  4514. This function is used to wrap a buffer sequence to allow it to be interpreted as characters and written to a `std::ostream` such as `std::cout`. No character translation is performed; unprintable and null characters will be transferred as-is to the output stream.
  4515. [heading Example]
  4516. This function prints the size and contents of a buffer sequence to standard output: ``` template <class ConstBufferSequence>
  4517. void
  4518. print (ConstBufferSequence const& buffers)
  4519. {
  4520. std::cout <<
  4521. "Buffer size: " << buffer_bytes(buffers) << " bytes\n"
  4522. "Buffer data: '" << make_printable(buffers) << "'\n";
  4523. }
  4524. ```
  4525. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  4526. An object meeting the requirements of ['ConstBufferSequence] to be streamed. The implementation will make a copy of this object. Ownership of the underlying memory is not transferred, the application is still responsible for managing its lifetime. ]] ]
  4527. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__multi_buffer multi_buffer] [indexterm1 multi_buffer]
  4528. A typical multi buffer. [heading Synopsis] Defined in header [include_file boost/beast/core/multi_buffer.hpp] ``` using multi_buffer = basic_multi_buffer< std::allocator< char > >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_multi_buffer.allocator_type [*allocator_type]]] [ The type of allocator used. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.const_buffers_type [*const_buffers_type]]] [ The ConstBufferSequence used to represent the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.mutable_buffers_type [*mutable_buffers_type]]] [ The MutableBufferSequence used to represent the writable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.mutable_data_type [*mutable_data_type]]] [ The MutableBufferSequence used to represent the readable bytes. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer [*basic_multi_buffer]]] [ Constructor. Move Constructor. Copy Constructor. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.capacity [*capacity]]] [ Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.cdata [*cdata]]] [ Returns a constant buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.clear [*clear]]] [ Set the size of the readable and writable bytes to zero. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.commit [*commit]]] [ Append writable bytes to the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.consume [*consume]]] [ Remove bytes from beginning of the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.data [*data]]] [ Returns a constant buffer sequence representing the readable bytes. Returns a mutable buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.get_allocator [*get_allocator]]] [ Returns a copy of the allocator used. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.max_size [*max_size]]] [ Set the maximum allowed capacity. Return the maximum number of bytes, both readable and writable, that can ever be held. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.operator_eq_ [*operator=]]] [ Move Assignment. Copy Assignment. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.prepare [*prepare]]] [ Returns a mutable buffer sequence representing writable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.reserve [*reserve]]] [ Guarantee a minimum capacity. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.shrink_to_fit [*shrink_to_fit]]] [ Reallocate the buffer to fit the readable bytes exactly. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.size [*size]]] [ Returns the number of readable bytes. ] ] [ [[link beast.ref.boost__beast__basic_multi_buffer.basic_multi_buffer_dtor_ [*~basic_multi_buffer]]] [ Destructor. ] ] ] [heading Friends] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_multi_buffer.swap [*swap]]] [ Exchange two dynamic buffers. ] ] ]
  4529. A dynamic buffer encapsulates memory storage that may be automatically resized as required, where the memory is divided into two regions: readable bytes followed by writable bytes. These memory regions are internal to the dynamic buffer, but direct access to the elements is provided to permit them to be efficiently used with I/O operations.
  4530. The implementation uses a sequence of one or more byte arrays of varying sizes to represent the readable and writable bytes. Additional byte array objects are appended to the sequence to accommodate changes in the desired size. The behavior and implementation of this container is most similar to `std::deque`.
  4531. Objects of this type meet the requirements of ['DynamicBuffer] and have the following additional properties:
  4532. * A mutable buffer sequence representing the readable bytes is returned by [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] when `this` is non-const.
  4533. * Buffer sequences representing the readable and writable bytes, returned by [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] and [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`], may have length greater than one.
  4534. * A configurable maximum size may be set upon construction and adjusted afterwards. Calls to [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] that would exceed this size will throw `std::length_error`.
  4535. * Sequences previously obtained using [link beast.ref.boost__beast__basic_multi_buffer.data `basic_multi_buffer::data`] remain valid after calls to [link beast.ref.boost__beast__basic_multi_buffer.prepare `basic_multi_buffer::prepare`] or [link beast.ref.boost__beast__basic_multi_buffer.commit `basic_multi_buffer::commit`].
  4536. [heading Template Parameters] [table [[Type][Description]] [[`Allocator`][
  4537. The allocator to use for managing memory. ]] ]
  4538. [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__operator_not__eq_ operator!=] [indexterm1 operator!=] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_not__eq_.overload1 operator!=]``( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_not__eq_.overload1 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_not__eq_.overload2 operator!=]``( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_not__eq_.overload2 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_not__eq_.overload3 operator!=]``( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_not__eq_.overload3 more...]]`` ``` [section:overload1 operator!= (1 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool operator!=( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload2 operator!= (2 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator!=( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload3 operator!= (3 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator!=( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [endsect] [section:boost__beast__operator_plus_ operator+] [indexterm1 operator+] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> void ``[link beast.ref.boost__beast__operator_plus_.overload1 operator+]``( static_string< N, CharT, Traits >const&, static_string< M, CharT, Traits >const&); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_plus_.overload1 more...]]`` template< std::size_t N, class CharT, class Traits> void ``[link beast.ref.boost__beast__operator_plus_.overload2 operator+]``( CharT const*, static_string< N, CharT, Traits >const&); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_plus_.overload2 more...]]`` template< std::size_t N, class CharT, class Traits> void ``[link beast.ref.boost__beast__operator_plus_.overload3 operator+]``( CharT, static_string< N, CharT, Traits > const&); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_plus_.overload3 more...]]`` template< std::size_t N, class CharT, class Traits> void ``[link beast.ref.boost__beast__operator_plus_.overload4 operator+]``( static_string< N, CharT, Traits > const&, CharT const*); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_plus_.overload4 more...]]`` template< std::size_t N, class CharT, class Traits> void ``[link beast.ref.boost__beast__operator_plus_.overload5 operator+]``( static_string< N, CharT, Traits > const&, CharT); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_plus_.overload5 more...]]`` ``` [section:overload1 operator+ (1 of 5 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> void operator+( static_string< N, CharT, Traits >const&, static_string< M, CharT, Traits >const&); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload2 operator+ (2 of 5 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> void operator+( CharT const*, static_string< N, CharT, Traits >const&); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload3 operator+ (3 of 5 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> void operator+( CharT, static_string< N, CharT, Traits > const&); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload4 operator+ (4 of 5 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> void operator+( static_string< N, CharT, Traits > const&, CharT const*); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload5 operator+ (5 of 5 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> void operator+( static_string< N, CharT, Traits > const&, CharT); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [endsect] [section:boost__beast__operator_lt_ operator<] [indexterm1 operator<] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_lt_.overload1 operator<]``( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_lt_.overload1 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_lt_.overload2 operator<]``( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_lt_.overload2 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_lt_.overload3 operator<]``( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_lt_.overload3 more...]]`` ``` [section:overload1 operator< (1 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool operator<( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload2 operator< (2 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator<( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload3 operator< (3 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator<( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [endsect] [section:boost__beast__operator_lt__lt_ operator<<] [indexterm1 operator<<] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> std::basic_ostream< CharT, Traits >& operator<<( std::basic_ostream< CharT, Traits >& os, static_string< N, CharT, Traits > const& str); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__operator_lt__eq_ operator<=] [indexterm1 operator<=] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_lt__eq_.overload1 operator<=]``( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_lt__eq_.overload1 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_lt__eq_.overload2 operator<=]``( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_lt__eq_.overload2 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_lt__eq_.overload3 operator<=]``( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_lt__eq_.overload3 more...]]`` ``` [section:overload1 operator<= (1 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool operator<=( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload2 operator<= (2 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator<=( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload3 operator<= (3 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator<=( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [endsect] [section:boost__beast__operator_eq__eq_ operator==] [indexterm1 operator==] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_eq__eq_.overload1 operator==]``( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_eq__eq_.overload1 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_eq__eq_.overload2 operator==]``( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_eq__eq_.overload2 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_eq__eq_.overload3 operator==]``( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_eq__eq_.overload3 more...]]`` ``` [section:overload1 operator== (1 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool operator==( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload2 operator== (2 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator==( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload3 operator== (3 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator==( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [endsect] [section:boost__beast__operator_gt_ operator>] [indexterm1 operator>] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_gt_.overload1 operator>]``( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_gt_.overload1 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_gt_.overload2 operator>]``( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_gt_.overload2 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_gt_.overload3 operator>]``( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_gt_.overload3 more...]]`` ``` [section:overload1 operator> (1 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool operator>( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload2 operator> (2 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator>( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload3 operator> (3 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator>( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [endsect] [section:boost__beast__operator_gt__eq_ operator>=] [indexterm1 operator>=] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_gt__eq_.overload1 operator>=]``( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_gt__eq_.overload1 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_gt__eq_.overload2 operator>=]``( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_gt__eq_.overload2 more...]]`` template< std::size_t N, class CharT, class Traits> bool ``[link beast.ref.boost__beast__operator_gt__eq_.overload3 operator>=]``( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__operator_gt__eq_.overload3 more...]]`` ``` [section:overload1 operator>= (1 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> bool operator>=( static_string< N, CharT, Traits > const& lhs, static_string< M, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload2 operator>= (2 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator>=( CharT const* lhs, static_string< N, CharT, Traits > const& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload3 operator>= (3 of 3 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> bool operator>=( static_string< N, CharT, Traits > const& lhs, CharT const* rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [endsect] [section:boost__beast__ostream ostream] [indexterm1 ostream]
  4539. Return an output stream that formats values into a ['DynamicBuffer]. [heading Synopsis] Defined in header [include_file boost/beast/core/ostream.hpp] ``` template< class __DynamicBuffer__> ``['implementation-defined]`` ostream( DynamicBuffer& buffer); ``` [heading Description]
  4540. This function wraps the caller provided ['DynamicBuffer] into a `std::ostream` derived class, to allow `operator<<` stream style formatting operations.
  4541. [heading Example]
  4542. ``` ostream(buffer) << "Hello, world!" << std::endl;
  4543. ```
  4544. [heading Remarks]
  4545. Calling members of the underlying buffer before the output stream is destroyed results in undefined behavior.
  4546. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  4547. An object meeting the requirements of ['DynamicBuffer] into which the formatted output will be placed. ]] ]
  4548. [heading Return Value]
  4549. An object derived from `std::ostream` which redirects output The wrapped dynamic buffer is not modified, a copy is made instead. Ownership of the underlying memory is not transferred, the application is still responsible for managing its lifetime. The caller is responsible for ensuring the dynamic buffer is not destroyed for the lifetime of the output stream.
  4550. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__rate_policy_access rate_policy_access]
  4551. Helper class to assist implementing a ['RatePolicy]. [heading Synopsis] Defined in header [include_file boost/beast/core/rate_policy.hpp] ``` class rate_policy_access ``` [heading Description]
  4552. This class is used by the implementation to gain access to the private members of a user-defined object meeting the requirements of ['RatePolicy]. To use it, simply declare it as a friend in your class:
  4553. [heading Example]
  4554. ``` class custom_rate_policy
  4555. {
  4556. friend class beast::rate_policy_access;
  4557. ...
  4558. ```
  4559. [heading Concepts]
  4560. * ['RatePolicy]
  4561. [heading See Also]
  4562. [link beast.ref.boost__beast__basic_stream `basic_stream`]
  4563. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__read_size read_size] [indexterm1 read_size]
  4564. Returns a natural read size. [heading Synopsis] Defined in header [include_file boost/beast/core/read_size.hpp] ``` template< class __DynamicBuffer__> std::size_t read_size( DynamicBuffer& buffer, std::size_t max_size); ``` [heading Description]
  4565. This function inspects the capacity, size, and maximum size of the dynamic buffer. Then it computes a natural read size given the passed-in upper limit. It favors a read size that does not require a reallocation, subject to a reasonable minimum to avoid tiny reads.
  4566. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  4567. The dynamic buffer to inspect. ]] [[`max_size`][
  4568. An upper limit on the returned value. ]] ]
  4569. [heading Remarks]
  4570. If the buffer is already at its maximum size, zero is returned.
  4571. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__read_size_or_throw read_size_or_throw] [indexterm1 read_size_or_throw]
  4572. Returns a natural read size or throw if the buffer is full. [heading Synopsis] Defined in header [include_file boost/beast/core/read_size.hpp] ``` template< class __DynamicBuffer__> std::size_t read_size_or_throw( DynamicBuffer& buffer, std::size_t max_size); ``` [heading Description]
  4573. This function inspects the capacity, size, and maximum size of the dynamic buffer. Then it computes a natural read size given the passed-in upper limit. It favors a read size that does not require a reallocation, subject to a reasonable minimum to avoid tiny reads.
  4574. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  4575. The dynamic buffer to inspect. ]] [[`max_size`][
  4576. An upper limit on the returned value. ]] ]
  4577. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  4578. if `max_size > 0` and the buffer is full. ]] ]
  4579. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__role_type role_type] [indexterm1 role_type]
  4580. The role of local or remote peer. [heading Synopsis] Defined in header [include_file boost/beast/core/role.hpp] ``` enum role_type ``` [indexterm2 client..role_type] [indexterm2 server..role_type] [heading Values] [table [[Name][Description]] [[[^client]][The stream is operating as a client. ]] [[[^server]][The stream is operating as a server. ]] ] [heading Description]
  4581. Whether the endpoint is a client or server affects the behavior of teardown. The teardown behavior also depends on the type of the stream being torn down.
  4582. The default implementation of teardown for regular TCP/IP sockets is as follows:
  4583. * In the client role, a TCP/IP shutdown is sent after reading all remaining data on the connection.
  4584. * In the server role, a TCP/IP shutdown is sent before reading all remaining data on the connection.
  4585. When the next layer type is a `net::ssl::stream`, the connection is closed by performing the SSL closing handshake corresponding to the role type, client or server. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__saved_handler saved_handler]
  4586. An invocable, nullary function object which holds a completion handler. [heading Synopsis] Defined in header [include_file boost/beast/core/saved_handler.hpp] ``` class saved_handler ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__saved_handler.emplace [*emplace]]] [ Store a completion handler in the container. ] ] [ [[link beast.ref.boost__beast__saved_handler.has_value [*has_value]]] [ Returns true if *this contains a completion handler. ] ] [ [[link beast.ref.boost__beast__saved_handler.invoke [*invoke]]] [ Unconditionally invoke the stored completion handler. ] ] [ [[link beast.ref.boost__beast__saved_handler.maybe_invoke [*maybe_invoke]]] [ Conditionally invoke the stored completion handler. ] ] [ [[link beast.ref.boost__beast__saved_handler.operator_eq_ [*operator=]]] [ Copy Assignment (deleted) Move Assignment. ] ] [ [[link beast.ref.boost__beast__saved_handler.reset [*reset]]] [ Discard the saved handler, if one exists. ] ] [ [[link beast.ref.boost__beast__saved_handler.saved_handler [*saved_handler]]] [ Default Constructor. Copy Constructor (deleted) Move Constructor. ] ] [ [[link beast.ref.boost__beast__saved_handler.saved_handler_dtor_ [*~saved_handler]]] [ Destructor. ] ] ] [heading Description]
  4587. This container can hold a type-erased instance of any completion handler, or it can be empty. When the container holds a value, the implementation maintains an instance of `net::executor_work_guard` for the handler's associated executor. Memory is dynamically allocated to store the completion handler, and the allocator may optionally be specified. Otherwise, the implementation uses the handler's associated allocator. [section:emplace saved_handler::emplace] [indexterm2 emplace..saved_handler]
  4588. Store a completion handler in the container. ``` template< class __Handler__, class __Allocator__> void ``[link beast.ref.boost__beast__saved_handler.emplace.overload1 emplace]``( Handler&& handler, Allocator const& alloc); ``[''''&raquo;''' [link beast.ref.boost__beast__saved_handler.emplace.overload1 more...]]`` template< class __Handler__> void ``[link beast.ref.boost__beast__saved_handler.emplace.overload2 emplace]``( Handler&& handler); ``[''''&raquo;''' [link beast.ref.boost__beast__saved_handler.emplace.overload2 more...]]`` ``` [section:overload1 saved_handler::emplace (1 of 2 overloads)]
  4589. Store a completion handler in the container. [heading Synopsis] ``` template< class __Handler__, class __Allocator__> void emplace( Handler&& handler, Allocator const& alloc); ``` [heading Description]
  4590. Requires `this->has_value() == false`.
  4591. [heading Parameters] [table [[Name][Description]] [[`handler`][
  4592. The completion handler to store. The implementation takes ownership of the handler by performing a decay-copy. ]] [[`alloc`][
  4593. The allocator to use. ]] ]
  4594. [endsect] [section:overload2 saved_handler::emplace (2 of 2 overloads)]
  4595. Store a completion handler in the container. [heading Synopsis] ``` template< class __Handler__> void emplace( Handler&& handler); ``` [heading Description]
  4596. Requires `this->has_value() == false`. The implementation will use the handler's associated allocator to obtian storage.
  4597. [heading Parameters] [table [[Name][Description]] [[`handler`][
  4598. The completion handler to store. The implementation takes ownership of the handler by performing a decay-copy. ]] ]
  4599. [endsect] [endsect] [section:has_value saved_handler::has_value] [indexterm2 has_value..saved_handler]
  4600. Returns `true` if `*this` contains a completion handler. [heading Synopsis] ``` bool has_value() const; ``` [heading Description] [endsect] [section:invoke saved_handler::invoke] [indexterm2 invoke..saved_handler]
  4601. Unconditionally invoke the stored completion handler. [heading Synopsis] ``` void invoke(); ``` [heading Description]
  4602. Requires `this->has_value() == true`. Any dynamic memory used is deallocated before the stored completion handler is invoked. The executor work guard is also reset before the invocation. [endsect] [section:maybe_invoke saved_handler::maybe_invoke] [indexterm2 maybe_invoke..saved_handler]
  4603. Conditionally invoke the stored completion handler. [heading Synopsis] ``` bool maybe_invoke(); ``` [heading Description]
  4604. Invokes the stored completion handler if `this->has_value() == true`, otherwise does nothing. Any dynamic memory used is deallocated before the stored completion handler is invoked. The executor work guard is also reset before the invocation.
  4605. [heading Return Value]
  4606. `true` if the invocation took place.
  4607. [endsect] [section:operator_eq_ saved_handler::operator=] [indexterm2 operator=..saved_handler]
  4608. Copy Assignment (deleted) ``` saved_handler& ``[link beast.ref.boost__beast__saved_handler.operator_eq_.overload1 operator=]``( saved_handler const&); ``[''''&raquo;''' [link beast.ref.boost__beast__saved_handler.operator_eq_.overload1 more...]]`` ```
  4609. Move Assignment. ``` saved_handler& ``[link beast.ref.boost__beast__saved_handler.operator_eq_.overload2 operator=]``( saved_handler&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__saved_handler.operator_eq_.overload2 more...]]`` ``` [section:overload1 saved_handler::operator= (1 of 2 overloads)]
  4610. Copy Assignment (deleted) [heading Synopsis] ``` saved_handler& operator=( saved_handler const&); ``` [heading Description] [endsect] [section:overload2 saved_handler::operator= (2 of 2 overloads)]
  4611. Move Assignment. [heading Synopsis] ``` saved_handler& operator=( saved_handler&& other); ``` [heading Description] [endsect] [endsect] [section:reset saved_handler::reset] [indexterm2 reset..saved_handler]
  4612. Discard the saved handler, if one exists. [heading Synopsis] ``` bool reset(); ``` [heading Description]
  4613. If `*this` contains an object, it is destroyed.
  4614. [heading Return Value]
  4615. `true` if an object was destroyed.
  4616. [endsect] [section:saved_handler saved_handler::saved_handler] [indexterm2 saved_handler..saved_handler]
  4617. Default Constructor. ``` ``[link beast.ref.boost__beast__saved_handler.saved_handler.overload1 saved_handler]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__saved_handler.saved_handler.overload1 more...]]`` ```
  4618. Copy Constructor (deleted) ``` ``[link beast.ref.boost__beast__saved_handler.saved_handler.overload2 saved_handler]``( saved_handler const&); ``[''''&raquo;''' [link beast.ref.boost__beast__saved_handler.saved_handler.overload2 more...]]`` ```
  4619. Move Constructor. ``` ``[link beast.ref.boost__beast__saved_handler.saved_handler.overload3 saved_handler]``( saved_handler&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__saved_handler.saved_handler.overload3 more...]]`` ``` [section:overload1 saved_handler::saved_handler (1 of 3 overloads)]
  4620. Default Constructor. [heading Synopsis] ``` saved_handler(); ``` [heading Description] [endsect] [section:overload2 saved_handler::saved_handler (2 of 3 overloads)]
  4621. Copy Constructor (deleted) [heading Synopsis] ``` saved_handler( saved_handler const&); ``` [heading Description] [endsect] [section:overload3 saved_handler::saved_handler (3 of 3 overloads)]
  4622. Move Constructor. [heading Synopsis] ``` saved_handler( saved_handler&& other); ``` [heading Description] [endsect] [endsect] [section:saved_handler_dtor_ saved_handler::~saved_handler] [indexterm2 ~saved_handler..saved_handler]
  4623. Destructor. [heading Synopsis] ``` ~saved_handler(); ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__saved_handler__impl saved_handler::impl] [heading Synopsis] Defined in header [include_file boost/beast/core/saved_handler.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2], [role red error.class-detail-template.1][role red error.class-detail-template.2]> class impl ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__simple_rate_policy simple_rate_policy]
  4624. A rate policy with simple, configurable limits on reads and writes. [heading Synopsis] Defined in header [include_file boost/beast/core/rate_policy.hpp] ``` class simple_rate_policy ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__simple_rate_policy.read_limit [*read_limit]]] [ Set the limit of bytes per second to read. ] ] [ [[link beast.ref.boost__beast__simple_rate_policy.write_limit [*write_limit]]] [ Set the limit of bytes per second to write. ] ] ] [heading Description]
  4625. This rate policy allows for simple individual limits on the amount of bytes per second allowed for reads and writes.
  4626. [heading Concepts]
  4627. * ['RatePolicy]
  4628. [heading See Also]
  4629. [link beast.ref.boost__beast__basic_stream `basic_stream`]
  4630. [section:read_limit simple_rate_policy::read_limit] [indexterm2 read_limit..simple_rate_policy]
  4631. Set the limit of bytes per second to read. [heading Synopsis] ``` void read_limit( std::size_t bytes_per_second); ``` [heading Description] [endsect] [section:write_limit simple_rate_policy::write_limit] [indexterm2 write_limit..simple_rate_policy]
  4632. Set the limit of bytes per second to write. [heading Synopsis] ``` void write_limit( std::size_t bytes_per_second); ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__span span]
  4633. A range of bytes expressed as a ContiguousContainer. [heading Synopsis] Defined in header [include_file boost/beast/core/span.hpp] ``` template< class T> class span ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__span.const_iterator [*const_iterator]]] [ The const iterator used by the container. ] ] [ [[link beast.ref.boost__beast__span.const_pointer [*const_pointer]]] [ The const pointer used by the container. ] ] [ [[link beast.ref.boost__beast__span.const_reference [*const_reference]]] [ The const reference used by the container. ] ] [ [[link beast.ref.boost__beast__span.element_type [*element_type]]] [ The type of value, including cv qualifiers. ] ] [ [[link beast.ref.boost__beast__span.index_type [*index_type]]] [ The type of integer used to index the span. ] ] [ [[link beast.ref.boost__beast__span.iterator [*iterator]]] [ The iterator used by the container. ] ] [ [[link beast.ref.boost__beast__span.pointer [*pointer]]] [ A pointer to a span element. ] ] [ [[link beast.ref.boost__beast__span.reference [*reference]]] [ A reference to a span element. ] ] [ [[link beast.ref.boost__beast__span.value_type [*value_type]]] [ The type of value of each span element. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__span.begin [*begin]]] [ Returns an iterator to the beginning of the span. ] ] [ [[link beast.ref.boost__beast__span.cbegin [*cbegin]]] [ Returns an iterator to the beginning of the span. ] ] [ [[link beast.ref.boost__beast__span.cend [*cend]]] [ Returns an iterator to one past the end of the span. ] ] [ [[link beast.ref.boost__beast__span.data [*data]]] [ Returns a pointer to the beginning of the span. ] ] [ [[link beast.ref.boost__beast__span.empty [*empty]]] [ Returns true if the span is empty. ] ] [ [[link beast.ref.boost__beast__span.end [*end]]] [ Returns an iterator to one past the end of the span. ] ] [ [[link beast.ref.boost__beast__span.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__span.size [*size]]] [ Returns the number of elements in the span. ] ] [ [[link beast.ref.boost__beast__span.span [*span]]] [ Constructor. ] ] ] [heading Description]
  4634. This class implements a non-owning reference to a storage area of a certain size and having an underlying integral type with size of 1.
  4635. [heading Template Parameters] [table [[Type][Description]] [[`T`][
  4636. The type pointed to by span iterators ]] ]
  4637. [section:begin span::begin] [indexterm2 begin..span]
  4638. Returns an iterator to the beginning of the span. [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [section:cbegin span::cbegin] [indexterm2 cbegin..span]
  4639. Returns an iterator to the beginning of the span. [heading Synopsis] ``` const_iterator cbegin() const; ``` [heading Description] [endsect] [section:cend span::cend] [indexterm2 cend..span]
  4640. Returns an iterator to one past the end of the span. [heading Synopsis] ``` const_iterator cend() const; ``` [heading Description] [endsect] [section:const_iterator span::const_iterator] [indexterm2 const_iterator..span]
  4641. The const iterator used by the container. [heading Synopsis] ``` using const_iterator = const_pointer; ``` [heading Description] [endsect] [section:const_pointer span::const_pointer] [indexterm2 const_pointer..span]
  4642. The const pointer used by the container. [heading Synopsis] ``` using const_pointer = T const *; ``` [heading Description] [endsect] [section:const_reference span::const_reference] [indexterm2 const_reference..span]
  4643. The const reference used by the container. [heading Synopsis] ``` using const_reference = T const &; ``` [heading Description] [endsect] [section:data span::data] [indexterm2 data..span]
  4644. Returns a pointer to the beginning of the span. [heading Synopsis] ``` T* data() const; ``` [heading Description] [endsect] [section:element_type span::element_type] [indexterm2 element_type..span]
  4645. The type of value, including cv qualifiers. [heading Synopsis] ``` using element_type = T; ``` [heading Description] [endsect] [section:empty span::empty] [indexterm2 empty..span]
  4646. Returns `true` if the span is empty. [heading Synopsis] ``` bool empty() const; ``` [heading Description] [endsect] [section:end span::end] [indexterm2 end..span]
  4647. Returns an iterator to one past the end of the span. [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [section:index_type span::index_type] [indexterm2 index_type..span]
  4648. The type of integer used to index the span. [heading Synopsis] ``` using index_type = std::ptrdiff_t; ``` [heading Description] [endsect] [section:iterator span::iterator] [indexterm2 iterator..span]
  4649. The iterator used by the container. [heading Synopsis] ``` using iterator = pointer; ``` [heading Description] [endsect] [section:operator_eq_ span::operator=] [indexterm2 operator=..span]
  4650. Assignment. ``` span& ``[link beast.ref.boost__beast__span.operator_eq_.overload1 operator=]``( span const&); ``[''''&raquo;''' [link beast.ref.boost__beast__span.operator_eq_.overload1 more...]]`` template< class ContiguousContainer> span& ``[link beast.ref.boost__beast__span.operator_eq_.overload2 operator=]``( ContiguousContainer&& container); ``[''''&raquo;''' [link beast.ref.boost__beast__span.operator_eq_.overload2 more...]]`` ``` [section:overload1 span::operator= (1 of 2 overloads)]
  4651. Assignment. [heading Synopsis] ``` span& operator=( span const&); ``` [heading Description] [endsect] [section:overload2 span::operator= (2 of 2 overloads)]
  4652. Assignment. [heading Synopsis] ``` template< class ContiguousContainer> span& operator=( ContiguousContainer&& container); ``` [heading Description]
  4653. [heading Parameters] [table [[Name][Description]] [[`container`][
  4654. The container to assign from ]] ]
  4655. [endsect] [endsect] [section:pointer span::pointer] [indexterm2 pointer..span]
  4656. A pointer to a span element. [heading Synopsis] ``` using pointer = T*; ``` [heading Description] [endsect] [section:reference span::reference] [indexterm2 reference..span]
  4657. A reference to a span element. [heading Synopsis] ``` using reference = T&; ``` [heading Description] [endsect] [section:size span::size] [indexterm2 size..span]
  4658. Returns the number of elements in the span. [heading Synopsis] ``` std::size_t size() const; ``` [heading Description] [endsect] [section:span span::span] [indexterm2 span..span]
  4659. Constructor. ``` ``[link beast.ref.boost__beast__span.span.overload1 span]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__span.span.overload1 more...]]`` ``[link beast.ref.boost__beast__span.span.overload2 span]``( span const&); ``[''''&raquo;''' [link beast.ref.boost__beast__span.span.overload2 more...]]`` ``[link beast.ref.boost__beast__span.span.overload3 span]``( T* data, std::size_t size); ``[''''&raquo;''' [link beast.ref.boost__beast__span.span.overload3 more...]]`` template< class ContiguousContainer> explicit ``[link beast.ref.boost__beast__span.span.overload4 span]``( ContiguousContainer&& container); ``[''''&raquo;''' [link beast.ref.boost__beast__span.span.overload4 more...]]`` ``` [section:overload1 span::span (1 of 4 overloads)]
  4660. Constructor. [heading Synopsis] ``` span(); ``` [heading Description] [endsect] [section:overload2 span::span (2 of 4 overloads)]
  4661. Constructor. [heading Synopsis] ``` span( span const&); ``` [heading Description] [endsect] [section:overload3 span::span (3 of 4 overloads)]
  4662. Constructor. [heading Synopsis] ``` span( T* data, std::size_t size); ``` [heading Description]
  4663. [heading Parameters] [table [[Name][Description]] [[`data`][
  4664. A pointer to the beginning of the range of elements ]] [[`size`][
  4665. The number of elements pointed to by `data` ]] ]
  4666. [endsect] [section:overload4 span::span (4 of 4 overloads)]
  4667. Constructor. [heading Synopsis] ``` template< class ContiguousContainer> span( ContiguousContainer&& container); ``` [heading Description]
  4668. [heading Parameters] [table [[Name][Description]] [[`container`][
  4669. The container to construct from ]] ]
  4670. [endsect] [endsect] [section:value_type span::value_type] [indexterm2 value_type..span]
  4671. The type of value of each span element. [heading Synopsis] ``` using value_type = typename std::remove_const< T >::type; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__ssl_stream ssl_stream]
  4672. Provides stream-oriented functionality using OpenSSL. [heading Synopsis] Defined in header [include_file boost/beast/ssl/ssl_stream.hpp] ``` template< class NextLayer> class ssl_stream : public stream_base ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__ssl_stream.executor_type [*executor_type]]] [ The type of the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__ssl_stream.impl_struct [*impl_struct]]] [ Structure for use with deprecated impl_type. ] ] [ [[link beast.ref.boost__beast__ssl_stream.native_handle_type [*native_handle_type]]] [ The native handle type of the SSL stream. ] ] [ [[link beast.ref.boost__beast__ssl_stream.next_layer_type [*next_layer_type]]] [ The type of the next layer. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__ssl_stream.async_handshake [*async_handshake]]] [ Start an asynchronous SSL handshake. ] ] [ [[link beast.ref.boost__beast__ssl_stream.async_read_some [*async_read_some]]] [ Start an asynchronous read. ] ] [ [[link beast.ref.boost__beast__ssl_stream.async_shutdown [*async_shutdown]]] [ Asynchronously shut down SSL on the stream. ] ] [ [[link beast.ref.boost__beast__ssl_stream.async_write_some [*async_write_some]]] [ Start an asynchronous write. ] ] [ [[link beast.ref.boost__beast__ssl_stream.get_executor [*get_executor]]] [ Get the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__ssl_stream.handshake [*handshake]]] [ Perform SSL handshaking. ] ] [ [[link beast.ref.boost__beast__ssl_stream.native_handle [*native_handle]]] [ Get the underlying implementation in the native type. ] ] [ [[link beast.ref.boost__beast__ssl_stream.next_layer [*next_layer]]] [ Get a reference to the next layer. ] ] [ [[link beast.ref.boost__beast__ssl_stream.read_some [*read_some]]] [ Read some data from the stream. ] ] [ [[link beast.ref.boost__beast__ssl_stream.set_verify_callback [*set_verify_callback]]] [ Set the callback used to verify peer certificates. ] ] [ [[link beast.ref.boost__beast__ssl_stream.set_verify_depth [*set_verify_depth]]] [ Set the peer verification depth. ] ] [ [[link beast.ref.boost__beast__ssl_stream.set_verify_mode [*set_verify_mode]]] [ Set the peer verification mode. ] ] [ [[link beast.ref.boost__beast__ssl_stream.shutdown [*shutdown]]] [ Shut down SSL on the stream. ] ] [ [[link beast.ref.boost__beast__ssl_stream.ssl_stream [*ssl_stream]]] [ Construct a stream. ] ] [ [[link beast.ref.boost__beast__ssl_stream.write_some [*write_some]]] [ Write some data to the stream. ] ] ] [heading Description]
  4673. The stream class template provides asynchronous and blocking stream-oriented functionality using SSL.
  4674. [heading Thread Safety]
  4675. ['Distinct] ['objects:] Safe. ['Shared] ['objects:] Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
  4676. [heading Example]
  4677. To use this template with a [link beast.ref.boost__beast__tcp_stream `tcp_stream`], you would write: ``` net::io_context ioc;
  4678. net::ssl::context ctx{net::ssl::context::tlsv12};
  4679. beast::ssl_stream<beast::tcp_stream> sock{ioc, ctx};
  4680. ```
  4681. In addition to providing an interface identical to `net::ssl::stream`, the wrapper has the following additional properties:
  4682. * Satisfies [*MoveConstructible]
  4683. * Satisfies [*MoveAssignable]
  4684. * Constructible from a moved socket.
  4685. * Uses [link beast.ref.boost__beast__flat_stream `flat_stream`] internally, as a performance work-around for a limitation of `net::ssl::stream` when writing buffer sequences having length greater than one.
  4686. [section:async_handshake ssl_stream::async_handshake] [indexterm2 async_handshake..ssl_stream]
  4687. Start an asynchronous SSL handshake. ``` template< class HandshakeHandler> ``__deduced__`` ``[link beast.ref.boost__beast__ssl_stream.async_handshake.overload1 async_handshake]``( handshake_type type, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.async_handshake.overload1 more...]]`` template< class __ConstBufferSequence__, class BufferedHandshakeHandler> ``__deduced__`` ``[link beast.ref.boost__beast__ssl_stream.async_handshake.overload2 async_handshake]``( handshake_type type, ConstBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.async_handshake.overload2 more...]]`` ``` [section:overload1 ssl_stream::async_handshake (1 of 2 overloads)]
  4688. Start an asynchronous SSL handshake. [heading Synopsis] ``` template< class HandshakeHandler> ``__deduced__`` async_handshake( handshake_type type, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler); ``` [heading Description]
  4689. This function is used to asynchronously perform an SSL handshake on the stream. This function call always returns immediately.
  4690. [heading Parameters] [table [[Name][Description]] [[`type`][
  4691. The type of handshaking to be performed, i.e. as a client or as a server. ]] [[`handler`][
  4692. The handler to be called when the handshake operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: ``` void handler(
  4693. const boost::system::error_code& error // Result of operation.
  4694. );
  4695. ``` ]] ]
  4696. [endsect] [section:overload2 ssl_stream::async_handshake (2 of 2 overloads)]
  4697. Start an asynchronous SSL handshake. [heading Synopsis] ``` template< class __ConstBufferSequence__, class BufferedHandshakeHandler> ``__deduced__`` async_handshake( handshake_type type, ConstBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler); ``` [heading Description]
  4698. This function is used to asynchronously perform an SSL handshake on the stream. This function call always returns immediately.
  4699. [heading Parameters] [table [[Name][Description]] [[`type`][
  4700. The type of handshaking to be performed, i.e. as a client or as a server. ]] [[`buffers`][
  4701. The buffered data to be reused for the handshake. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  4702. The handler to be called when the handshake operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: ``` void handler(
  4703. const boost::system::error_code& error, // Result of operation.
  4704. std::size_t bytes_transferred // Amount of buffers used in handshake.
  4705. );
  4706. ``` ]] ]
  4707. [endsect] [endsect] [section:async_read_some ssl_stream::async_read_some] [indexterm2 async_read_some..ssl_stream]
  4708. Start an asynchronous read. [heading Synopsis] ``` template< class __MutableBufferSequence__, class __ReadHandler__> ``__deduced__`` async_read_some( MutableBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler); ``` [heading Description]
  4709. This function is used to asynchronously read one or more bytes of data from the stream. The function call always returns immediately.
  4710. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  4711. The buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  4712. The handler to be called when the read operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: ``` void handler(
  4713. const boost::system::error_code& error, // Result of operation.
  4714. std::size_t bytes_transferred // Number of bytes read.
  4715. );
  4716. ``` ]] ]
  4717. [heading Remarks]
  4718. The `async_read_some` operation may not read all of the requested number of bytes. Consider using the `net::async_read` function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
  4719. [endsect] [section:async_shutdown ssl_stream::async_shutdown] [indexterm2 async_shutdown..ssl_stream]
  4720. Asynchronously shut down SSL on the stream. [heading Synopsis] ``` template< class ShutdownHandler> ``__deduced__`` async_shutdown( BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler); ``` [heading Description]
  4721. This function is used to asynchronously shut down SSL on the stream. This function call always returns immediately.
  4722. [heading Parameters] [table [[Name][Description]] [[`handler`][
  4723. The handler to be called when the handshake operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: ``` void handler(
  4724. const boost::system::error_code& error // Result of operation.
  4725. );
  4726. ``` ]] ]
  4727. [endsect] [section:async_write_some ssl_stream::async_write_some] [indexterm2 async_write_some..ssl_stream]
  4728. Start an asynchronous write. [heading Synopsis] ``` template< class __ConstBufferSequence__, class __WriteHandler__> ``__deduced__`` async_write_some( ConstBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler); ``` [heading Description]
  4729. This function is used to asynchronously write one or more bytes of data to the stream. The function call always returns immediately.
  4730. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  4731. The data to be written to the stream. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  4732. The handler to be called when the write operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: ``` void handler(
  4733. const boost::system::error_code& error, // Result of operation.
  4734. std::size_t bytes_transferred // Number of bytes written.
  4735. );
  4736. ``` ]] ]
  4737. [heading Remarks]
  4738. The `async_write_some` operation may not transmit all of the data to the peer. Consider using the `net::async_write` function if you need to ensure that all data is written before the asynchronous operation completes.
  4739. [endsect] [section:executor_type ssl_stream::executor_type] [indexterm2 executor_type..ssl_stream]
  4740. The type of the executor associated with the object. [heading Synopsis] ``` using executor_type = typename stream_type::executor_type; ``` [heading Description] [endsect] [section:get_executor ssl_stream::get_executor] [indexterm2 get_executor..ssl_stream]
  4741. Get the executor associated with the object. [heading Synopsis] ``` executor_type get_executor(); ``` [heading Description]
  4742. This function may be used to obtain the executor object that the stream uses to dispatch handlers for asynchronous operations.
  4743. [heading Return Value]
  4744. A copy of the executor that stream will use to dispatch handlers.
  4745. [endsect] [section:handshake ssl_stream::handshake] [indexterm2 handshake..ssl_stream]
  4746. Perform SSL handshaking. ``` void ``[link beast.ref.boost__beast__ssl_stream.handshake.overload1 handshake]``( handshake_type type); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.handshake.overload1 more...]]`` void ``[link beast.ref.boost__beast__ssl_stream.handshake.overload2 handshake]``( handshake_type type, boost::system::error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.handshake.overload2 more...]]`` template< class __ConstBufferSequence__> void ``[link beast.ref.boost__beast__ssl_stream.handshake.overload3 handshake]``( handshake_type type, ConstBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.handshake.overload3 more...]]`` template< class __ConstBufferSequence__> void ``[link beast.ref.boost__beast__ssl_stream.handshake.overload4 handshake]``( handshake_type type, ConstBufferSequence const& buffers, boost::system::error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.handshake.overload4 more...]]`` ``` [section:overload1 ssl_stream::handshake (1 of 4 overloads)]
  4747. Perform SSL handshaking. [heading Synopsis] ``` void handshake( handshake_type type); ``` [heading Description]
  4748. This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
  4749. [heading Parameters] [table [[Name][Description]] [[`type`][
  4750. The type of handshaking to be performed, i.e. as a client or as a server. ]] ]
  4751. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  4752. Thrown on failure. ]] ]
  4753. [endsect] [section:overload2 ssl_stream::handshake (2 of 4 overloads)]
  4754. Perform SSL handshaking. [heading Synopsis] ``` void handshake( handshake_type type, boost::system::error_code& ec); ``` [heading Description]
  4755. This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
  4756. [heading Parameters] [table [[Name][Description]] [[`type`][
  4757. The type of handshaking to be performed, i.e. as a client or as a server. ]] [[`ec`][
  4758. Set to indicate what error occurred, if any. ]] ]
  4759. [endsect] [section:overload3 ssl_stream::handshake (3 of 4 overloads)]
  4760. Perform SSL handshaking. [heading Synopsis] ``` template< class __ConstBufferSequence__> void handshake( handshake_type type, ConstBufferSequence const& buffers); ``` [heading Description]
  4761. This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
  4762. [heading Parameters] [table [[Name][Description]] [[`type`][
  4763. The type of handshaking to be performed, i.e. as a client or as a server. ]] [[`buffers`][
  4764. The buffered data to be reused for the handshake. ]] ]
  4765. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  4766. Thrown on failure. ]] ]
  4767. [endsect] [section:overload4 ssl_stream::handshake (4 of 4 overloads)]
  4768. Perform SSL handshaking. [heading Synopsis] ``` template< class __ConstBufferSequence__> void handshake( handshake_type type, ConstBufferSequence const& buffers, boost::system::error_code& ec); ``` [heading Description]
  4769. This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
  4770. [heading Parameters] [table [[Name][Description]] [[`type`][
  4771. The type of handshaking to be performed, i.e. as a client or as a server. ]] [[`buffers`][
  4772. The buffered data to be reused for the handshake. ]] [[`ec`][
  4773. Set to indicate what error occurred, if any. ]] ]
  4774. [endsect] [endsect] [section:impl_struct ssl_stream::impl_struct] [indexterm2 impl_struct..ssl_stream]
  4775. Structure for use with deprecated impl\_type. [heading Synopsis] ``` using impl_struct = typename ssl_stream_type::impl_struct; ``` [heading Description] [endsect] [section:native_handle ssl_stream::native_handle] [indexterm2 native_handle..ssl_stream]
  4776. Get the underlying implementation in the native type. [heading Synopsis] ``` native_handle_type native_handle(); ``` [heading Description]
  4777. This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided.
  4778. [heading Example]
  4779. The [link beast.ref.boost__beast__ssl_stream.native_handle `ssl_stream::native_handle()`] function returns a pointer of type `SSL*` that is suitable for passing to functions such as `SSL_get_verify_result` and `SSL_get_peer_certificate:` ``` boost::beast::ssl_stream<net::ip::tcp::socket> ss{ioc, ctx};
  4780. // ... establish connection and perform handshake ...
  4781. if (X509* cert = SSL_get_peer_certificate(ss.native_handle()))
  4782. {
  4783. if (SSL_get_verify_result(ss.native_handle()) == X509_V_OK)
  4784. {
  4785. // ...
  4786. }
  4787. }
  4788. ```
  4789. [endsect] [section:native_handle_type ssl_stream::native_handle_type] [indexterm2 native_handle_type..ssl_stream]
  4790. The native handle type of the SSL stream. [heading Synopsis] ``` using native_handle_type = typename ssl_stream_type::native_handle_type; ``` [heading Description] [endsect] [section:next_layer ssl_stream::next_layer] [indexterm2 next_layer..ssl_stream]
  4791. Get a reference to the next layer. ``` next_layer_type const & ``[link beast.ref.boost__beast__ssl_stream.next_layer.overload1 next_layer]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.next_layer.overload1 more...]]`` next_layer_type& ``[link beast.ref.boost__beast__ssl_stream.next_layer.overload2 next_layer]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.next_layer.overload2 more...]]`` ``` [section:overload1 ssl_stream::next_layer (1 of 2 overloads)]
  4792. Get a reference to the next layer. [heading Synopsis] ``` next_layer_type const & next_layer() const; ``` [heading Description]
  4793. This function returns a reference to the next layer in a stack of stream layers.
  4794. [heading Remarks]
  4795. The next layer is the wrapped stream and not the [link beast.ref.boost__beast__flat_stream `flat_stream`] used in the implementation.
  4796. [heading Return Value]
  4797. A reference to the next layer in the stack of stream layers. Ownership is not transferred to the caller.
  4798. [endsect] [section:overload2 ssl_stream::next_layer (2 of 2 overloads)]
  4799. Get a reference to the next layer. [heading Synopsis] ``` next_layer_type& next_layer(); ``` [heading Description]
  4800. This function returns a reference to the next layer in a stack of stream layers.
  4801. [heading Remarks]
  4802. The next layer is the wrapped stream and not the [link beast.ref.boost__beast__flat_stream `flat_stream`] used in the implementation.
  4803. [heading Return Value]
  4804. A reference to the next layer in the stack of stream layers. Ownership is not transferred to the caller.
  4805. [endsect] [endsect] [section:next_layer_type ssl_stream::next_layer_type] [indexterm2 next_layer_type..ssl_stream]
  4806. The type of the next layer. [heading Synopsis] ``` using next_layer_type = typename ssl_stream_type::next_layer_type; ``` [heading Description] [endsect] [section:read_some ssl_stream::read_some] [indexterm2 read_some..ssl_stream]
  4807. Read some data from the stream. ``` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__ssl_stream.read_some.overload1 read_some]``( MutableBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.read_some.overload1 more...]]`` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__ssl_stream.read_some.overload2 read_some]``( MutableBufferSequence const& buffers, boost::system::error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.read_some.overload2 more...]]`` ``` [section:overload1 ssl_stream::read_some (1 of 2 overloads)]
  4808. Read some data from the stream. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers); ``` [heading Description]
  4809. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  4810. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  4811. The buffers into which the data will be read. ]] ]
  4812. [heading Return Value]
  4813. The number of bytes read.
  4814. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  4815. Thrown on failure. ]] ]
  4816. [heading Remarks]
  4817. The `read_some` operation may not read all of the requested number of bytes. Consider using the `net::read` function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  4818. [endsect] [section:overload2 ssl_stream::read_some (2 of 2 overloads)]
  4819. Read some data from the stream. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers, boost::system::error_code& ec); ``` [heading Description]
  4820. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  4821. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  4822. The buffers into which the data will be read. ]] [[`ec`][
  4823. Set to indicate what error occurred, if any. ]] ]
  4824. [heading Return Value]
  4825. The number of bytes read. Returns 0 if an error occurred.
  4826. [heading Remarks]
  4827. The `read_some` operation may not read all of the requested number of bytes. Consider using the `net::read` function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  4828. [endsect] [endsect] [section:set_verify_callback ssl_stream::set_verify_callback] [indexterm2 set_verify_callback..ssl_stream]
  4829. Set the callback used to verify peer certificates. ``` template< class VerifyCallback> void ``[link beast.ref.boost__beast__ssl_stream.set_verify_callback.overload1 set_verify_callback]``( VerifyCallback callback); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.set_verify_callback.overload1 more...]]`` template< class VerifyCallback> void ``[link beast.ref.boost__beast__ssl_stream.set_verify_callback.overload2 set_verify_callback]``( VerifyCallback callback, boost::system::error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.set_verify_callback.overload2 more...]]`` ``` [section:overload1 ssl_stream::set_verify_callback (1 of 2 overloads)]
  4830. Set the callback used to verify peer certificates. [heading Synopsis] ``` template< class VerifyCallback> void set_verify_callback( VerifyCallback callback); ``` [heading Description]
  4831. This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
  4832. [heading Parameters] [table [[Name][Description]] [[`callback`][
  4833. The function object to be used for verifying a certificate. The function signature of the handler must be: ``` bool verify_callback(
  4834. bool preverified, // True if the certificate passed pre-verification.
  4835. verify_context& ctx // The peer certificate and other context.
  4836. );
  4837. ``` The return value of the callback is true if the certificate has passed verification, false otherwise. ]] ]
  4838. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  4839. Thrown on failure. ]] ]
  4840. [heading Remarks]
  4841. Calls `SSL_set_verify`.
  4842. [endsect] [section:overload2 ssl_stream::set_verify_callback (2 of 2 overloads)]
  4843. Set the callback used to verify peer certificates. [heading Synopsis] ``` template< class VerifyCallback> void set_verify_callback( VerifyCallback callback, boost::system::error_code& ec); ``` [heading Description]
  4844. This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
  4845. [heading Parameters] [table [[Name][Description]] [[`callback`][
  4846. The function object to be used for verifying a certificate. The function signature of the handler must be: ``` bool verify_callback(
  4847. bool preverified, // True if the certificate passed pre-verification.
  4848. net::verify_context& ctx // The peer certificate and other context.
  4849. );
  4850. ``` The return value of the callback is true if the certificate has passed verification, false otherwise. ]] [[`ec`][
  4851. Set to indicate what error occurred, if any. ]] ]
  4852. [heading Remarks]
  4853. Calls `SSL_set_verify`.
  4854. [endsect] [endsect] [section:set_verify_depth ssl_stream::set_verify_depth] [indexterm2 set_verify_depth..ssl_stream]
  4855. Set the peer verification depth. ``` void ``[link beast.ref.boost__beast__ssl_stream.set_verify_depth.overload1 set_verify_depth]``( int depth); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.set_verify_depth.overload1 more...]]`` void ``[link beast.ref.boost__beast__ssl_stream.set_verify_depth.overload2 set_verify_depth]``( int depth, boost::system::error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.set_verify_depth.overload2 more...]]`` ``` [section:overload1 ssl_stream::set_verify_depth (1 of 2 overloads)]
  4856. Set the peer verification depth. [heading Synopsis] ``` void set_verify_depth( int depth); ``` [heading Description]
  4857. This function may be used to configure the maximum verification depth allowed by the stream.
  4858. [heading Parameters] [table [[Name][Description]] [[`depth`][
  4859. Maximum depth for the certificate chain verification that shall be allowed. ]] ]
  4860. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  4861. Thrown on failure. ]] ]
  4862. [heading Remarks]
  4863. Calls `SSL_set_verify_depth`.
  4864. [endsect] [section:overload2 ssl_stream::set_verify_depth (2 of 2 overloads)]
  4865. Set the peer verification depth. [heading Synopsis] ``` void set_verify_depth( int depth, boost::system::error_code& ec); ``` [heading Description]
  4866. This function may be used to configure the maximum verification depth allowed by the stream.
  4867. [heading Parameters] [table [[Name][Description]] [[`depth`][
  4868. Maximum depth for the certificate chain verification that shall be allowed. ]] [[`ec`][
  4869. Set to indicate what error occurred, if any. ]] ]
  4870. [heading Remarks]
  4871. Calls `SSL_set_verify_depth`.
  4872. [endsect] [endsect] [section:set_verify_mode ssl_stream::set_verify_mode] [indexterm2 set_verify_mode..ssl_stream]
  4873. Set the peer verification mode. ``` void ``[link beast.ref.boost__beast__ssl_stream.set_verify_mode.overload1 set_verify_mode]``( net::ssl::verify_mode v); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.set_verify_mode.overload1 more...]]`` void ``[link beast.ref.boost__beast__ssl_stream.set_verify_mode.overload2 set_verify_mode]``( net::ssl::verify_mode v, boost::system::error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.set_verify_mode.overload2 more...]]`` ``` [section:overload1 ssl_stream::set_verify_mode (1 of 2 overloads)]
  4874. Set the peer verification mode. [heading Synopsis] ``` void set_verify_mode( net::ssl::verify_mode v); ``` [heading Description]
  4875. This function may be used to configure the peer verification mode used by the stream. The new mode will override the mode inherited from the context.
  4876. [heading Parameters] [table [[Name][Description]] [[`v`][
  4877. A bitmask of peer verification modes. ]] ]
  4878. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  4879. Thrown on failure. ]] ]
  4880. [heading Remarks]
  4881. Calls `SSL_set_verify`.
  4882. [endsect] [section:overload2 ssl_stream::set_verify_mode (2 of 2 overloads)]
  4883. Set the peer verification mode. [heading Synopsis] ``` void set_verify_mode( net::ssl::verify_mode v, boost::system::error_code& ec); ``` [heading Description]
  4884. This function may be used to configure the peer verification mode used by the stream. The new mode will override the mode inherited from the context.
  4885. [heading Parameters] [table [[Name][Description]] [[`v`][
  4886. A bitmask of peer verification modes. See `verify_mode` for available values. ]] [[`ec`][
  4887. Set to indicate what error occurred, if any. ]] ]
  4888. [heading Remarks]
  4889. Calls `SSL_set_verify`.
  4890. [endsect] [endsect] [section:shutdown ssl_stream::shutdown] [indexterm2 shutdown..ssl_stream]
  4891. Shut down SSL on the stream. ``` void ``[link beast.ref.boost__beast__ssl_stream.shutdown.overload1 shutdown]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.shutdown.overload1 more...]]`` void ``[link beast.ref.boost__beast__ssl_stream.shutdown.overload2 shutdown]``( boost::system::error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.shutdown.overload2 more...]]`` ``` [section:overload1 ssl_stream::shutdown (1 of 2 overloads)]
  4892. Shut down SSL on the stream. [heading Synopsis] ``` void shutdown(); ``` [heading Description]
  4893. This function is used to shut down SSL on the stream. The function call will block until SSL has been shut down or an error occurs.
  4894. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  4895. Thrown on failure. ]] ]
  4896. [endsect] [section:overload2 ssl_stream::shutdown (2 of 2 overloads)]
  4897. Shut down SSL on the stream. [heading Synopsis] ``` void shutdown( boost::system::error_code& ec); ``` [heading Description]
  4898. This function is used to shut down SSL on the stream. The function call will block until SSL has been shut down or an error occurs.
  4899. [heading Parameters] [table [[Name][Description]] [[`ec`][
  4900. Set to indicate what error occurred, if any. ]] ]
  4901. [endsect] [endsect] [section:ssl_stream ssl_stream::ssl_stream] [indexterm2 ssl_stream..ssl_stream]
  4902. Construct a stream. [heading Synopsis] ``` template< class Arg> ssl_stream( Arg&& arg, net::ssl::context& ctx); ``` [heading Description]
  4903. This constructor creates a stream and initialises the underlying stream object.
  4904. [heading Parameters] [table [[Name][Description]] [[`arg`][
  4905. The argument to be passed to initialise the underlying stream. ]] [[`ctx`][
  4906. The SSL context to be used for the stream. ]] ]
  4907. [endsect] [section:write_some ssl_stream::write_some] [indexterm2 write_some..ssl_stream]
  4908. Write some data to the stream. ``` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__ssl_stream.write_some.overload1 write_some]``( ConstBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.write_some.overload1 more...]]`` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__ssl_stream.write_some.overload2 write_some]``( ConstBufferSequence const& buffers, boost::system::error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__ssl_stream.write_some.overload2 more...]]`` ``` [section:overload1 ssl_stream::write_some (1 of 2 overloads)]
  4909. Write some data to the stream. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers); ``` [heading Description]
  4910. This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
  4911. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  4912. The data to be written. ]] ]
  4913. [heading Return Value]
  4914. The number of bytes written.
  4915. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  4916. Thrown on failure. ]] ]
  4917. [heading Remarks]
  4918. The `write_some` operation may not transmit all of the data to the peer. Consider using the `net::write` function if you need to ensure that all data is written before the blocking operation completes.
  4919. [endsect] [section:overload2 ssl_stream::write_some (2 of 2 overloads)]
  4920. Write some data to the stream. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers, boost::system::error_code& ec); ``` [heading Description]
  4921. This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
  4922. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  4923. The data to be written to the stream. ]] [[`ec`][
  4924. Set to indicate what error occurred, if any. ]] ]
  4925. [heading Return Value]
  4926. The number of bytes written. Returns 0 if an error occurred.
  4927. [heading Remarks]
  4928. The `write_some` operation may not transmit all of the data to the peer. Consider using the `net::write` function if you need to ensure that all data is written before the blocking operation completes.
  4929. [endsect] [endsect] Convenience header [include_file boost/beast/ssl.hpp] [endsect] [section:boost__beast__stable_async_base stable_async_base]
  4930. Base class to provide completion handler boilerplate for composed operations. [heading Synopsis] Defined in header [include_file boost/beast/core/async_base.hpp] ``` template< class __Handler__, class __Executor1__, class __Allocator__ = std::allocator<void>> class stable_async_base : public async_base< Handler, Executor1, Allocator > ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__stable_async_base.allocator_type [*allocator_type]]] [ The type of allocator associated with this object. ] ] [ [[link beast.ref.boost__beast__stable_async_base.executor_type [*executor_type]]] [ The type of executor associated with this object. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__stable_async_base.complete [*complete]]] [ Invoke the final completion handler, maybe using post. ] ] [ [[link beast.ref.boost__beast__stable_async_base.complete_now [*complete_now]]] [ Invoke the final completion handler. ] ] [ [[link beast.ref.boost__beast__stable_async_base.get_allocator [*get_allocator]]] [ Returns the allocator associated with this object. ] ] [ [[link beast.ref.boost__beast__stable_async_base.get_executor [*get_executor]]] [ Returns the executor associated with this object. ] ] [ [[link beast.ref.boost__beast__stable_async_base.handler [*handler]]] [ Returns the handler associated with this object. ] ] [ [[link beast.ref.boost__beast__stable_async_base.release_handler [*release_handler]]] [ Returns ownership of the handler associated with this object. ] ] [ [[link beast.ref.boost__beast__stable_async_base.stable_async_base [*stable_async_base]]] [ Constructor. Move Constructor. ] ] [ [[link beast.ref.boost__beast__stable_async_base.stable_async_base_dtor_ [*~stable_async_base]]] [ Destructor. ] ] ] [heading Friends] [table [[Name][Description]] [ [[link beast.ref.boost__beast__stable_async_base.allocate_stable [*allocate_stable]]] [ Allocate a temporary object to hold operation state. ] ] ] [heading Description]
  4931. A function object submitted to intermediate initiating functions during a composed operation may derive from this type to inherit all of the boilerplate to forward the executor, allocator, and legacy customization points associated with the completion handler invoked at the end of the composed operation.
  4932. The composed operation must be typical; that is, associated with one executor of an I/O object, and invoking a caller-provided completion handler when the operation is finished. Classes derived from [link beast.ref.boost__beast__async_base `async_base`] will acquire these properties:
  4933. * Ownership of the final completion handler provided upon construction.
  4934. * If the final handler has an associated allocator, this allocator will be propagated to the composed operation subclass. Otherwise, the associated allocator will be the type specified in the allocator template parameter, or the default of `std::allocator<void>` if the parameter is omitted.
  4935. * If the final handler has an associated executor, then it will be used as the executor associated with the composed operation. Otherwise, the specified `Executor1` will be the type of executor associated with the composed operation.
  4936. * An instance of `net::executor_work_guard` for the instance of `Executor1` shall be maintained until either the final handler is invoked, or the operation base is destroyed, whichever comes first.
  4937. * Calls to the legacy customization points `asio_handler_invoke`, `asio_handler_allocate`, `asio_handler_deallocate`, and `asio_handler_is_continuation`, which use argument-dependent lookup, will be forwarded to the legacy customization points associated with the handler.
  4938. Data members of composed operations implemented as completion handlers do not have stable addresses, as the composed operation object is move constructed upon each call to an initiating function. For most operations this is not a problem. For complex operations requiring stable temporary storage, the class [link beast.ref.boost__beast__stable_async_base `stable_async_base`] is provided which offers additional functionality:
  4939. * The free function [link beast.ref.boost__beast__allocate_stable `allocate_stable`] may be used to allocate one or more temporary objects associated with the composed operation.
  4940. * Memory for stable temporary objects is allocated using the allocator associated with the composed operation.
  4941. * Stable temporary objects are automatically destroyed, and the memory freed using the associated allocator, either before the final completion handler is invoked (a Networking requirement) or when the composed operation is destroyed, whichever occurs first.
  4942. [heading Example]
  4943. The following code demonstrates how [link beast.ref.boost__beast__stable_async_base `stable_async_base`] may be be used to assist authoring an asynchronous initiating function, by providing all of the boilerplate to manage the final completion handler in a way that maintains the allocator and executor associations. Furthermore, the operation shown allocates temporary memory using [link beast.ref.boost__beast__allocate_stable `allocate_stable`] for the timer and message, whose addresses must not change between intermediate operations:
  4944. ``` // Asynchronously send a message multiple times, once per second
  4945. template <class AsyncWriteStream, class T, class WriteHandler>
  4946. auto async_write_messages(
  4947. AsyncWriteStream& stream,
  4948. T const& message,
  4949. std::size_t repeat_count,
  4950. WriteHandler&& handler) ->
  4951. typename net::async_result<
  4952. typename std::decay<WriteHandler>::type,
  4953. void(error_code)>::return_type
  4954. {
  4955. using handler_type = typename net::async_completion<WriteHandler, void(error_code)>::completion_handler_type;
  4956. using base_type = stable_async_base<handler_type, typename AsyncWriteStream::executor_type>;
  4957. struct op : base_type, boost::asio::coroutine
  4958. {
  4959. // This object must have a stable address
  4960. struct temporary_data
  4961. {
  4962. // Although std::string is in theory movable, most implementations
  4963. // use a "small buffer optimization" which means that we might
  4964. // be submitting a buffer to the write operation and then
  4965. // moving the string, invalidating the buffer. To prevent
  4966. // undefined behavior we store the string object itself at
  4967. // a stable location.
  4968. std::string const message;
  4969. net::steady_timer timer;
  4970. temporary_data(std::string message_, net::io_context& ctx)
  4971. : message(std::move(message_))
  4972. , timer(ctx)
  4973. {
  4974. }
  4975. };
  4976. AsyncWriteStream& stream_;
  4977. std::size_t repeats_;
  4978. temporary_data& data_;
  4979. op(AsyncWriteStream& stream, std::size_t repeats, std::string message, handler_type& handler)
  4980. : base_type(std::move(handler), stream.get_executor())
  4981. , stream_(stream)
  4982. , repeats_(repeats)
  4983. , data_(allocate_stable<temporary_data>(*this, std::move(message), stream.get_executor().context()))
  4984. {
  4985. (*this)(); // start the operation
  4986. }
  4987. // Including this file provides the keywords for macro-based coroutines
  4988. #include <boost/asio/yield.hpp>
  4989. void operator()(error_code ec = {}, std::size_t = 0)
  4990. {
  4991. reenter(*this)
  4992. {
  4993. // If repeats starts at 0 then we must complete immediately. But
  4994. // we can't call the final handler from inside the initiating
  4995. // function, so we post our intermediate handler first. We use
  4996. // net::async_write with an empty buffer instead of calling
  4997. // net::post to avoid an extra function template instantiation, to
  4998. // keep compile times lower and make the resulting executable smaller.
  4999. yield net::async_write(stream_, net::const_buffer{}, std::move(*this));
  5000. while(! ec && repeats_-- > 0)
  5001. {
  5002. // Send the string. We construct a `const_buffer` here to guarantee
  5003. // that we do not create an additional function template instantation
  5004. // of net::async_write, since we already instantiated it above for
  5005. // net::const_buffer.
  5006. yield net::async_write(stream_,
  5007. net::const_buffer(net::buffer(data_.message)), std::move(*this));
  5008. if(ec)
  5009. break;
  5010. // Set the timer and wait
  5011. data_.timer.expires_after(std::chrono::seconds(1));
  5012. yield data_.timer.async_wait(std::move(*this));
  5013. }
  5014. }
  5015. // The base class destroys the temporary data automatically,
  5016. // before invoking the final completion handler
  5017. this->complete_now(ec);
  5018. }
  5019. // Including this file undefines the macros for the coroutines
  5020. #include <boost/asio/unyield.hpp>
  5021. };
  5022. net::async_completion<WriteHandler, void(error_code)> completion(handler);
  5023. std::ostringstream os;
  5024. os << message;
  5025. op(stream, repeat_count, os.str(), completion.completion_handler);
  5026. return completion.result.get();
  5027. }
  5028. ```
  5029. [heading Template Parameters] [table [[Type][Description]] [[`Handler`][
  5030. The type of the completion handler to store. This type must meet the requirements of ['CompletionHandler]. ]] [[`Executor1`][
  5031. The type of the executor used when the handler has no associated executor. An instance of this type must be provided upon construction. The implementation will maintain an executor work guard and a copy of this instance. ]] [[`Allocator`][
  5032. The allocator type to use if the handler does not have an associated allocator. If this parameter is omitted, then `std::allocator<void>` will be used. If the specified allocator is not default constructible, an instance of the type must be provided upon construction. ]] ]
  5033. [heading See Also]
  5034. [link beast.ref.boost__beast__stable_async_base.allocate_stable `stable_async_base::allocate_stable`], [link beast.ref.boost__beast__async_base `async_base`]
  5035. [section:allocate_stable stable_async_base::allocate_stable] [indexterm2 allocate_stable..stable_async_base]
  5036. Allocate a temporary object to hold operation state. [heading Synopsis] Defined in header [include_file boost/beast/core/async_base.hpp] ``` template< class State, class __Handler__, class Executor1_, class Allocator_, class... Args> friend State& allocate_stable( stable_async_base< Handler_, Executor1_, Allocator_ >& base, Args&&... args); ``` [heading Description]
  5037. The object will be destroyed just before the completion handler is invoked, or when the operation base is destroyed. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:allocator_type stable_async_base::allocator_type] (Inherited from `async_base`) [indexterm2 allocator_type..stable_async_base]
  5038. The type of allocator associated with this object. [heading Synopsis] ``` using allocator_type = net::associated_allocator_t< Handler, Allocator >; ``` [heading Description]
  5039. If a class derived from [link beast.ref.boost__beast__async_base `async_base`] is a completion handler, then the associated allocator of the derived class will be this type. [endsect] [section:complete stable_async_base::complete] (Inherited from `async_base`) [indexterm2 complete..stable_async_base]
  5040. Invoke the final completion handler, maybe using post. [heading Synopsis] ``` template< class... Args> void complete( bool is_continuation, Args&&... args); ``` [heading Description]
  5041. This invokes the final completion handler with the specified arguments forwarded. It is undefined to call either of [link beast.ref.boost__beast__async_base.complete `async_base::complete`] or [link beast.ref.boost__beast__async_base.complete_now `async_base::complete_now`] more than once.
  5042. Any temporary objects allocated with [link beast.ref.boost__beast__allocate_stable `allocate_stable`] will be automatically destroyed before the final completion handler is invoked.
  5043. [heading Parameters] [table [[Name][Description]] [[`is_continuation`][
  5044. If this value is `false`, then the handler will be submitted to the executor using `net::post`. Otherwise the handler will be invoked as if by calling [link beast.ref.boost__beast__async_base.complete_now `async_base::complete_now`]. ]] [[`args`][
  5045. A list of optional parameters to invoke the handler with. The completion handler must be invocable with the parameter list, or else a compilation error will result. ]] ]
  5046. [endsect] [section:complete_now stable_async_base::complete_now] (Inherited from `async_base`) [indexterm2 complete_now..stable_async_base]
  5047. Invoke the final completion handler. [heading Synopsis] ``` template< class... Args> void complete_now( Args&&... args); ``` [heading Description]
  5048. This invokes the final completion handler with the specified arguments forwarded. It is undefined to call either of [link beast.ref.boost__beast__async_base.complete `async_base::complete`] or [link beast.ref.boost__beast__async_base.complete_now `async_base::complete_now`] more than once.
  5049. Any temporary objects allocated with [link beast.ref.boost__beast__allocate_stable `allocate_stable`] will be automatically destroyed before the final completion handler is invoked.
  5050. [heading Parameters] [table [[Name][Description]] [[`args`][
  5051. A list of optional parameters to invoke the handler with. The completion handler must be invocable with the parameter list, or else a compilation error will result. ]] ]
  5052. [endsect] [section:executor_type stable_async_base::executor_type] (Inherited from `async_base`) [indexterm2 executor_type..stable_async_base]
  5053. The type of executor associated with this object. [heading Synopsis] ``` using executor_type = net::associated_executor_t< Handler, Executor1 >; ``` [heading Description]
  5054. If a class derived from [link beast.ref.boost__beast__async_base `async_base`] is a completion handler, then the associated executor of the derived class will be this type. [endsect] [section:get_allocator stable_async_base::get_allocator] (Inherited from `async_base`) [indexterm2 get_allocator..stable_async_base]
  5055. Returns the allocator associated with this object. [heading Synopsis] ``` allocator_type get_allocator() const; ``` [heading Description]
  5056. If a class derived from [link beast.ref.boost__beast__async_base `async_base`] is a completion handler, then the object returned from this function will be used as the associated allocator of the derived class. [endsect] [section:get_executor stable_async_base::get_executor] (Inherited from `async_base`) [indexterm2 get_executor..stable_async_base]
  5057. Returns the executor associated with this object. [heading Synopsis] ``` executor_type get_executor() const; ``` [heading Description]
  5058. If a class derived from [link beast.ref.boost__beast__async_base `async_base`] is a completion handler, then the object returned from this function will be used as the associated executor of the derived class. [endsect] [section:handler stable_async_base::handler] (Inherited from `async_base`) [indexterm2 handler..stable_async_base]
  5059. Returns the handler associated with this object. [heading Synopsis] ``` Handler const & handler() const; ``` [heading Description] [endsect] [section:release_handler stable_async_base::release_handler] (Inherited from `async_base`) [indexterm2 release_handler..stable_async_base]
  5060. Returns ownership of the handler associated with this object. [heading Synopsis] ``` Handler release_handler(); ``` [heading Description]
  5061. This function is used to transfer ownership of the handler to the caller, by move-construction. After the move, the only valid operations on the base object are move construction and destruction. [endsect] [section:stable_async_base stable_async_base::stable_async_base] [indexterm2 stable_async_base..stable_async_base]
  5062. Constructor. ``` template< class __Handler__> ``[link beast.ref.boost__beast__stable_async_base.stable_async_base.overload1 stable_async_base]``( Handler&& handler, Executor1 const& ex1, Allocator const& alloc = Allocator()); ``[''''&raquo;''' [link beast.ref.boost__beast__stable_async_base.stable_async_base.overload1 more...]]`` ```
  5063. Move Constructor. ``` ``[link beast.ref.boost__beast__stable_async_base.stable_async_base.overload2 stable_async_base]``( stable_async_base&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__stable_async_base.stable_async_base.overload2 more...]]`` ``` [section:overload1 stable_async_base::stable_async_base (1 of 2 overloads)]
  5064. Constructor. [heading Synopsis] ``` template< class __Handler__> stable_async_base( Handler&& handler, Executor1 const& ex1, Allocator const& alloc = Allocator()); ``` [heading Description]
  5065. [heading Parameters] [table [[Name][Description]] [[`handler`][
  5066. The final completion handler. The type of this object must meet the requirements of ['CompletionHandler]. The implementation takes ownership of the handler by performing a decay-copy. ]] [[`ex1`][
  5067. The executor associated with the implied I/O object target of the operation. The implementation shall maintain an executor work guard for the lifetime of the operation, or until the final completion handler is invoked, whichever is shorter. ]] [[`alloc`][
  5068. The allocator to be associated with objects derived from this class. If `Allocator` is default-constructible, this parameter is optional and may be omitted. ]] ]
  5069. [endsect] [section:overload2 stable_async_base::stable_async_base (2 of 2 overloads)]
  5070. Move Constructor. [heading Synopsis] ``` stable_async_base( stable_async_base&& other); ``` [heading Description] [endsect] [endsect] [section:stable_async_base_dtor_ stable_async_base::~stable_async_base] [indexterm2 ~stable_async_base..stable_async_base]
  5071. Destructor. [heading Synopsis] ``` ~stable_async_base(); ``` [heading Description]
  5072. If the completion handler was not invoked, then any state objects allocated with [link beast.ref.boost__beast__stable_async_base.allocate_stable `stable_async_base::allocate_stable`] will be destroyed here. [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__static_buffer static_buffer]
  5073. A dynamic buffer providing a fixed size, circular buffer. [heading Synopsis] Defined in header [include_file boost/beast/core/static_buffer.hpp] ``` template< std::size_t N> class static_buffer : public static_buffer_base ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_buffer.const_buffers_type [*const_buffers_type]]] [ The ConstBufferSequence used to represent the readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer.mutable_buffers_type [*mutable_buffers_type]]] [ The MutableBufferSequence used to represent the writable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer.mutable_data_type [*mutable_data_type]]] [ The MutableBufferSequence used to represent the readable bytes. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_buffer.base [*base]]] [ Returns the static_buffer_base portion of this object. ] ] [ [[link beast.ref.boost__beast__static_buffer.capacity [*capacity]]] [ Return the maximum sum of input and output sizes that can be held without an allocation. ] ] [ [[link beast.ref.boost__beast__static_buffer.cdata [*cdata]]] [ Returns a constant buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer.clear [*clear]]] [ Clear the readable and writable bytes to zero. ] ] [ [[link beast.ref.boost__beast__static_buffer.commit [*commit]]] [ Append writable bytes to the readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer.consume [*consume]]] [ Remove bytes from beginning of the readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer.data [*data]]] [ Returns a constant buffer sequence representing the readable bytes. Returns a mutable buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer.max_size [*max_size]]] [ Return the maximum sum of the input and output sequence sizes. ] ] [ [[link beast.ref.boost__beast__static_buffer.operator_eq_ [*operator=]]] [ Assignment. ] ] [ [[link beast.ref.boost__beast__static_buffer.prepare [*prepare]]] [ Returns a mutable buffer sequence representing writable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer.size [*size]]] [ Returns the number of readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer.static_buffer [*static_buffer]]] [ Constructor. ] ] ] [heading Description]
  5074. A dynamic buffer encapsulates memory storage that may be automatically resized as required, where the memory is divided into two regions: readable bytes followed by writable bytes. These memory regions are internal to the dynamic buffer, but direct access to the elements is provided to permit them to be efficiently used with I/O operations.
  5075. Objects of this type meet the requirements of ['DynamicBuffer] and have the following additional properties:
  5076. * A mutable buffer sequence representing the readable bytes is returned by [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] when `this` is non-const.
  5077. * Buffer sequences representing the readable and writable bytes, returned by [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] and [link beast.ref.boost__beast__static_buffer.prepare `static_buffer::prepare`], may have length up to two.
  5078. * All operations execute in constant time.
  5079. [heading Template Parameters] [table [[Type][Description]] [[`N`][
  5080. The number of bytes in the internal buffer. ]] ]
  5081. [heading Remarks]
  5082. To reduce the number of template instantiations when passing objects of this type in a deduced context, the signature of the receiving function should use [link beast.ref.boost__beast__static_buffer_base `static_buffer_base`] instead.
  5083. [heading See Also]
  5084. [link beast.ref.boost__beast__static_buffer_base `static_buffer_base`]
  5085. [section:base static_buffer::base] [indexterm2 base..static_buffer]
  5086. Returns the [link beast.ref.boost__beast__static_buffer_base `static_buffer_base`] portion of this object. ``` static_buffer_base& ``[link beast.ref.boost__beast__static_buffer.base.overload1 base]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_buffer.base.overload1 more...]]`` static_buffer_base const & ``[link beast.ref.boost__beast__static_buffer.base.overload2 base]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_buffer.base.overload2 more...]]`` ``` [section:overload1 static_buffer::base (1 of 2 overloads)]
  5087. Returns the [link beast.ref.boost__beast__static_buffer_base `static_buffer_base`] portion of this object. [heading Synopsis] ``` static_buffer_base& base(); ``` [heading Description] [endsect] [section:overload2 static_buffer::base (2 of 2 overloads)]
  5088. Returns the [link beast.ref.boost__beast__static_buffer_base `static_buffer_base`] portion of this object. [heading Synopsis] ``` static_buffer_base const & base() const; ``` [heading Description] [endsect] [endsect] [section:capacity static_buffer::capacity] [indexterm2 capacity..static_buffer]
  5089. Return the maximum sum of input and output sizes that can be held without an allocation. [heading Synopsis] ``` std::size_t constexpr capacity() const; ``` [heading Description] [endsect] [section:cdata static_buffer::cdata] [indexterm2 cdata..static_buffer]
  5090. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type cdata() const; ``` [heading Description] [endsect] [section:clear static_buffer::clear] [indexterm2 clear..static_buffer]
  5091. Clear the readable and writable bytes to zero. [heading Synopsis] ``` void clear(); ``` [heading Description]
  5092. This function causes the readable and writable bytes to become empty. The capacity is not changed.
  5093. Buffer sequences previously obtained using [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] or [link beast.ref.boost__beast__static_buffer.prepare `static_buffer::prepare`] become invalid.
  5094. [heading Exception Safety]
  5095. No-throw guarantee. [endsect] [section:commit static_buffer::commit] [indexterm2 commit..static_buffer]
  5096. Append writable bytes to the readable bytes. [heading Synopsis] ``` void commit( std::size_t n); ``` [heading Description]
  5097. Appends n bytes from the start of the writable bytes to the end of the readable bytes. The remainder of the writable bytes are discarded. If n is greater than the number of writable bytes, all writable bytes are appended to the readable bytes.
  5098. All buffers sequences previously obtained using [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] or [link beast.ref.boost__beast__static_buffer.prepare `static_buffer::prepare`] are invalidated.
  5099. [heading Parameters] [table [[Name][Description]] [[`n`][
  5100. The number of bytes to append. If this number is greater than the number of writable bytes, all writable bytes are appended. ]] ]
  5101. [heading Exception Safety]
  5102. No-throw guarantee. [endsect] [section:const_buffers_type static_buffer::const_buffers_type] [indexterm2 const_buffers_type..static_buffer]
  5103. The ConstBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using const_buffers_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:consume static_buffer::consume] [indexterm2 consume..static_buffer]
  5104. Remove bytes from beginning of the readable bytes. [heading Synopsis] ``` void consume( std::size_t n); ``` [heading Description]
  5105. Removes n bytes from the beginning of the readable bytes.
  5106. All buffers sequences previously obtained using [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] or [link beast.ref.boost__beast__static_buffer.prepare `static_buffer::prepare`] are invalidated.
  5107. [heading Parameters] [table [[Name][Description]] [[`n`][
  5108. The number of bytes to remove. If this number is greater than the number of readable bytes, all readable bytes are removed. ]] ]
  5109. [heading Exception Safety]
  5110. No-throw guarantee. [endsect] [section:data static_buffer::data] [indexterm2 data..static_buffer]
  5111. Returns a constant buffer sequence representing the readable bytes. ``` const_buffers_type ``[link beast.ref.boost__beast__static_buffer.data.overload1 data]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_buffer.data.overload1 more...]]`` ```
  5112. Returns a mutable buffer sequence representing the readable bytes. ``` mutable_data_type ``[link beast.ref.boost__beast__static_buffer.data.overload2 data]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_buffer.data.overload2 more...]]`` ``` [section:overload1 static_buffer::data (1 of 2 overloads)]
  5113. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type data() const; ``` [heading Description] [endsect] [section:overload2 static_buffer::data (2 of 2 overloads)]
  5114. Returns a mutable buffer sequence representing the readable bytes. [heading Synopsis] ``` mutable_data_type data(); ``` [heading Description] [endsect] [endsect] [section:max_size static_buffer::max_size] [indexterm2 max_size..static_buffer]
  5115. Return the maximum sum of the input and output sequence sizes. [heading Synopsis] ``` std::size_t constexpr max_size() const; ``` [heading Description] [endsect] [section:mutable_buffers_type static_buffer::mutable_buffers_type] [indexterm2 mutable_buffers_type..static_buffer]
  5116. The MutableBufferSequence used to represent the writable bytes. [heading Synopsis] ``` using mutable_buffers_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:mutable_data_type static_buffer::mutable_data_type] [indexterm2 mutable_data_type..static_buffer]
  5117. The MutableBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using mutable_data_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:operator_eq_ static_buffer::operator=] [indexterm2 operator=..static_buffer]
  5118. Assignment. [heading Synopsis] ``` static_buffer& operator=( static_buffer const&); ``` [heading Description] [endsect] [section:prepare static_buffer::prepare] [indexterm2 prepare..static_buffer]
  5119. Returns a mutable buffer sequence representing writable bytes. [heading Synopsis] ``` mutable_buffers_type prepare( std::size_t n); ``` [heading Description]
  5120. Returns a mutable buffer sequence representing the writable bytes containing exactly `n` bytes of storage. Memory may be reallocated as needed.
  5121. All buffers sequences previously obtained using [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] or [link beast.ref.boost__beast__static_buffer.prepare `static_buffer::prepare`] are invalidated.
  5122. [heading Parameters] [table [[Name][Description]] [[`n`][
  5123. The desired number of bytes in the returned buffer sequence. ]] ]
  5124. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  5125. if `size() + n` exceeds `max_size()`. ]] ]
  5126. [heading Exception Safety]
  5127. Strong guarantee. [endsect] [section:size static_buffer::size] [indexterm2 size..static_buffer]
  5128. Returns the number of readable bytes. [heading Synopsis] ``` std::size_t size() const; ``` [heading Description] [endsect] [section:static_buffer static_buffer::static_buffer] [indexterm2 static_buffer..static_buffer]
  5129. Constructor. ``` ``[link beast.ref.boost__beast__static_buffer.static_buffer.overload1 static_buffer]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_buffer.static_buffer.overload1 more...]]`` ``[link beast.ref.boost__beast__static_buffer.static_buffer.overload2 static_buffer]``( static_buffer const&); ``[''''&raquo;''' [link beast.ref.boost__beast__static_buffer.static_buffer.overload2 more...]]`` ``` [section:overload1 static_buffer::static_buffer (1 of 2 overloads)]
  5130. Constructor. [heading Synopsis] ``` static_buffer(); ``` [heading Description] [endsect] [section:overload2 static_buffer::static_buffer (2 of 2 overloads)]
  5131. Constructor. [heading Synopsis] ``` static_buffer( static_buffer const&); ``` [heading Description] [endsect] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__static_buffer_base static_buffer_base]
  5132. A dynamic buffer providing a fixed size, circular buffer. [heading Synopsis] Defined in header [include_file boost/beast/core/static_buffer.hpp] ``` class static_buffer_base ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_buffer_base.const_buffers_type [*const_buffers_type]]] [ The ConstBufferSequence used to represent the readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer_base.mutable_buffers_type [*mutable_buffers_type]]] [ The MutableBufferSequence used to represent the writable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer_base.mutable_data_type [*mutable_data_type]]] [ The MutableBufferSequence used to represent the readable bytes. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_buffer_base.capacity [*capacity]]] [ Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. ] ] [ [[link beast.ref.boost__beast__static_buffer_base.cdata [*cdata]]] [ Returns a constant buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer_base.clear [*clear]]] [ Clear the readable and writable bytes to zero. ] ] [ [[link beast.ref.boost__beast__static_buffer_base.commit [*commit]]] [ Append writable bytes to the readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer_base.consume [*consume]]] [ Remove bytes from beginning of the readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer_base.data [*data]]] [ Returns a constant buffer sequence representing the readable bytes. Returns a mutable buffer sequence representing the readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer_base.max_size [*max_size]]] [ Return the maximum number of bytes, both readable and writable, that can ever be held. ] ] [ [[link beast.ref.boost__beast__static_buffer_base.prepare [*prepare]]] [ Returns a mutable buffer sequence representing writable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer_base.size [*size]]] [ Returns the number of readable bytes. ] ] [ [[link beast.ref.boost__beast__static_buffer_base.static_buffer_base [*static_buffer_base]]] [ Constructor. ] ] ] [heading Description]
  5133. A dynamic buffer encapsulates memory storage that may be automatically resized as required, where the memory is divided into two regions: readable bytes followed by writable bytes. These memory regions are internal to the dynamic buffer, but direct access to the elements is provided to permit them to be efficiently used with I/O operations.
  5134. Objects of this type meet the requirements of ['DynamicBuffer] and have the following additional properties:
  5135. * A mutable buffer sequence representing the readable bytes is returned by [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] when `this` is non-const.
  5136. * Buffer sequences representing the readable and writable bytes, returned by [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] and [link beast.ref.boost__beast__static_buffer.prepare `static_buffer::prepare`], may have length up to two.
  5137. * All operations execute in constant time.
  5138. * Ownership of the underlying storage belongs to the derived class.
  5139. [heading Remarks]
  5140. Variables are usually declared using the template class [link beast.ref.boost__beast__static_buffer `static_buffer`]; however, to reduce the number of template instantiations, objects should be passed `static_buffer_base&`.
  5141. [heading See Also]
  5142. [link beast.ref.boost__beast__static_buffer `static_buffer`]
  5143. [section:capacity static_buffer_base::capacity] [indexterm2 capacity..static_buffer_base]
  5144. Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. [heading Synopsis] ``` std::size_t capacity() const; ``` [heading Description] [endsect] [section:cdata static_buffer_base::cdata] [indexterm2 cdata..static_buffer_base]
  5145. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type cdata() const; ``` [heading Description] [endsect] [section:clear static_buffer_base::clear] [indexterm2 clear..static_buffer_base]
  5146. Clear the readable and writable bytes to zero. [heading Synopsis] ``` void clear(); ``` [heading Description]
  5147. This function causes the readable and writable bytes to become empty. The capacity is not changed.
  5148. Buffer sequences previously obtained using [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] or [link beast.ref.boost__beast__static_buffer.prepare `static_buffer::prepare`] become invalid.
  5149. [heading Exception Safety]
  5150. No-throw guarantee. [endsect] [section:commit static_buffer_base::commit] [indexterm2 commit..static_buffer_base]
  5151. Append writable bytes to the readable bytes. [heading Synopsis] ``` void commit( std::size_t n); ``` [heading Description]
  5152. Appends n bytes from the start of the writable bytes to the end of the readable bytes. The remainder of the writable bytes are discarded. If n is greater than the number of writable bytes, all writable bytes are appended to the readable bytes.
  5153. All buffers sequences previously obtained using [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] or [link beast.ref.boost__beast__static_buffer.prepare `static_buffer::prepare`] are invalidated.
  5154. [heading Parameters] [table [[Name][Description]] [[`n`][
  5155. The number of bytes to append. If this number is greater than the number of writable bytes, all writable bytes are appended. ]] ]
  5156. [heading Exception Safety]
  5157. No-throw guarantee. [endsect] [section:const_buffers_type static_buffer_base::const_buffers_type] [indexterm2 const_buffers_type..static_buffer_base]
  5158. The ConstBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using const_buffers_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:consume static_buffer_base::consume] [indexterm2 consume..static_buffer_base]
  5159. Remove bytes from beginning of the readable bytes. [heading Synopsis] ``` void consume( std::size_t n); ``` [heading Description]
  5160. Removes n bytes from the beginning of the readable bytes.
  5161. All buffers sequences previously obtained using [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] or [link beast.ref.boost__beast__static_buffer.prepare `static_buffer::prepare`] are invalidated.
  5162. [heading Parameters] [table [[Name][Description]] [[`n`][
  5163. The number of bytes to remove. If this number is greater than the number of readable bytes, all readable bytes are removed. ]] ]
  5164. [heading Exception Safety]
  5165. No-throw guarantee. [endsect] [section:data static_buffer_base::data] [indexterm2 data..static_buffer_base]
  5166. Returns a constant buffer sequence representing the readable bytes. ``` const_buffers_type ``[link beast.ref.boost__beast__static_buffer_base.data.overload1 data]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_buffer_base.data.overload1 more...]]`` ```
  5167. Returns a mutable buffer sequence representing the readable bytes. ``` mutable_data_type ``[link beast.ref.boost__beast__static_buffer_base.data.overload2 data]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_buffer_base.data.overload2 more...]]`` ``` [section:overload1 static_buffer_base::data (1 of 2 overloads)]
  5168. Returns a constant buffer sequence representing the readable bytes. [heading Synopsis] ``` const_buffers_type data() const; ``` [heading Description] [endsect] [section:overload2 static_buffer_base::data (2 of 2 overloads)]
  5169. Returns a mutable buffer sequence representing the readable bytes. [heading Synopsis] ``` mutable_data_type data(); ``` [heading Description] [endsect] [endsect] [section:max_size static_buffer_base::max_size] [indexterm2 max_size..static_buffer_base]
  5170. Return the maximum number of bytes, both readable and writable, that can ever be held. [heading Synopsis] ``` std::size_t max_size() const; ``` [heading Description] [endsect] [section:mutable_buffers_type static_buffer_base::mutable_buffers_type] [indexterm2 mutable_buffers_type..static_buffer_base]
  5171. The MutableBufferSequence used to represent the writable bytes. [heading Synopsis] ``` using mutable_buffers_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:mutable_data_type static_buffer_base::mutable_data_type] [indexterm2 mutable_data_type..static_buffer_base]
  5172. The MutableBufferSequence used to represent the readable bytes. [heading Synopsis] ``` using mutable_data_type = ``['implementation-defined]``; ``` [heading Description] [endsect] [section:prepare static_buffer_base::prepare] [indexterm2 prepare..static_buffer_base]
  5173. Returns a mutable buffer sequence representing writable bytes. [heading Synopsis] ``` mutable_buffers_type prepare( std::size_t n); ``` [heading Description]
  5174. Returns a mutable buffer sequence representing the writable bytes containing exactly `n` bytes of storage. Memory may be reallocated as needed.
  5175. All buffers sequences previously obtained using [link beast.ref.boost__beast__static_buffer.data `static_buffer::data`] or [link beast.ref.boost__beast__static_buffer.prepare `static_buffer::prepare`] are invalidated.
  5176. [heading Parameters] [table [[Name][Description]] [[`n`][
  5177. The desired number of bytes in the returned buffer sequence. ]] ]
  5178. [heading Exceptions] [table [[Type][Thrown On]] [[`std::length_error`][
  5179. if `size() + n` exceeds `max_size()`. ]] ]
  5180. [heading Exception Safety]
  5181. Strong guarantee. [endsect] [section:size static_buffer_base::size] [indexterm2 size..static_buffer_base]
  5182. Returns the number of readable bytes. [heading Synopsis] ``` std::size_t size() const; ``` [heading Description] [endsect] [section:static_buffer_base static_buffer_base::static_buffer_base] [indexterm2 static_buffer_base..static_buffer_base]
  5183. Constructor. [heading Synopsis] ``` static_buffer_base( void* p, std::size_t size); ``` [heading Description]
  5184. This creates a dynamic buffer using the provided storage area.
  5185. [heading Parameters] [table [[Name][Description]] [[`p`][
  5186. A pointer to valid storage of at least `n` bytes. ]] [[`size`][
  5187. The number of valid bytes pointed to by `p`. ]] ]
  5188. [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__static_string static_string]
  5189. A modifiable string with a fixed-size storage area. [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT = char, class Traits = std::char_traits<CharT>> class static_string ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_string.const_iterator [*const_iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.const_pointer [*const_pointer]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.const_reference [*const_reference]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.const_reverse_iterator [*const_reverse_iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.difference_type [*difference_type]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.iterator [*iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.pointer [*pointer]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.reference [*reference]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.reverse_iterator [*reverse_iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.size_type [*size_type]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.string_view_type [*string_view_type]]] [ The type of string_view returned by the interface. ] ] [ [[link beast.ref.boost__beast__static_string.traits_type [*traits_type]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.value_type [*value_type]]] [ ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_string.append [*append]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.assign [*assign]]] [ Assign count copies of ch. Assign from another static_string Assign count characterss starting at npos from other. Assign the first count characters of s, including nulls. Assign a null terminated string. Assign from an iterator range of characters. Assign from any object convertible to string_view_type. ] ] [ [[link beast.ref.boost__beast__static_string.at [*at]]] [ Access specified character with bounds checking. ] ] [ [[link beast.ref.boost__beast__static_string.back [*back]]] [ Accesses the last character. ] ] [ [[link beast.ref.boost__beast__static_string.begin [*begin]]] [ Returns an iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.c_str [*c_str]]] [ Returns a non-modifiable standard C character array version of the string. ] ] [ [[link beast.ref.boost__beast__static_string.capacity [*capacity]]] [ Returns the number of characters that can be held in currently allocated storage. ] ] [ [[link beast.ref.boost__beast__static_string.cbegin [*cbegin]]] [ Returns an iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.cend [*cend]]] [ Returns an iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.clear [*clear]]] [ Clears the contents. ] ] [ [[link beast.ref.boost__beast__static_string.compare [*compare]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.copy [*copy]]] [ Copy a substring (pos, pos+count) to character string pointed to by dest. ] ] [ [[link beast.ref.boost__beast__static_string.crbegin [*crbegin]]] [ Returns a reverse iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.crend [*crend]]] [ Returns a reverse iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.data [*data]]] [ Returns a pointer to the first character of a string. ] ] [ [[link beast.ref.boost__beast__static_string.empty [*empty]]] [ Returns true if the string is empty. ] ] [ [[link beast.ref.boost__beast__static_string.end [*end]]] [ Returns an iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.erase [*erase]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.front [*front]]] [ Accesses the first character. ] ] [ [[link beast.ref.boost__beast__static_string.insert [*insert]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.length [*length]]] [ Returns the number of characters, excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.max_size [*max_size]]] [ Returns the maximum number of characters that can be stored, excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.operator_string_view_type [*operator string_view_type]]] [ Convert a static string to a string_view_type ] ] [ [[link beast.ref.boost__beast__static_string.operator_plus__eq_ [*operator+=]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.operator_eq_ [*operator=]]] [ Copy assignment. Assign from null-terminated string. Assign from single character. Assign from initializer list. Assign from string_view_type. ] ] [ [[link beast.ref.boost__beast__static_string.operator_lb__rb_ [*operator\[\]]]] [ Access specified character. ] ] [ [[link beast.ref.boost__beast__static_string.pop_back [*pop_back]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.push_back [*push_back]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.rbegin [*rbegin]]] [ Returns a reverse iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.rend [*rend]]] [ Returns a reverse iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.reserve [*reserve]]] [ Reserves storage. ] ] [ [[link beast.ref.boost__beast__static_string.resize [*resize]]] [ Changes the number of characters stored. ] ] [ [[link beast.ref.boost__beast__static_string.shrink_to_fit [*shrink_to_fit]]] [ Reduces memory usage by freeing unused memory. ] ] [ [[link beast.ref.boost__beast__static_string.size [*size]]] [ Returns the number of characters, excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.static_string [*static_string]]] [ Default constructor (empty string). Construct with count copies of character ch. Construct with a substring (pos, other.size()) of other. Construct with a substring (pos, count) of other. Construct with the first count characters of s, including nulls. Construct from a null terminated string. Construct from a range of characters. Copy constructor. Construct from an initializer list. Construct from a string_view Construct from any object convertible to string_view_type. ] ] [ [[link beast.ref.boost__beast__static_string.substr [*substr]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.swap [*swap]]] [ Exchange the contents of this string with another. ] ] ] [heading Data Members] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_string.max_size_n [*max_size_n]]] [ Maximum size of the string excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.npos [*npos]]] [ A special index. ] ] ] [heading Description]
  5190. These objects behave like `std::string` except that the storage is not dynamically allocated but rather fixed in size.
  5191. These strings offer performance advantages when a protocol imposes a natural small upper limit on the size of a value.
  5192. [heading Remarks]
  5193. The stored string is always null-terminated.
  5194. [heading See Also]
  5195. [link beast.ref.boost__beast__to_static_string `to_static_string`]
  5196. [section:append static_string::append] [indexterm2 append..static_string] ``` static_string& ``[link beast.ref.boost__beast__static_string.append.overload1 append]``( size_type count, CharT ch); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.append.overload1 more...]]`` template< std::size_t M> static_string& ``[link beast.ref.boost__beast__static_string.append.overload2 append]``( static_string< M, CharT, Traits > const& str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.append.overload2 more...]]`` template< std::size_t M> static_string& ``[link beast.ref.boost__beast__static_string.append.overload3 append]``( static_string< M, CharT, Traits > const& str, size_type pos, size_type count = npos); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.append.overload3 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.append.overload4 append]``( CharT const* s, size_type count); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.append.overload4 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.append.overload5 append]``( CharT const* s); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.append.overload5 more...]]`` template< class InputIt> static_string& ``[link beast.ref.boost__beast__static_string.append.overload6 append]``( InputIt first, InputIt last); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.append.overload6 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.append.overload7 append]``( std::initializer_list< CharT > init); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.append.overload7 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.append.overload8 append]``( string_view_type sv); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.append.overload8 more...]]`` template< class T> std::enable_if< std::is_convertible< T const &, string_view_type >::value &&! std::is_convertible< T const &, CharT const * >::value, static_string & >::type ``[link beast.ref.boost__beast__static_string.append.overload9 append]``( T const& t, size_type pos, size_type count = npos); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.append.overload9 more...]]`` ``` [section:overload1 static_string::append (1 of 9 overloads)] [heading Synopsis] ``` static_string& append( size_type count, CharT ch); ``` [heading Description] [endsect] [section:overload2 static_string::append (2 of 9 overloads)] [heading Synopsis] ``` template< std::size_t M> static_string& append( static_string< M, CharT, Traits > const& str); ``` [heading Description] [endsect] [section:overload3 static_string::append (3 of 9 overloads)] [heading Synopsis] ``` template< std::size_t M> static_string& append( static_string< M, CharT, Traits > const& str, size_type pos, size_type count = npos); ``` [heading Description] [endsect] [section:overload4 static_string::append (4 of 9 overloads)] [heading Synopsis] ``` static_string& append( CharT const* s, size_type count); ``` [heading Description] [endsect] [section:overload5 static_string::append (5 of 9 overloads)] [heading Synopsis] ``` static_string& append( CharT const* s); ``` [heading Description] [endsect] [section:overload6 static_string::append (6 of 9 overloads)] [heading Synopsis] ``` template< class InputIt> static_string& append( InputIt first, InputIt last); ``` [heading Description] [endsect] [section:overload7 static_string::append (7 of 9 overloads)] [heading Synopsis] ``` static_string& append( std::initializer_list< CharT > init); ``` [heading Description] [endsect] [section:overload8 static_string::append (8 of 9 overloads)] [heading Synopsis] ``` static_string& append( string_view_type sv); ``` [heading Description] [endsect] [section:overload9 static_string::append (9 of 9 overloads)] [heading Synopsis] ``` template< class T> std::enable_if< std::is_convertible< T const &, string_view_type >::value &&! std::is_convertible< T const &, CharT const * >::value, static_string & >::type append( T const& t, size_type pos, size_type count = npos); ``` [heading Description] [endsect] [endsect] [section:assign static_string::assign] [indexterm2 assign..static_string]
  5197. Assign `count` copies of `ch`. ``` static_string& ``[link beast.ref.boost__beast__static_string.assign.overload1 assign]``( size_type count, CharT ch); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.assign.overload1 more...]]`` ```
  5198. Assign from another `static_string` ``` static_string& ``[link beast.ref.boost__beast__static_string.assign.overload2 assign]``( static_string const& str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.assign.overload2 more...]]`` template< std::size_t M> static_string& ``[link beast.ref.boost__beast__static_string.assign.overload3 assign]``( static_string< M, CharT, Traits > const& str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.assign.overload3 more...]]`` ```
  5199. Assign `count` characterss starting at `npos` from `other`. ``` template< std::size_t M> static_string& ``[link beast.ref.boost__beast__static_string.assign.overload4 assign]``( static_string< M, CharT, Traits > const& str, size_type pos, size_type count = npos); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.assign.overload4 more...]]`` ```
  5200. Assign the first `count` characters of `s`, including nulls. ``` static_string& ``[link beast.ref.boost__beast__static_string.assign.overload5 assign]``( CharT const* s, size_type count); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.assign.overload5 more...]]`` ```
  5201. Assign a null terminated string. ``` static_string& ``[link beast.ref.boost__beast__static_string.assign.overload6 assign]``( CharT const* s); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.assign.overload6 more...]]`` ```
  5202. Assign from an iterator range of characters. ``` template< class InputIt> static_string& ``[link beast.ref.boost__beast__static_string.assign.overload7 assign]``( InputIt first, InputIt last); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.assign.overload7 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.assign.overload8 assign]``( std::initializer_list< CharT > init); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.assign.overload8 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.assign.overload9 assign]``( string_view_type str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.assign.overload9 more...]]`` ```
  5203. Assign from any object convertible to `string_view_type`. ``` template< class T> static_string& ``[link beast.ref.boost__beast__static_string.assign.overload10 assign]``( T const& t, size_type pos, size_type count = npos); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.assign.overload10 more...]]`` ``` [section:overload1 static_string::assign (1 of 10 overloads)]
  5204. Assign `count` copies of `ch`. [heading Synopsis] ``` static_string& assign( size_type count, CharT ch); ``` [heading Description] [endsect] [section:overload2 static_string::assign (2 of 10 overloads)]
  5205. Assign from another `static_string` [heading Synopsis] ``` static_string& assign( static_string const& str); ``` [heading Description] [endsect] [section:overload3 static_string::assign (3 of 10 overloads)]
  5206. Assign from another `static_string` [heading Synopsis] ``` template< std::size_t M> static_string& assign( static_string< M, CharT, Traits > const& str); ``` [heading Description] [endsect] [section:overload4 static_string::assign (4 of 10 overloads)]
  5207. Assign `count` characterss starting at `npos` from `other`. [heading Synopsis] ``` template< std::size_t M> static_string& assign( static_string< M, CharT, Traits > const& str, size_type pos, size_type count = npos); ``` [heading Description] [endsect] [section:overload5 static_string::assign (5 of 10 overloads)]
  5208. Assign the first `count` characters of `s`, including nulls. [heading Synopsis] ``` static_string& assign( CharT const* s, size_type count); ``` [heading Description] [endsect] [section:overload6 static_string::assign (6 of 10 overloads)]
  5209. Assign a null terminated string. [heading Synopsis] ``` static_string& assign( CharT const* s); ``` [heading Description] [endsect] [section:overload7 static_string::assign (7 of 10 overloads)]
  5210. Assign from an iterator range of characters. [heading Synopsis] ``` template< class InputIt> static_string& assign( InputIt first, InputIt last); ``` [heading Description] [endsect] [section:overload8 static_string::assign (8 of 10 overloads)]
  5211. Assign from initializer list. [heading Synopsis] ``` static_string& assign( std::initializer_list< CharT > init); ``` [heading Description] [endsect] [section:overload9 static_string::assign (9 of 10 overloads)]
  5212. Assign from `string_view_type`. [heading Synopsis] ``` static_string& assign( string_view_type str); ``` [heading Description] [endsect] [section:overload10 static_string::assign (10 of 10 overloads)]
  5213. Assign from any object convertible to `string_view_type`. [heading Synopsis] ``` template< class T> static_string& assign( T const& t, size_type pos, size_type count = npos); ``` [heading Description]
  5214. The range (pos, n) is extracted from the value obtained by converting `t` to `string_view_type`, and used to assign the string. [endsect] [endsect] [section:at static_string::at] [indexterm2 at..static_string]
  5215. Access specified character with bounds checking. ``` reference ``[link beast.ref.boost__beast__static_string.at.overload1 at]``( size_type pos); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.at.overload1 more...]]`` const_reference ``[link beast.ref.boost__beast__static_string.at.overload2 at]``( size_type pos) const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.at.overload2 more...]]`` ``` [section:overload1 static_string::at (1 of 2 overloads)]
  5216. Access specified character with bounds checking. [heading Synopsis] ``` reference at( size_type pos); ``` [heading Description] [endsect] [section:overload2 static_string::at (2 of 2 overloads)]
  5217. Access specified character with bounds checking. [heading Synopsis] ``` const_reference at( size_type pos) const; ``` [heading Description] [endsect] [endsect] [section:back static_string::back] [indexterm2 back..static_string]
  5218. Accesses the last character. ``` CharT& ``[link beast.ref.boost__beast__static_string.back.overload1 back]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.back.overload1 more...]]`` CharT const & ``[link beast.ref.boost__beast__static_string.back.overload2 back]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.back.overload2 more...]]`` ``` [section:overload1 static_string::back (1 of 2 overloads)]
  5219. Accesses the last character. [heading Synopsis] ``` CharT& back(); ``` [heading Description] [endsect] [section:overload2 static_string::back (2 of 2 overloads)]
  5220. Accesses the last character. [heading Synopsis] ``` CharT const & back() const; ``` [heading Description] [endsect] [endsect] [section:begin static_string::begin] [indexterm2 begin..static_string]
  5221. Returns an iterator to the beginning. ``` iterator ``[link beast.ref.boost__beast__static_string.begin.overload1 begin]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.begin.overload1 more...]]`` const_iterator ``[link beast.ref.boost__beast__static_string.begin.overload2 begin]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.begin.overload2 more...]]`` ``` [section:overload1 static_string::begin (1 of 2 overloads)]
  5222. Returns an iterator to the beginning. [heading Synopsis] ``` iterator begin(); ``` [heading Description] [endsect] [section:overload2 static_string::begin (2 of 2 overloads)]
  5223. Returns an iterator to the beginning. [heading Synopsis] ``` const_iterator begin() const; ``` [heading Description] [endsect] [endsect] [section:c_str static_string::c_str] [indexterm2 c_str..static_string]
  5224. Returns a non-modifiable standard C character array version of the string. [heading Synopsis] ``` CharT const * c_str() const; ``` [heading Description] [endsect] [section:capacity static_string::capacity] [indexterm2 capacity..static_string]
  5225. Returns the number of characters that can be held in currently allocated storage. [heading Synopsis] ``` size_type constexpr capacity() const; ``` [heading Description] [endsect] [section:cbegin static_string::cbegin] [indexterm2 cbegin..static_string]
  5226. Returns an iterator to the beginning. [heading Synopsis] ``` const_iterator cbegin() const; ``` [heading Description] [endsect] [section:cend static_string::cend] [indexterm2 cend..static_string]
  5227. Returns an iterator to the end. [heading Synopsis] ``` const_iterator cend() const; ``` [heading Description] [endsect] [section:clear static_string::clear] [indexterm2 clear..static_string]
  5228. Clears the contents. [heading Synopsis] ``` void clear(); ``` [heading Description] [endsect] [section:compare static_string::compare] [indexterm2 compare..static_string] ``` template< std::size_t M> int ``[link beast.ref.boost__beast__static_string.compare.overload1 compare]``( static_string< M, CharT, Traits > const& str) const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.compare.overload1 more...]]`` template< std::size_t M> int ``[link beast.ref.boost__beast__static_string.compare.overload2 compare]``( size_type pos1, size_type count1, static_string< M, CharT, Traits > const& str) const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.compare.overload2 more...]]`` template< std::size_t M> int ``[link beast.ref.boost__beast__static_string.compare.overload3 compare]``( size_type pos1, size_type count1, static_string< M, CharT, Traits > const& str, size_type pos2, size_type count2 = npos) const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.compare.overload3 more...]]`` int ``[link beast.ref.boost__beast__static_string.compare.overload4 compare]``( CharT const* s) const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.compare.overload4 more...]]`` int ``[link beast.ref.boost__beast__static_string.compare.overload5 compare]``( size_type pos1, size_type count1, CharT const* s) const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.compare.overload5 more...]]`` int ``[link beast.ref.boost__beast__static_string.compare.overload6 compare]``( size_type pos1, size_type count1, CharT const* s, size_type count2) const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.compare.overload6 more...]]`` int ``[link beast.ref.boost__beast__static_string.compare.overload7 compare]``( string_view_type str) const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.compare.overload7 more...]]`` int ``[link beast.ref.boost__beast__static_string.compare.overload8 compare]``( size_type pos1, size_type count1, string_view_type str) const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.compare.overload8 more...]]`` template< class T> int ``[link beast.ref.boost__beast__static_string.compare.overload9 compare]``( size_type pos1, size_type count1, T const& t, size_type pos2, size_type count2 = npos) const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.compare.overload9 more...]]`` ``` [section:overload1 static_string::compare (1 of 9 overloads)] [heading Synopsis] ``` template< std::size_t M> int compare( static_string< M, CharT, Traits > const& str) const; ``` [heading Description] [endsect] [section:overload2 static_string::compare (2 of 9 overloads)] [heading Synopsis] ``` template< std::size_t M> int compare( size_type pos1, size_type count1, static_string< M, CharT, Traits > const& str) const; ``` [heading Description] [endsect] [section:overload3 static_string::compare (3 of 9 overloads)] [heading Synopsis] ``` template< std::size_t M> int compare( size_type pos1, size_type count1, static_string< M, CharT, Traits > const& str, size_type pos2, size_type count2 = npos) const; ``` [heading Description] [endsect] [section:overload4 static_string::compare (4 of 9 overloads)] [heading Synopsis] ``` int compare( CharT const* s) const; ``` [heading Description] [endsect] [section:overload5 static_string::compare (5 of 9 overloads)] [heading Synopsis] ``` int compare( size_type pos1, size_type count1, CharT const* s) const; ``` [heading Description] [endsect] [section:overload6 static_string::compare (6 of 9 overloads)] [heading Synopsis] ``` int compare( size_type pos1, size_type count1, CharT const* s, size_type count2) const; ``` [heading Description] [endsect] [section:overload7 static_string::compare (7 of 9 overloads)] [heading Synopsis] ``` int compare( string_view_type str) const; ``` [heading Description] [endsect] [section:overload8 static_string::compare (8 of 9 overloads)] [heading Synopsis] ``` int compare( size_type pos1, size_type count1, string_view_type str) const; ``` [heading Description] [endsect] [section:overload9 static_string::compare (9 of 9 overloads)] [heading Synopsis] ``` template< class T> int compare( size_type pos1, size_type count1, T const& t, size_type pos2, size_type count2 = npos) const; ``` [heading Description] [endsect] [endsect] [section:const_iterator static_string::const_iterator] [indexterm2 const_iterator..static_string] [heading Synopsis] ``` using const_iterator = value_type const *; ``` [heading Description] [endsect] [section:const_pointer static_string::const_pointer] [indexterm2 const_pointer..static_string] [heading Synopsis] ``` using const_pointer = value_type const *; ``` [heading Description] [endsect] [section:const_reference static_string::const_reference] [indexterm2 const_reference..static_string] [heading Synopsis] ``` using const_reference = value_type const &; ``` [heading Description] [endsect] [section:const_reverse_iterator static_string::const_reverse_iterator] [indexterm2 const_reverse_iterator..static_string] [heading Synopsis] ``` using const_reverse_iterator = std::reverse_iterator< const_iterator >; ``` [heading Description] [endsect] [section:copy static_string::copy] [indexterm2 copy..static_string]
  5229. Copy a substring (pos, pos+count) to character string pointed to by `dest`. [heading Synopsis] ``` size_type copy( CharT* dest, size_type count, size_type pos = 0) const; ``` [heading Description] [endsect] [section:crbegin static_string::crbegin] [indexterm2 crbegin..static_string]
  5230. Returns a reverse iterator to the beginning. [heading Synopsis] ``` const_reverse_iterator crbegin() const; ``` [heading Description] [endsect] [section:crend static_string::crend] [indexterm2 crend..static_string]
  5231. Returns a reverse iterator to the end. [heading Synopsis] ``` const_reverse_iterator crend() const; ``` [heading Description] [endsect] [section:data static_string::data] [indexterm2 data..static_string]
  5232. Returns a pointer to the first character of a string. ``` CharT* ``[link beast.ref.boost__beast__static_string.data.overload1 data]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.data.overload1 more...]]`` CharT const * ``[link beast.ref.boost__beast__static_string.data.overload2 data]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.data.overload2 more...]]`` ``` [section:overload1 static_string::data (1 of 2 overloads)]
  5233. Returns a pointer to the first character of a string. [heading Synopsis] ``` CharT* data(); ``` [heading Description] [endsect] [section:overload2 static_string::data (2 of 2 overloads)]
  5234. Returns a pointer to the first character of a string. [heading Synopsis] ``` CharT const * data() const; ``` [heading Description] [endsect] [endsect] [section:difference_type static_string::difference_type] [indexterm2 difference_type..static_string] [heading Synopsis] ``` using difference_type = std::ptrdiff_t; ``` [heading Description] [endsect] [section:empty static_string::empty] [indexterm2 empty..static_string]
  5235. Returns `true` if the string is empty. [heading Synopsis] ``` bool empty() const; ``` [heading Description] [endsect] [section:end static_string::end] [indexterm2 end..static_string]
  5236. Returns an iterator to the end. ``` iterator ``[link beast.ref.boost__beast__static_string.end.overload1 end]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.end.overload1 more...]]`` const_iterator ``[link beast.ref.boost__beast__static_string.end.overload2 end]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.end.overload2 more...]]`` ``` [section:overload1 static_string::end (1 of 2 overloads)]
  5237. Returns an iterator to the end. [heading Synopsis] ``` iterator end(); ``` [heading Description] [endsect] [section:overload2 static_string::end (2 of 2 overloads)]
  5238. Returns an iterator to the end. [heading Synopsis] ``` const_iterator end() const; ``` [heading Description] [endsect] [endsect] [section:erase static_string::erase] [indexterm2 erase..static_string] ``` static_string& ``[link beast.ref.boost__beast__static_string.erase.overload1 erase]``( size_type index = 0, size_type count = npos); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.erase.overload1 more...]]`` iterator ``[link beast.ref.boost__beast__static_string.erase.overload2 erase]``( const_iterator pos); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.erase.overload2 more...]]`` iterator ``[link beast.ref.boost__beast__static_string.erase.overload3 erase]``( const_iterator first, const_iterator last); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.erase.overload3 more...]]`` ``` [section:overload1 static_string::erase (1 of 3 overloads)] [heading Synopsis] ``` static_string& erase( size_type index = 0, size_type count = npos); ``` [heading Description] [endsect] [section:overload2 static_string::erase (2 of 3 overloads)] [heading Synopsis] ``` iterator erase( const_iterator pos); ``` [heading Description] [endsect] [section:overload3 static_string::erase (3 of 3 overloads)] [heading Synopsis] ``` iterator erase( const_iterator first, const_iterator last); ``` [heading Description] [endsect] [endsect] [section:front static_string::front] [indexterm2 front..static_string]
  5239. Accesses the first character. ``` CharT& ``[link beast.ref.boost__beast__static_string.front.overload1 front]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.front.overload1 more...]]`` CharT const & ``[link beast.ref.boost__beast__static_string.front.overload2 front]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.front.overload2 more...]]`` ``` [section:overload1 static_string::front (1 of 2 overloads)]
  5240. Accesses the first character. [heading Synopsis] ``` CharT& front(); ``` [heading Description] [endsect] [section:overload2 static_string::front (2 of 2 overloads)]
  5241. Accesses the first character. [heading Synopsis] ``` CharT const & front() const; ``` [heading Description] [endsect] [endsect] [section:insert static_string::insert] [indexterm2 insert..static_string] ``` static_string& ``[link beast.ref.boost__beast__static_string.insert.overload1 insert]``( size_type index, size_type count, CharT ch); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.insert.overload1 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.insert.overload2 insert]``( size_type index, CharT const* s); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.insert.overload2 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.insert.overload3 insert]``( size_type index, CharT const* s, size_type count); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.insert.overload3 more...]]`` template< std::size_t M> static_string& ``[link beast.ref.boost__beast__static_string.insert.overload4 insert]``( size_type index, static_string< M, CharT, Traits > const& str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.insert.overload4 more...]]`` template< std::size_t M> static_string& ``[link beast.ref.boost__beast__static_string.insert.overload5 insert]``( size_type index, static_string< M, CharT, Traits > const& str, size_type index_str, size_type count = npos); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.insert.overload5 more...]]`` iterator ``[link beast.ref.boost__beast__static_string.insert.overload6 insert]``( const_iterator pos, CharT ch); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.insert.overload6 more...]]`` iterator ``[link beast.ref.boost__beast__static_string.insert.overload7 insert]``( const_iterator pos, size_type count, CharT ch); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.insert.overload7 more...]]`` template< class InputIt> iterator ``[link beast.ref.boost__beast__static_string.insert.overload8 insert]``( const_iterator pos, InputIt first, InputIt last); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.insert.overload8 more...]]`` iterator ``[link beast.ref.boost__beast__static_string.insert.overload9 insert]``( const_iterator pos, std::initializer_list< CharT > init); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.insert.overload9 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.insert.overload10 insert]``( size_type index, string_view_type str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.insert.overload10 more...]]`` template< class T> static_string& ``[link beast.ref.boost__beast__static_string.insert.overload11 insert]``( size_type index, T const& t, size_type index_str, size_type count = npos); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.insert.overload11 more...]]`` ``` [section:overload1 static_string::insert (1 of 11 overloads)] [heading Synopsis] ``` static_string& insert( size_type index, size_type count, CharT ch); ``` [heading Description] [endsect] [section:overload2 static_string::insert (2 of 11 overloads)] [heading Synopsis] ``` static_string& insert( size_type index, CharT const* s); ``` [heading Description] [endsect] [section:overload3 static_string::insert (3 of 11 overloads)] [heading Synopsis] ``` static_string& insert( size_type index, CharT const* s, size_type count); ``` [heading Description] [endsect] [section:overload4 static_string::insert (4 of 11 overloads)] [heading Synopsis] ``` template< std::size_t M> static_string& insert( size_type index, static_string< M, CharT, Traits > const& str); ``` [heading Description] [endsect] [section:overload5 static_string::insert (5 of 11 overloads)] [heading Synopsis] ``` template< std::size_t M> static_string& insert( size_type index, static_string< M, CharT, Traits > const& str, size_type index_str, size_type count = npos); ``` [heading Description] [endsect] [section:overload6 static_string::insert (6 of 11 overloads)] [heading Synopsis] ``` iterator insert( const_iterator pos, CharT ch); ``` [heading Description] [endsect] [section:overload7 static_string::insert (7 of 11 overloads)] [heading Synopsis] ``` iterator insert( const_iterator pos, size_type count, CharT ch); ``` [heading Description] [endsect] [section:overload8 static_string::insert (8 of 11 overloads)] [heading Synopsis] ``` template< class InputIt> iterator insert( const_iterator pos, InputIt first, InputIt last); ``` [heading Description] [endsect] [section:overload9 static_string::insert (9 of 11 overloads)] [heading Synopsis] ``` iterator insert( const_iterator pos, std::initializer_list< CharT > init); ``` [heading Description] [endsect] [section:overload10 static_string::insert (10 of 11 overloads)] [heading Synopsis] ``` static_string& insert( size_type index, string_view_type str); ``` [heading Description] [endsect] [section:overload11 static_string::insert (11 of 11 overloads)] [heading Synopsis] ``` template< class T> static_string& insert( size_type index, T const& t, size_type index_str, size_type count = npos); ``` [heading Description] [endsect] [endsect] [section:iterator static_string::iterator] [indexterm2 iterator..static_string] [heading Synopsis] ``` using iterator = value_type*; ``` [heading Description] [endsect] [section:length static_string::length] [indexterm2 length..static_string]
  5242. Returns the number of characters, excluding the null terminator. [heading Synopsis] ``` size_type length() const; ``` [heading Description] [endsect] [section:max_size static_string::max_size] [indexterm2 max_size..static_string]
  5243. Returns the maximum number of characters that can be stored, excluding the null terminator. [heading Synopsis] ``` size_type constexpr max_size() const; ``` [heading Description] [endsect] [section:max_size_n static_string::max_size_n] [indexterm2 max_size_n..static_string]
  5244. Maximum size of the string excluding the null terminator. [heading Synopsis] ``` static std::size_t constexpr max_size_n = N; ``` [heading Description] [endsect] [section:npos static_string::npos] [indexterm2 npos..static_string]
  5245. A special index. [heading Synopsis] ``` static constexpr size_type npos = size_type(-1); ``` [heading Description] [endsect] [section:operator_string_view_type static_string::operator string_view_type] [indexterm2 operator string_view_type..static_string]
  5246. Convert a static string to a `string_view_type` [heading Synopsis] ``` operator string_view_type() const; ``` [heading Description] [endsect] [section:operator_plus__eq_ static_string::operator+=] [indexterm2 operator+=..static_string] ``` template< std::size_t M> static_string& ``[link beast.ref.boost__beast__static_string.operator_plus__eq_.overload1 operator+=]``( static_string< M, CharT, Traits > const& str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_plus__eq_.overload1 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.operator_plus__eq_.overload2 operator+=]``( CharT ch); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_plus__eq_.overload2 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.operator_plus__eq_.overload3 operator+=]``( CharT const* s); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_plus__eq_.overload3 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.operator_plus__eq_.overload4 operator+=]``( std::initializer_list< CharT > init); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_plus__eq_.overload4 more...]]`` static_string& ``[link beast.ref.boost__beast__static_string.operator_plus__eq_.overload5 operator+=]``( string_view_type const& str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_plus__eq_.overload5 more...]]`` ``` [section:overload1 static_string::operator+= (1 of 5 overloads)] [heading Synopsis] ``` template< std::size_t M> static_string& operator+=( static_string< M, CharT, Traits > const& str); ``` [heading Description] [endsect] [section:overload2 static_string::operator+= (2 of 5 overloads)] [heading Synopsis] ``` static_string& operator+=( CharT ch); ``` [heading Description] [endsect] [section:overload3 static_string::operator+= (3 of 5 overloads)] [heading Synopsis] ``` static_string& operator+=( CharT const* s); ``` [heading Description] [endsect] [section:overload4 static_string::operator+= (4 of 5 overloads)] [heading Synopsis] ``` static_string& operator+=( std::initializer_list< CharT > init); ``` [heading Description] [endsect] [section:overload5 static_string::operator+= (5 of 5 overloads)] [heading Synopsis] ``` static_string& operator+=( string_view_type const& str); ``` [heading Description] [endsect] [endsect] [section:operator_eq_ static_string::operator=] [indexterm2 operator=..static_string]
  5247. Copy assignment. ``` static_string& ``[link beast.ref.boost__beast__static_string.operator_eq_.overload1 operator=]``( static_string const& str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_eq_.overload1 more...]]`` template< std::size_t M> static_string& ``[link beast.ref.boost__beast__static_string.operator_eq_.overload2 operator=]``( static_string< M, CharT, Traits > const& str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_eq_.overload2 more...]]`` ```
  5248. Assign from null-terminated string. ``` static_string& ``[link beast.ref.boost__beast__static_string.operator_eq_.overload3 operator=]``( CharT const* s); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_eq_.overload3 more...]]`` ```
  5249. Assign from single character. ``` static_string& ``[link beast.ref.boost__beast__static_string.operator_eq_.overload4 operator=]``( CharT ch); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_eq_.overload4 more...]]`` ```
  5250. Assign from initializer list. ``` static_string& ``[link beast.ref.boost__beast__static_string.operator_eq_.overload5 operator=]``( std::initializer_list< CharT > init); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_eq_.overload5 more...]]`` ```
  5251. Assign from `string_view_type`. ``` static_string& ``[link beast.ref.boost__beast__static_string.operator_eq_.overload6 operator=]``( string_view_type sv); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_eq_.overload6 more...]]`` ``` [section:overload1 static_string::operator= (1 of 6 overloads)]
  5252. Copy assignment. [heading Synopsis] ``` static_string& operator=( static_string const& str); ``` [heading Description] [endsect] [section:overload2 static_string::operator= (2 of 6 overloads)]
  5253. Copy assignment. [heading Synopsis] ``` template< std::size_t M> static_string& operator=( static_string< M, CharT, Traits > const& str); ``` [heading Description] [endsect] [section:overload3 static_string::operator= (3 of 6 overloads)]
  5254. Assign from null-terminated string. [heading Synopsis] ``` static_string& operator=( CharT const* s); ``` [heading Description] [endsect] [section:overload4 static_string::operator= (4 of 6 overloads)]
  5255. Assign from single character. [heading Synopsis] ``` static_string& operator=( CharT ch); ``` [heading Description] [endsect] [section:overload5 static_string::operator= (5 of 6 overloads)]
  5256. Assign from initializer list. [heading Synopsis] ``` static_string& operator=( std::initializer_list< CharT > init); ``` [heading Description] [endsect] [section:overload6 static_string::operator= (6 of 6 overloads)]
  5257. Assign from `string_view_type`. [heading Synopsis] ``` static_string& operator=( string_view_type sv); ``` [heading Description] [endsect] [endsect] [section:operator_lb__rb_ static_string::operator\[\]] [indexterm2 operator\[\]..static_string]
  5258. Access specified character. ``` reference ``[link beast.ref.boost__beast__static_string.operator_lb__rb_.overload1 operator[]]``( size_type pos); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_lb__rb_.overload1 more...]]`` const_reference ``[link beast.ref.boost__beast__static_string.operator_lb__rb_.overload2 operator[]]``( size_type pos) const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.operator_lb__rb_.overload2 more...]]`` ``` [section:overload1 static_string::operator\[\] (1 of 2 overloads)]
  5259. Access specified character. [heading Synopsis] ``` reference operator[]( size_type pos); ``` [heading Description] [endsect] [section:overload2 static_string::operator\[\] (2 of 2 overloads)]
  5260. Access specified character. [heading Synopsis] ``` const_reference operator[]( size_type pos) const; ``` [heading Description] [endsect] [endsect] [section:pointer static_string::pointer] [indexterm2 pointer..static_string] [heading Synopsis] ``` using pointer = value_type*; ``` [heading Description] [endsect] [section:pop_back static_string::pop_back] [indexterm2 pop_back..static_string] [heading Synopsis] ``` void pop_back(); ``` [heading Description] [endsect] [section:push_back static_string::push_back] [indexterm2 push_back..static_string] [heading Synopsis] ``` void push_back( CharT ch); ``` [heading Description] [endsect] [section:rbegin static_string::rbegin] [indexterm2 rbegin..static_string]
  5261. Returns a reverse iterator to the beginning. ``` reverse_iterator ``[link beast.ref.boost__beast__static_string.rbegin.overload1 rbegin]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.rbegin.overload1 more...]]`` const_reverse_iterator ``[link beast.ref.boost__beast__static_string.rbegin.overload2 rbegin]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.rbegin.overload2 more...]]`` ``` [section:overload1 static_string::rbegin (1 of 2 overloads)]
  5262. Returns a reverse iterator to the beginning. [heading Synopsis] ``` reverse_iterator rbegin(); ``` [heading Description] [endsect] [section:overload2 static_string::rbegin (2 of 2 overloads)]
  5263. Returns a reverse iterator to the beginning. [heading Synopsis] ``` const_reverse_iterator rbegin() const; ``` [heading Description] [endsect] [endsect] [section:reference static_string::reference] [indexterm2 reference..static_string] [heading Synopsis] ``` using reference = value_type&; ``` [heading Description] [endsect] [section:rend static_string::rend] [indexterm2 rend..static_string]
  5264. Returns a reverse iterator to the end. ``` reverse_iterator ``[link beast.ref.boost__beast__static_string.rend.overload1 rend]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.rend.overload1 more...]]`` const_reverse_iterator ``[link beast.ref.boost__beast__static_string.rend.overload2 rend]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.rend.overload2 more...]]`` ``` [section:overload1 static_string::rend (1 of 2 overloads)]
  5265. Returns a reverse iterator to the end. [heading Synopsis] ``` reverse_iterator rend(); ``` [heading Description] [endsect] [section:overload2 static_string::rend (2 of 2 overloads)]
  5266. Returns a reverse iterator to the end. [heading Synopsis] ``` const_reverse_iterator rend() const; ``` [heading Description] [endsect] [endsect] [section:reserve static_string::reserve] [indexterm2 reserve..static_string]
  5267. Reserves storage. [heading Synopsis] ``` void reserve( std::size_t n); ``` [heading Description]
  5268. This actually just throws an exception if `n > N`, otherwise does nothing since the storage is fixed. [endsect] [section:resize static_string::resize] [indexterm2 resize..static_string]
  5269. Changes the number of characters stored. ``` void ``[link beast.ref.boost__beast__static_string.resize.overload1 resize]``( std::size_t n); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.resize.overload1 more...]]`` void ``[link beast.ref.boost__beast__static_string.resize.overload2 resize]``( std::size_t n, CharT c); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.resize.overload2 more...]]`` ``` [section:overload1 static_string::resize (1 of 2 overloads)]
  5270. Changes the number of characters stored. [heading Synopsis] ``` void resize( std::size_t n); ``` [heading Description]
  5271. If the resulting string is larger, the new characters are uninitialized. [endsect] [section:overload2 static_string::resize (2 of 2 overloads)]
  5272. Changes the number of characters stored. [heading Synopsis] ``` void resize( std::size_t n, CharT c); ``` [heading Description]
  5273. If the resulting string is larger, the new characters are initialized to the value of `c`. [endsect] [endsect] [section:reverse_iterator static_string::reverse_iterator] [indexterm2 reverse_iterator..static_string] [heading Synopsis] ``` using reverse_iterator = std::reverse_iterator< iterator >; ``` [heading Description] [endsect] [section:shrink_to_fit static_string::shrink_to_fit] [indexterm2 shrink_to_fit..static_string]
  5274. Reduces memory usage by freeing unused memory. [heading Synopsis] ``` void shrink_to_fit(); ``` [heading Description]
  5275. This actually does nothing, since the storage is fixed. [endsect] [section:size static_string::size] [indexterm2 size..static_string]
  5276. Returns the number of characters, excluding the null terminator. [heading Synopsis] ``` size_type size() const; ``` [heading Description] [endsect] [section:size_type static_string::size_type] [indexterm2 size_type..static_string] [heading Synopsis] ``` using size_type = std::size_t; ``` [heading Description] [endsect] [section:static_string static_string::static_string] [indexterm2 static_string..static_string]
  5277. Default constructor (empty string). ``` ``[link beast.ref.boost__beast__static_string.static_string.overload1 static_string]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload1 more...]]`` ```
  5278. Construct with count copies of character `ch`. ``` ``[link beast.ref.boost__beast__static_string.static_string.overload2 static_string]``( size_type count, CharT ch); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload2 more...]]`` ```
  5279. Construct with a substring (pos, other.size()) of `other`. ``` template< std::size_t M> ``[link beast.ref.boost__beast__static_string.static_string.overload3 static_string]``( static_string< M, CharT, Traits > const& other, size_type pos); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload3 more...]]`` ```
  5280. Construct with a substring (pos, count) of `other`. ``` template< std::size_t M> ``[link beast.ref.boost__beast__static_string.static_string.overload4 static_string]``( static_string< M, CharT, Traits > const& other, size_type pos, size_type count); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload4 more...]]`` ```
  5281. Construct with the first `count` characters of `s`, including nulls. ``` ``[link beast.ref.boost__beast__static_string.static_string.overload5 static_string]``( CharT const* s, size_type count); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload5 more...]]`` ```
  5282. Construct from a null terminated string. ``` ``[link beast.ref.boost__beast__static_string.static_string.overload6 static_string]``( CharT const* s); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload6 more...]]`` ```
  5283. Construct from a range of characters. ``` template< class InputIt> ``[link beast.ref.boost__beast__static_string.static_string.overload7 static_string]``( InputIt first, InputIt last); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload7 more...]]`` ```
  5284. Copy constructor. ``` ``[link beast.ref.boost__beast__static_string.static_string.overload8 static_string]``( static_string const& other); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload8 more...]]`` template< std::size_t M> ``[link beast.ref.boost__beast__static_string.static_string.overload9 static_string]``( static_string< M, CharT, Traits > const& other); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload9 more...]]`` ```
  5285. Construct from an initializer list. ``` ``[link beast.ref.boost__beast__static_string.static_string.overload10 static_string]``( std::initializer_list< CharT > init); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload10 more...]]`` ```
  5286. Construct from a `string_view` ``` explicit ``[link beast.ref.boost__beast__static_string.static_string.overload11 static_string]``( string_view_type sv); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload11 more...]]`` ```
  5287. Construct from any object convertible to `string_view_type`. ``` template< class T> ``[link beast.ref.boost__beast__static_string.static_string.overload12 static_string]``( T const& t, size_type pos, size_type n); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.static_string.overload12 more...]]`` ``` [section:overload1 static_string::static_string (1 of 12 overloads)]
  5288. Default constructor (empty string). [heading Synopsis] ``` static_string(); ``` [heading Description] [endsect] [section:overload2 static_string::static_string (2 of 12 overloads)]
  5289. Construct with count copies of character `ch`. [heading Synopsis] ``` static_string( size_type count, CharT ch); ``` [heading Description]
  5290. The behavior is undefined if `count >= npos` [endsect] [section:overload3 static_string::static_string (3 of 12 overloads)]
  5291. Construct with a substring (pos, other.size()) of `other`. [heading Synopsis] ``` template< std::size_t M> static_string( static_string< M, CharT, Traits > const& other, size_type pos); ``` [heading Description] [endsect] [section:overload4 static_string::static_string (4 of 12 overloads)]
  5292. Construct with a substring (pos, count) of `other`. [heading Synopsis] ``` template< std::size_t M> static_string( static_string< M, CharT, Traits > const& other, size_type pos, size_type count); ``` [heading Description] [endsect] [section:overload5 static_string::static_string (5 of 12 overloads)]
  5293. Construct with the first `count` characters of `s`, including nulls. [heading Synopsis] ``` static_string( CharT const* s, size_type count); ``` [heading Description] [endsect] [section:overload6 static_string::static_string (6 of 12 overloads)]
  5294. Construct from a null terminated string. [heading Synopsis] ``` static_string( CharT const* s); ``` [heading Description] [endsect] [section:overload7 static_string::static_string (7 of 12 overloads)]
  5295. Construct from a range of characters. [heading Synopsis] ``` template< class InputIt> static_string( InputIt first, InputIt last); ``` [heading Description] [endsect] [section:overload8 static_string::static_string (8 of 12 overloads)]
  5296. Copy constructor. [heading Synopsis] ``` static_string( static_string const& other); ``` [heading Description] [endsect] [section:overload9 static_string::static_string (9 of 12 overloads)]
  5297. Copy constructor. [heading Synopsis] ``` template< std::size_t M> static_string( static_string< M, CharT, Traits > const& other); ``` [heading Description] [endsect] [section:overload10 static_string::static_string (10 of 12 overloads)]
  5298. Construct from an initializer list. [heading Synopsis] ``` static_string( std::initializer_list< CharT > init); ``` [heading Description] [endsect] [section:overload11 static_string::static_string (11 of 12 overloads)]
  5299. Construct from a `string_view` [heading Synopsis] ``` static_string( string_view_type sv); ``` [heading Description] [endsect] [section:overload12 static_string::static_string (12 of 12 overloads)]
  5300. Construct from any object convertible to `string_view_type`. [heading Synopsis] ``` template< class T> static_string( T const& t, size_type pos, size_type n); ``` [heading Description]
  5301. The range (pos, n) is extracted from the value obtained by converting `t` to `string_view_type`, and used to construct the string. [endsect] [endsect] [section:string_view_type static_string::string_view_type] [indexterm2 string_view_type..static_string]
  5302. The type of `string_view` returned by the interface. [heading Synopsis] ``` using string_view_type = basic_string_view< CharT, Traits >; ``` [heading Description] [endsect] [section:substr static_string::substr] [indexterm2 substr..static_string] [heading Synopsis] ``` string_view_type substr( size_type pos = 0, size_type count = npos) const; ``` [heading Description] [endsect] [section:swap static_string::swap] [indexterm2 swap..static_string]
  5303. Exchange the contents of this string with another. ``` void ``[link beast.ref.boost__beast__static_string.swap.overload1 swap]``( static_string& str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.swap.overload1 more...]]`` template< std::size_t M> void ``[link beast.ref.boost__beast__static_string.swap.overload2 swap]``( static_string< M, CharT, Traits >& str); ``[''''&raquo;''' [link beast.ref.boost__beast__static_string.swap.overload2 more...]]`` ``` [section:overload1 static_string::swap (1 of 2 overloads)]
  5304. Exchange the contents of this string with another. [heading Synopsis] ``` void swap( static_string& str); ``` [heading Description] [endsect] [section:overload2 static_string::swap (2 of 2 overloads)]
  5305. Exchange the contents of this string with another. [heading Synopsis] ``` template< std::size_t M> void swap( static_string< M, CharT, Traits >& str); ``` [heading Description] [endsect] [endsect] [section:traits_type static_string::traits_type] [indexterm2 traits_type..static_string] [heading Synopsis] ``` using traits_type = Traits; ``` [heading Description] [endsect] [section:value_type static_string::value_type] [indexterm2 value_type..static_string] [heading Synopsis] ``` using value_type = typename Traits::char_type; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__string_param string_param]
  5306. A function parameter which efficiently converts to string. [heading Synopsis] Defined in header [include_file boost/beast/core/string_param.hpp] ``` class string_param ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__string_param.operator_string_view_const [*operator string_view const]]] [ Implicit conversion to string_view. ] ] [ [[link beast.ref.boost__beast__string_param.operator_eq_ [*operator=]]] [ Copy assignment (disallowed) ] ] [ [[link beast.ref.boost__beast__string_param.str [*str]]] [ Returns the contained string. ] ] [ [[link beast.ref.boost__beast__string_param.string_param [*string_param]]] [ Copy constructor (disallowed) Constructor. ] ] ] [heading Description]
  5307. This is used as a function parameter type to allow callers notational convenience: objects other than strings may be passed in contexts where a string is expected. The conversion to string is made using `operator<<` to a non-dynamically allocated static buffer if possible, else to a `std::string` on overflow.
  5308. To use it, modify your function signature to accept `string_param` and then extract the string inside the function: ``` void print(string_param s)
  5309. {
  5310. std::cout << s.str();
  5311. }
  5312. ``` [section:operator_string_view_const string_param::operator string_view const] [indexterm2 operator string_view const..string_param]
  5313. Implicit conversion to [link beast.ref.boost__beast__string_view `string_view`]. [heading Synopsis] ``` operator string_view const() const; ``` [heading Description] [endsect] [section:operator_eq_ string_param::operator=] [indexterm2 operator=..string_param]
  5314. Copy assignment (disallowed) [heading Synopsis] ``` string_param& operator=( string_param const&); ``` [heading Description] [endsect] [section:str string_param::str] [indexterm2 str..string_param]
  5315. Returns the contained string. [heading Synopsis] ``` string_view str() const; ``` [heading Description] [endsect] [section:string_param string_param::string_param] [indexterm2 string_param..string_param]
  5316. Copy constructor (disallowed) ``` ``[link beast.ref.boost__beast__string_param.string_param.overload1 string_param]``( string_param const&); ``[''''&raquo;''' [link beast.ref.boost__beast__string_param.string_param.overload1 more...]]`` ```
  5317. Constructor. ``` template< class... Args> ``[link beast.ref.boost__beast__string_param.string_param.overload2 string_param]``( Args const&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__string_param.string_param.overload2 more...]]`` ``` [section:overload1 string_param::string_param (1 of 2 overloads)]
  5318. Copy constructor (disallowed) [heading Synopsis] ``` string_param( string_param const&); ``` [heading Description] [endsect] [section:overload2 string_param::string_param (2 of 2 overloads)]
  5319. Constructor. [heading Synopsis] ``` template< class... Args> string_param( Args const&... args); ``` [heading Description]
  5320. This function constructs a string as if by concatenating the result of streaming each argument in order into an output stream. It is used as a notational convenience at call sites which expect a parameter with the semantics of a [link beast.ref.boost__beast__string_view `string_view`].
  5321. The implementation uses a small, internal static buffer to avoid memory allocations especially for the case where the list of arguments to be converted consists of a single integral type.
  5322. [heading Parameters] [table [[Name][Description]] [[`args`][
  5323. One or more arguments to convert ]] ]
  5324. [endsect] [endsect] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__string_view string_view] [indexterm1 string_view]
  5325. The type of string view used by the library. [heading Synopsis] Defined in header [include_file boost/beast/core/string_type.hpp] ``` using string_view = boost::string_view; ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__swap swap] [indexterm1 swap] ``` template< std::size_t N, class CharT, class Traits> void ``[link beast.ref.boost__beast__swap.overload1 swap]``( static_string< N, CharT, Traits >& lhs, static_string< N, CharT, Traits >& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__swap.overload1 more...]]`` template< std::size_t N, std::size_t M, class CharT, class Traits> void ``[link beast.ref.boost__beast__swap.overload2 swap]``( static_string< N, CharT, Traits >& lhs, static_string< M, CharT, Traits >& rhs); ``[''''&raquo;''' [link beast.ref.boost__beast__swap.overload2 more...]]`` ``` [section:overload1 swap (1 of 2 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, class CharT, class Traits> void swap( static_string< N, CharT, Traits >& lhs, static_string< N, CharT, Traits >& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:overload2 swap (2 of 2 overloads)] [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< std::size_t N, std::size_t M, class CharT, class Traits> void swap( static_string< N, CharT, Traits >& lhs, static_string< M, CharT, Traits >& rhs); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [endsect] [section:boost__beast__system_category system_category] [indexterm1 system_category]
  5326. A function to return the system error category used by the library. [heading Synopsis] Defined in header [include_file boost/beast/core/error.hpp] ``` error_category const & system_category(); ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__system_error system_error] [indexterm1 system_error]
  5327. The type of system error thrown by the library. [heading Synopsis] Defined in header [include_file boost/beast/core/error.hpp] ``` using system_error = boost::system::system_error; ``` [heading Description] Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__tcp_stream tcp_stream] [indexterm1 tcp_stream]
  5328. A TCP/IP stream socket with timeouts and a polymorphic executor. [heading Synopsis] Defined in header [include_file boost/beast/core/tcp_stream.hpp] ``` using tcp_stream = basic_stream< net::ip::tcp, net::executor, unlimited_rate_policy >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_stream__rebind_executor [*rebind_executor]]] [ Rebinds the stream type to another executor. ] ] [ [[link beast.ref.boost__beast__basic_stream.endpoint_type [*endpoint_type]]] [ The endpoint type. ] ] [ [[link beast.ref.boost__beast__basic_stream.executor_type [*executor_type]]] [ The type of the executor associated with the stream. ] ] [ [[link beast.ref.boost__beast__basic_stream.protocol_type [*protocol_type]]] [ The protocol type. ] ] [ [[link beast.ref.boost__beast__basic_stream.socket_type [*socket_type]]] [ The type of the underlying socket. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__basic_stream.async_connect [*async_connect]]] [ Connect the stream to the specified endpoint asynchronously. Establishes a connection by trying each endpoint in a sequence asynchronously. ] ] [ [[link beast.ref.boost__beast__basic_stream.async_read_some [*async_read_some]]] [ Read some data asynchronously. ] ] [ [[link beast.ref.boost__beast__basic_stream.async_write_some [*async_write_some]]] [ Write some data asynchronously. ] ] [ [[link beast.ref.boost__beast__basic_stream.basic_stream [*basic_stream]]] [ Constructor. Move constructor. ] ] [ [[link beast.ref.boost__beast__basic_stream.cancel [*cancel]]] [ Cancel all asynchronous operations associated with the socket. ] ] [ [[link beast.ref.boost__beast__basic_stream.close [*close]]] [ Close the timed stream. ] ] [ [[link beast.ref.boost__beast__basic_stream.connect [*connect]]] [ Connect the stream to the specified endpoint. Establishes a connection by trying each endpoint in a sequence. ] ] [ [[link beast.ref.boost__beast__basic_stream.expires_after [*expires_after]]] [ Set the timeout for the next logical operation. ] ] [ [[link beast.ref.boost__beast__basic_stream.expires_at [*expires_at]]] [ Set the timeout for the next logical operation. ] ] [ [[link beast.ref.boost__beast__basic_stream.expires_never [*expires_never]]] [ Disable the timeout for the next logical operation. ] ] [ [[link beast.ref.boost__beast__basic_stream.get_executor [*get_executor]]] [ Get the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__basic_stream.operator_eq_ [*operator=]]] [ Move assignment (deleted). ] ] [ [[link beast.ref.boost__beast__basic_stream.rate_policy [*rate_policy]]] [ Returns the rate policy associated with the object. ] ] [ [[link beast.ref.boost__beast__basic_stream.read_some [*read_some]]] [ Read some data. ] ] [ [[link beast.ref.boost__beast__basic_stream.release_socket [*release_socket]]] [ Release ownership of the underlying socket. ] ] [ [[link beast.ref.boost__beast__basic_stream.socket [*socket]]] [ Return a reference to the underlying socket. ] ] [ [[link beast.ref.boost__beast__basic_stream.write_some [*write_some]]] [ Write some data. ] ] [ [[link beast.ref.boost__beast__basic_stream.basic_stream_dtor_ [*~basic_stream]]] [ Destructor. ] ] ]
  5329. This stream wraps a `net::basic_stream_socket` to provide the following features:
  5330. * An ['Executor] may be associated with the stream, which will be used to invoke any completion handlers which do not already have an associated executor. This achieves support for [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1322r0.html [P1322R0] Networking TS enhancement to enable custom I/O executors].
  5331. * Timeouts may be specified for each logical asynchronous operation performing any reading, writing, or connecting.
  5332. * A ['RatePolicy] may be associated with the stream, to implement rate limiting through the policy's interface.
  5333. Although the stream supports multiple concurrent outstanding asynchronous operations, the stream object is not thread-safe. The caller is responsible for ensuring that the stream is accessed from only one thread at a time. This includes the times when the stream, and its underlying socket, are accessed by the networking implementation. To meet this thread safety requirement, all asynchronous operations must be performed by the stream within the same implicit strand (only one thread `net::io_context::run`) or within the same explicit strand, such as an instance of `net::strand`.
  5334. Completion handlers with explicit associated executors (such as those arising from use of `net::bind_executor`) will be invoked by the stream using the associated executor. Otherwise, the completion handler will be invoked by the executor associated with the stream upon construction. The type of executor used with this stream must meet the following requirements:
  5335. * Function objects submitted to the executor shall never run concurrently with each other.
  5336. The executor type `net::strand` meets these requirements. Use of a strand as the executor in the stream class template offers an additional notational convenience: the strand does not need to be specified in each individual initiating function call.
  5337. Unlike other stream wrappers, the underlying socket is accessed through the [link beast.ref.boost__beast__basic_stream.socket `basic_stream::socket`] member function instead of `next_layer`. This causes the [link beast.ref.boost__beast__basic_stream `basic_stream`] to be returned in calls to [link beast.ref.boost__beast__get_lowest_layer `get_lowest_layer`].
  5338. [heading Usage]
  5339. To use this stream declare an instance of the class. Then, before each logical operation for which a timeout is desired, call [link beast.ref.boost__beast__basic_stream.expires_after `basic_stream::expires_after`] with a duration, or call [link beast.ref.boost__beast__basic_stream.expires_at `basic_stream::expires_at`] with a time point. Alternatively, call [link beast.ref.boost__beast__basic_stream.expires_never `basic_stream::expires_never`] to disable the timeout for subsequent logical operations. A logical operation is any series of one or more direct or indirect calls to the timeout stream's asynchronous read, asynchronous write, or asynchronous connect functions.
  5340. When a timeout is set and a mixed operation is performed (one that includes both reads and writes, for example) the timeout applies to all of the intermediate asynchronous operations used in the enclosing operation. This allows timeouts to be applied to stream algorithms which were not written specifically to allow for timeouts, when those algorithms are passed a timeout stream with a timeout set.
  5341. When a timeout occurs the socket will be closed, canceling any pending I/O operations. The completion handlers for these canceled operations will be invoked with the error [link beast.ref.boost__beast__error `timeout`].
  5342. [heading Examples]
  5343. This function reads an HTTP request with a timeout, then sends the HTTP response with a different timeout.
  5344. ``` void process_http_1 (tcp_stream& stream, net::yield_context yield)
  5345. {
  5346. flat_buffer buffer;
  5347. http::request<http::empty_body> req;
  5348. // Read the request, with a 15 second timeout
  5349. stream.expires_after(std::chrono::seconds(15));
  5350. http::async_read(stream, buffer, req, yield);
  5351. // Calculate the response
  5352. http::response<http::string_body> res = make_response(req);
  5353. // Send the response, with a 30 second timeout.
  5354. stream.expires_after (std::chrono::seconds(30));
  5355. http::async_write (stream, res, yield);
  5356. }
  5357. ```
  5358. The example above could be expressed using a single timeout with a simple modification. The function that follows first reads an HTTP request then sends the HTTP response, with a single timeout that applies to the entire combined operation of reading and writing:
  5359. ``` void process_http_2 (tcp_stream& stream, net::yield_context yield)
  5360. {
  5361. flat_buffer buffer;
  5362. http::request<http::empty_body> req;
  5363. // Require that the read and write combined take no longer than 30 seconds
  5364. stream.expires_after(std::chrono::seconds(30));
  5365. http::async_read(stream, buffer, req, yield);
  5366. http::response<http::string_body> res = make_response(req);
  5367. http::async_write (stream, res, yield);
  5368. }
  5369. ```
  5370. Some stream algorithms, such as `ssl::stream::async_handshake` perform both reads and writes. A timeout set before calling the initiating function of such composite stream algorithms will apply to the entire composite operation. For example, a timeout may be set on performing the SSL handshake thusly:
  5371. ``` void do_ssl_handshake (net::ssl::stream<tcp_stream>& stream, net::yield_context yield)
  5372. {
  5373. // Require that the SSL handshake take no longer than 10 seconds
  5374. stream.expires_after(std::chrono::seconds(10));
  5375. stream.async_handshake(net::ssl::stream_base::client, yield);
  5376. }
  5377. ```
  5378. [heading Blocking I/O]
  5379. Synchronous functions behave identically as that of the wrapped `net::basic_stream_socket`. Timeouts are not available when performing blocking calls.
  5380. [heading Template Parameters] [table [[Type][Description]] [[`Protocol`][
  5381. A type meeting the requirements of ['Protocol] representing the protocol the protocol to use for the basic stream socket. A common choice is `net::ip::tcp`. ]] [[`Executor`][
  5382. A type meeting the requirements of ['Executor] to be used for submitting all completion handlers which do not already have an associated executor. If this type is omitted, the default of `net::executor` will be used. ]] ]
  5383. [heading Thread Safety]
  5384. ['Distinct objects]: Safe. ['Shared objects]: Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
  5385. [heading See Also]
  5386. * [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1322r0.html [P1322R0] Networking TS enhancement to enable custom I/O executors].
  5387. [heading Description]
  5388. [heading See Also]
  5389. [link beast.ref.boost__beast__basic_stream `basic_stream`]
  5390. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__teardown teardown] [indexterm1 teardown]
  5391. Tear down a `net::ssl::stream`. [heading Synopsis] Defined in header [include_file boost/beast/websocket/ssl.hpp] ``` template< class __SyncStream__> void teardown( role_type role, net::ssl::stream< SyncStream >& stream, error_code& ec); ``` [heading Description]
  5392. This tears down a connection. The implementation will call the overload of this function based on the `Stream` parameter used to consruct the socket. When `Stream` is a user defined type, and not a `net::ip::tcp::socket` or any `net::ssl::stream`, callers are responsible for providing a suitable overload of this function.
  5393. [heading Parameters] [table [[Name][Description]] [[`role`][
  5394. The role of the local endpoint ]] [[`stream`][
  5395. The stream to tear down. ]] [[`ec`][
  5396. Set to the error if any occurred. ]] ]
  5397. Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__test__any_handler test::any_handler] [indexterm1 test::any_handler]
  5398. Return a test CompletionHandler which requires invocation. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/handler.hpp] ``` handler any_handler(); ``` [heading Description]
  5399. The returned handler can be invoked with any signature. The handler fails the test if:
  5400. * The handler is destroyed without being invoked.
  5401. [endsect] [section:boost__beast__test__connect test::connect] [indexterm1 test::connect]
  5402. Return a new stream connected to the given stream. ``` template< class... Args> stream ``[link beast.ref.boost__beast__test__connect.overload1 connect]``( stream& to, Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__test__connect.overload1 more...]]`` ```
  5403. Connect two TCP sockets together. ``` template< class __Executor__> bool ``[link beast.ref.boost__beast__test__connect.overload2 connect]``( net::basic_stream_socket< net::ip::tcp, Executor >& s1, net::basic_stream_socket< net::ip::tcp, Executor >& s2); ``[''''&raquo;''' [link beast.ref.boost__beast__test__connect.overload2 more...]]`` ``` [section:overload1 test::connect (1 of 2 overloads)]
  5404. Return a new stream connected to the given stream. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/stream.hpp] ``` template< class... Args> stream connect( stream& to, Args&&... args); ``` [heading Description]
  5405. [heading Parameters] [table [[Name][Description]] [[`to`][
  5406. The stream to connect to. ]] [[`args`][
  5407. Optional arguments forwarded to the new stream's constructor. ]] ]
  5408. [heading Return Value]
  5409. The new, connected stream.
  5410. [endsect] [section:overload2 test::connect (2 of 2 overloads)]
  5411. Connect two TCP sockets together. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/tcp.hpp] ``` template< class __Executor__> bool connect( net::basic_stream_socket< net::ip::tcp, Executor >& s1, net::basic_stream_socket< net::ip::tcp, Executor >& s2); ``` [heading Description] [endsect] [endsect] [section:boost__beast__test__error test::error] [indexterm1 test::error]
  5412. Error codes returned from unit testing algorithms. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/error.hpp] ``` enum error ``` [indexterm2 test_failure..test::error] [heading Values] [table [[Name][Description]] [[[^test_failure]][The test stream generated a simulated testing error. This error is returned by a @ref fail_count object
  5413. when it generates a simulated error.
  5414. ]] ] [heading Description] [endsect] [section:boost__beast__test__fail_count test::fail_count]
  5415. A countdown to simulated failure. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/fail_count.hpp] ``` class fail_count ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__test__fail_count.fail [*fail]]] [ Throw an exception on the Nth failure. Set an error code on the Nth failure. ] ] [ [[link beast.ref.boost__beast__test__fail_count.fail_count [*fail_count]]] [ Construct a counter. ] ] ] [heading Description]
  5416. On the Nth operation, the class will fail with the specified error code, or the default error code of [link beast.ref.boost__beast__test__error `test::test_failure`].
  5417. Instances of this class may be used to build objects which are specifically designed to aid in writing unit tests, for interfaces which can throw exceptions or return `error_code` values representing failure. [section:fail test::fail_count::fail] [indexterm2 fail..test::fail_count]
  5418. Throw an exception on the Nth failure. ``` void ``[link beast.ref.boost__beast__test__fail_count.fail.overload1 fail]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__test__fail_count.fail.overload1 more...]]`` ```
  5419. Set an error code on the Nth failure. ``` bool ``[link beast.ref.boost__beast__test__fail_count.fail.overload2 fail]``( error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__test__fail_count.fail.overload2 more...]]`` ``` [section:overload1 test::fail_count::fail (1 of 2 overloads)]
  5420. Throw an exception on the Nth failure. [heading Synopsis] ``` void fail(); ``` [heading Description] [endsect] [section:overload2 test::fail_count::fail (2 of 2 overloads)]
  5421. Set an error code on the Nth failure. [heading Synopsis] ``` bool fail( error_code& ec); ``` [heading Description] [endsect] [endsect] [section:fail_count test::fail_count::fail_count] [indexterm2 fail_count..test::fail_count] ``` ``[link beast.ref.boost__beast__test__fail_count.fail_count.overload1 fail_count]``( fail_count&&); ``[''''&raquo;''' [link beast.ref.boost__beast__test__fail_count.fail_count.overload1 more...]]`` ```
  5422. Construct a counter. ``` explicit ``[link beast.ref.boost__beast__test__fail_count.fail_count.overload2 fail_count]``( std::size_t n, error_code ev = error::test_failure); ``[''''&raquo;''' [link beast.ref.boost__beast__test__fail_count.fail_count.overload2 more...]]`` ``` [section:overload1 test::fail_count::fail_count (1 of 2 overloads)] [heading Synopsis] ``` fail_count( fail_count&&); ``` [heading Description] [endsect] [section:overload2 test::fail_count::fail_count (2 of 2 overloads)]
  5423. Construct a counter. [heading Synopsis] ``` fail_count( std::size_t n, error_code ev = error::test_failure); ``` [heading Description]
  5424. [heading Parameters] [table [[Name][Description]] [[`n`][
  5425. The 0-based index of the operation to fail on or after ]] [[`ev`][
  5426. An optional error code to use when generating a simulated failure ]] ]
  5427. [endsect] [endsect] [endsect] [section:boost__beast__test__fail_handler test::fail_handler] [indexterm1 test::fail_handler]
  5428. Return a test CompletionHandler which requires a specific error code. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/handler.hpp] ``` handler fail_handler( error_code ec); ``` [heading Description]
  5429. This handler can be invoked with any signature whose first parameter is an `error_code`. The handler fails the test if:
  5430. * The handler is destroyed without being invoked.
  5431. * The handler is invoked with an error code different from what is specified.
  5432. [heading Parameters] [table [[Name][Description]] [[`ec`][
  5433. The error code to specify. ]] ]
  5434. [endsect] [section:boost__beast__test__handler test::handler]
  5435. A CompletionHandler used for testing. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/handler.hpp] ``` class handler ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__test__handler.handler [*handler]]] [ ] ] [ [[link beast.ref.boost__beast__test__handler.operator_lp__rp_ [*operator()]]] [ ] ] [ [[link beast.ref.boost__beast__test__handler.handler_dtor_ [*~handler]]] [ ] ] ] [heading Description]
  5436. This completion handler is used by tests to ensure correctness of behavior. It is designed as a single type to reduce template instantiations, with configurable settings through constructor arguments. Typically this type will be used in type lists and not instantiated directly; instances of this class are returned by the helper functions listed below.
  5437. [heading See Also]
  5438. [link beast.ref.boost__beast__test__success_handler `test::success_handler`], [link beast.ref.boost__beast__test__fail_handler `test::fail_handler`], [link beast.ref.boost__beast__test__any_handler `test::any_handler`]
  5439. [section:handler test::handler::handler] [indexterm2 handler..test::handler] ``` ``[link beast.ref.boost__beast__test__handler.handler.overload1 handler]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__test__handler.handler.overload1 more...]]`` explicit ``[link beast.ref.boost__beast__test__handler.handler.overload2 handler]``( error_code ec); ``[''''&raquo;''' [link beast.ref.boost__beast__test__handler.handler.overload2 more...]]`` explicit ``[link beast.ref.boost__beast__test__handler.handler.overload3 handler]``( boost::none_t); ``[''''&raquo;''' [link beast.ref.boost__beast__test__handler.handler.overload3 more...]]`` ``[link beast.ref.boost__beast__test__handler.handler.overload4 handler]``( handler&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__test__handler.handler.overload4 more...]]`` ``` [section:overload1 test::handler::handler (1 of 4 overloads)] [heading Synopsis] ``` handler(); ``` [heading Description] [endsect] [section:overload2 test::handler::handler (2 of 4 overloads)] [heading Synopsis] ``` handler( error_code ec); ``` [heading Description] [endsect] [section:overload3 test::handler::handler (3 of 4 overloads)] [heading Synopsis] ``` handler( boost::none_t); ``` [heading Description] [endsect] [section:overload4 test::handler::handler (4 of 4 overloads)] [heading Synopsis] ``` handler( handler&& other); ``` [heading Description] [endsect] [endsect] [section:operator_lp__rp_ test::handler::operator()] [indexterm2 operator()..test::handler] ``` template< class... Args> void ``[link beast.ref.boost__beast__test__handler.operator_lp__rp_.overload1 operator()]``( error_code ec, Args&& ...); ``[''''&raquo;''' [link beast.ref.boost__beast__test__handler.operator_lp__rp_.overload1 more...]]`` void ``[link beast.ref.boost__beast__test__handler.operator_lp__rp_.overload2 operator()]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__test__handler.operator_lp__rp_.overload2 more...]]`` template< class Arg0, class... Args, [role red error.class-detail-template.1][role red error.class-detail-template.2] = typename std::enable_if< ! std::is_convertible<Arg0, error_code>::value>::type> void ``[link beast.ref.boost__beast__test__handler.operator_lp__rp_.overload3 operator()]``( Arg0&&, Args&& ...); ``[''''&raquo;''' [link beast.ref.boost__beast__test__handler.operator_lp__rp_.overload3 more...]]`` ``` [section:overload1 test::handler::operator() (1 of 3 overloads)] [heading Synopsis] ``` template< class... Args> void operator()( error_code ec, Args&& ...); ``` [heading Description] [endsect] [section:overload2 test::handler::operator() (2 of 3 overloads)] [heading Synopsis] ``` void operator()(); ``` [heading Description] [endsect] [section:overload3 test::handler::operator() (3 of 3 overloads)] [heading Synopsis] ``` template< class Arg0, class... Args, [role red error.class-detail-template.1][role red error.class-detail-template.2] = typename std::enable_if< ! std::is_convertible<Arg0, error_code>::value>::type> void operator()( Arg0&&, Args&& ...); ``` [heading Description] [endsect] [endsect] [section:handler_dtor_ test::handler::~handler] [indexterm2 ~handler..test::handler] [heading Synopsis] ``` ~handler(); ``` [heading Description] [endsect] [endsect] [section:boost__beast__test__run test::run] [indexterm1 test::run]
  5440. Run an I/O context. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/handler.hpp] ``` void run( net::io_context& ioc); ``` [heading Description]
  5441. This function runs and dispatches handlers on the specified I/O context, until one of the following conditions is true:
  5442. * The I/O context runs out of work.
  5443. [heading Parameters] [table [[Name][Description]] [[`ioc`][
  5444. The I/O context to run ]] ]
  5445. [endsect] [section:boost__beast__test__run_for test::run_for] [indexterm1 test::run_for]
  5446. Run an I/O context for a certain amount of time. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/handler.hpp] ``` template< class Rep, class Period> void run_for( net::io_context& ioc, std::chrono::duration< Rep, Period > elapsed); ``` [heading Description]
  5447. This function runs and dispatches handlers on the specified I/O context, until one of the following conditions is true:
  5448. * The I/O context runs out of work.
  5449. * No completions occur and the specified amount of time has elapsed.
  5450. [heading Parameters] [table [[Name][Description]] [[`ioc`][
  5451. The I/O context to run ]] [[`elapsed`][
  5452. The maximum amount of time to run for. ]] ]
  5453. [endsect] [section:boost__beast__test__stream test::stream]
  5454. A two-way socket useful for unit testing. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/stream.hpp] ``` class stream ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__test__stream.buffer_type [*buffer_type]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream.executor_type [*executor_type]]] [ The type of the executor associated with the object. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__test__stream.append [*append]]] [ Appends a string to the pending input data. ] ] [ [[link beast.ref.boost__beast__test__stream.async_read_some [*async_read_some]]] [ Start an asynchronous read. ] ] [ [[link beast.ref.boost__beast__test__stream.async_write_some [*async_write_some]]] [ Start an asynchronous write. ] ] [ [[link beast.ref.boost__beast__test__stream.buffer [*buffer]]] [ Direct input buffer access. ] ] [ [[link beast.ref.boost__beast__test__stream.clear [*clear]]] [ Clear the pending input area. ] ] [ [[link beast.ref.boost__beast__test__stream.close [*close]]] [ Close the stream. ] ] [ [[link beast.ref.boost__beast__test__stream.close_remote [*close_remote]]] [ Close the other end of the stream. ] ] [ [[link beast.ref.boost__beast__test__stream.connect [*connect]]] [ Establish a connection. ] ] [ [[link beast.ref.boost__beast__test__stream.get_executor [*get_executor]]] [ Return the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__test__stream.nread [*nread]]] [ Return the number of reads. ] ] [ [[link beast.ref.boost__beast__test__stream.nread_bytes [*nread_bytes]]] [ Return the number of bytes read. ] ] [ [[link beast.ref.boost__beast__test__stream.nwrite [*nwrite]]] [ Return the number of writes. ] ] [ [[link beast.ref.boost__beast__test__stream.nwrite_bytes [*nwrite_bytes]]] [ Return the number of bytes written. ] ] [ [[link beast.ref.boost__beast__test__stream.operator_eq_ [*operator=]]] [ Move Assignment. ] ] [ [[link beast.ref.boost__beast__test__stream.read_size [*read_size]]] [ Set the maximum number of bytes returned by read_some. ] ] [ [[link beast.ref.boost__beast__test__stream.read_some [*read_some]]] [ Read some data from the stream. ] ] [ [[link beast.ref.boost__beast__test__stream.str [*str]]] [ Returns a string view representing the pending input data. ] ] [ [[link beast.ref.boost__beast__test__stream.stream [*stream]]] [ Move Constructor. Construct a stream. ] ] [ [[link beast.ref.boost__beast__test__stream.write_size [*write_size]]] [ Set the maximum number of bytes returned by write_some. ] ] [ [[link beast.ref.boost__beast__test__stream.write_some [*write_some]]] [ Write some data to the stream. ] ] [ [[link beast.ref.boost__beast__test__stream.stream_dtor_ [*~stream]]] [ Destructor. ] ] ] [heading Description]
  5455. An instance of this class simulates a traditional socket, while also providing features useful for unit testing. Each endpoint maintains an independent buffer called the input area. Writes from one endpoint append data to the peer's pending input area. When an endpoint performs a read and data is present in the input area, the data is delivered to the blocking or asynchronous operation. Otherwise the operation is blocked or deferred until data is made available, or until the endpoints become disconnected.
  5456. These streams may be used anywhere an algorithm accepts a reference to a synchronous or asynchronous read or write stream. It is possible to use a test stream in a call to `net::read_until`, or in a call to [link beast.ref.boost__beast__http__async_write `http::async_write`] for example.
  5457. As with Boost.Asio I/O objects, a [link beast.ref.boost__beast__test__stream `test::stream`] constructs with a reference to the `net::io_context` to use for handling asynchronous I/O. For asynchronous operations, the stream follows the same rules as a traditional asio socket with respect to how completion handlers for asynchronous operations are performed.
  5458. To facilitate testing, these streams support some additional features:
  5459. * The input area, represented by a [link beast.ref.boost__beast__basic_flat_buffer `basic_flat_buffer`], may be directly accessed by the caller to inspect the contents before or after the remote endpoint writes data. This allows a unit test to verify that the received data matches.
  5460. * Data may be manually appended to the input area. This data will delivered in the next call to [link beast.ref.boost__beast__test__stream.read_some `test::stream::read_some`] or [link beast.ref.boost__beast__test__stream.async_read_some `test::stream::async_read_some`]. This allows predefined test vectors to be set up for testing read algorithms.
  5461. * The stream may be constructed with a fail count. The stream will eventually fail with a predefined error after a certain number of operations, where the number of operations is controlled by the test. When a test loops over a range of operation counts, it is possible to exercise every possible point of failure in the algorithm being tested. When used correctly the technique allows the tests to reach a high percentage of code coverage.
  5462. [heading Thread Safety]
  5463. ['Distinct] ['objects:] Safe. ['Shared] ['objects:] Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
  5464. [heading Concepts]
  5465. * ['SyncReadStream]
  5466. * ['SyncWriteStream]
  5467. * ['AsyncReadStream]
  5468. * ['AsyncWriteStream]
  5469. [section:append test::stream::append] [indexterm2 append..test::stream]
  5470. Appends a string to the pending input data. [heading Synopsis] ``` void append( string_view s); ``` [heading Description] [endsect] [section:async_read_some test::stream::async_read_some] [indexterm2 async_read_some..test::stream]
  5471. Start an asynchronous read. [heading Synopsis] ``` template< class __MutableBufferSequence__, class __ReadHandler__> ``__deduced__`` async_read_some( MutableBufferSequence const& buffers, ReadHandler&& handler); ``` [heading Description]
  5472. This function is used to asynchronously read one or more bytes of data from the stream. The function call always returns immediately.
  5473. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  5474. The buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  5475. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  5476. error_code const& ec, // Result of operation.
  5477. std::size_t bytes_transferred // Number of bytes read.
  5478. );
  5479. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  5480. [heading Remarks]
  5481. The `async_read_some` operation may not read all of the requested number of bytes. Consider using the function `net::async_read` if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
  5482. [endsect] [section:async_write_some test::stream::async_write_some] [indexterm2 async_write_some..test::stream]
  5483. Start an asynchronous write. [heading Synopsis] ``` template< class __ConstBufferSequence__, class __WriteHandler__> ``__deduced__`` async_write_some( ConstBufferSequence const& buffers, WriteHandler&& handler); ``` [heading Description]
  5484. This function is used to asynchronously write one or more bytes of data to the stream. The function call always returns immediately.
  5485. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  5486. The data to be written to the stream. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. ]] [[`handler`][
  5487. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  5488. error_code const& ec, // Result of operation.
  5489. std::size_t bytes_transferred // Number of bytes written.
  5490. );
  5491. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  5492. [heading Remarks]
  5493. The `async_write_some` operation may not transmit all of the data to the peer. Consider using the function `net::async_write` if you need to ensure that all data is written before the asynchronous operation completes.
  5494. [endsect] [section:buffer test::stream::buffer] [indexterm2 buffer..test::stream]
  5495. Direct input buffer access. [heading Synopsis] ``` buffer_type& buffer(); ``` [heading Description] [endsect] [section:buffer_type test::stream::buffer_type] [indexterm2 buffer_type..test::stream] [heading Synopsis] ``` using buffer_type = flat_buffer; ``` [heading Description] [endsect] [section:clear test::stream::clear] [indexterm2 clear..test::stream]
  5496. Clear the pending input area. [heading Synopsis] ``` void clear(); ``` [heading Description] [endsect] [section:close test::stream::close] [indexterm2 close..test::stream]
  5497. Close the stream. [heading Synopsis] ``` void close(); ``` [heading Description]
  5498. The other end of the connection will see `error::eof` after reading all the remaining data. [endsect] [section:close_remote test::stream::close_remote] [indexterm2 close_remote..test::stream]
  5499. Close the other end of the stream. [heading Synopsis] ``` void close_remote(); ``` [heading Description]
  5500. This end of the connection will see `error::eof` after reading all the remaining data. [endsect] [section:connect test::stream::connect] [indexterm2 connect..test::stream]
  5501. Establish a connection. [heading Synopsis] ``` void connect( stream& remote); ``` [heading Description] [endsect] [section:executor_type test::stream::executor_type] [indexterm2 executor_type..test::stream]
  5502. The type of the executor associated with the object. [heading Synopsis] ``` using executor_type = net::io_context::executor_type; ``` [heading Description] [endsect] [section:get_executor test::stream::get_executor] [indexterm2 get_executor..test::stream]
  5503. Return the executor associated with the object. [heading Synopsis] ``` executor_type get_executor(); ``` [heading Description] [endsect] [section:nread test::stream::nread] [indexterm2 nread..test::stream]
  5504. Return the number of reads. [heading Synopsis] ``` std::size_t nread() const; ``` [heading Description] [endsect] [section:nread_bytes test::stream::nread_bytes] [indexterm2 nread_bytes..test::stream]
  5505. Return the number of bytes read. [heading Synopsis] ``` std::size_t nread_bytes() const; ``` [heading Description] [endsect] [section:nwrite test::stream::nwrite] [indexterm2 nwrite..test::stream]
  5506. Return the number of writes. [heading Synopsis] ``` std::size_t nwrite() const; ``` [heading Description] [endsect] [section:nwrite_bytes test::stream::nwrite_bytes] [indexterm2 nwrite_bytes..test::stream]
  5507. Return the number of bytes written. [heading Synopsis] ``` std::size_t nwrite_bytes() const; ``` [heading Description] [endsect] [section:operator_eq_ test::stream::operator=] [indexterm2 operator=..test::stream]
  5508. Move Assignment. [heading Synopsis] ``` stream& operator=( stream&& other); ``` [heading Description]
  5509. Moving the stream while asynchronous operations are pending results in undefined behavior. [endsect] [section:read_size test::stream::read_size] [indexterm2 read_size..test::stream]
  5510. Set the maximum number of bytes returned by read\_some. [heading Synopsis] ``` void read_size( std::size_t n); ``` [heading Description] [endsect] [section:read_some test::stream::read_some] [indexterm2 read_some..test::stream]
  5511. Read some data from the stream. ``` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__test__stream.read_some.overload1 read_some]``( MutableBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__test__stream.read_some.overload1 more...]]`` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__test__stream.read_some.overload2 read_some]``( MutableBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__test__stream.read_some.overload2 more...]]`` ``` [section:overload1 test::stream::read_some (1 of 2 overloads)]
  5512. Read some data from the stream. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers); ``` [heading Description]
  5513. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  5514. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  5515. The buffers into which the data will be read. ]] ]
  5516. [heading Return Value]
  5517. The number of bytes read.
  5518. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  5519. Thrown on failure. ]] ]
  5520. [heading Remarks]
  5521. The `read_some` operation may not read all of the requested number of bytes. Consider using the function `net::read` if you need to ensure that the requested amount of data is read before the blocking operation completes.
  5522. [endsect] [section:overload2 test::stream::read_some (2 of 2 overloads)]
  5523. Read some data from the stream. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  5524. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  5525. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  5526. The buffers into which the data will be read. ]] [[`ec`][
  5527. Set to indicate what error occurred, if any. ]] ]
  5528. [heading Return Value]
  5529. The number of bytes read.
  5530. [heading Remarks]
  5531. The `read_some` operation may not read all of the requested number of bytes. Consider using the function `net::read` if you need to ensure that the requested amount of data is read before the blocking operation completes.
  5532. [endsect] [endsect] [section:str test::stream::str] [indexterm2 str..test::stream]
  5533. Returns a string view representing the pending input data. [heading Synopsis] ``` string_view str() const; ``` [heading Description] [endsect] [section:stream test::stream::stream] [indexterm2 stream..test::stream]
  5534. Move Constructor. ``` ``[link beast.ref.boost__beast__test__stream.stream.overload1 stream]``( stream&& other); ``[''''&raquo;''' [link beast.ref.boost__beast__test__stream.stream.overload1 more...]]`` ```
  5535. Construct a stream. ``` explicit ``[link beast.ref.boost__beast__test__stream.stream.overload2 stream]``( net::io_context& ioc); ``[''''&raquo;''' [link beast.ref.boost__beast__test__stream.stream.overload2 more...]]`` ``[link beast.ref.boost__beast__test__stream.stream.overload3 stream]``( net::io_context& ioc, fail_count& fc); ``[''''&raquo;''' [link beast.ref.boost__beast__test__stream.stream.overload3 more...]]`` ``[link beast.ref.boost__beast__test__stream.stream.overload4 stream]``( net::io_context& ioc, string_view s); ``[''''&raquo;''' [link beast.ref.boost__beast__test__stream.stream.overload4 more...]]`` ``[link beast.ref.boost__beast__test__stream.stream.overload5 stream]``( net::io_context& ioc, fail_count& fc, string_view s); ``[''''&raquo;''' [link beast.ref.boost__beast__test__stream.stream.overload5 more...]]`` ``` [section:overload1 test::stream::stream (1 of 5 overloads)]
  5536. Move Constructor. [heading Synopsis] ``` stream( stream&& other); ``` [heading Description]
  5537. Moving the stream while asynchronous operations are pending results in undefined behavior. [endsect] [section:overload2 test::stream::stream (2 of 5 overloads)]
  5538. Construct a stream. [heading Synopsis] ``` stream( net::io_context& ioc); ``` [heading Description]
  5539. The stream will be created in a disconnected state.
  5540. [heading Parameters] [table [[Name][Description]] [[`ioc`][
  5541. The `io_context` object that the stream will use to dispatch handlers for any asynchronous operations. ]] ]
  5542. [endsect] [section:overload3 test::stream::stream (3 of 5 overloads)]
  5543. Construct a stream. [heading Synopsis] ``` stream( net::io_context& ioc, fail_count& fc); ``` [heading Description]
  5544. The stream will be created in a disconnected state.
  5545. [heading Parameters] [table [[Name][Description]] [[`ioc`][
  5546. The `io_context` object that the stream will use to dispatch handlers for any asynchronous operations. ]] [[`fc`][
  5547. The [link beast.ref.boost__beast__test__fail_count `test::fail_count`] to associate with the stream. Each I/O operation performed on the stream will increment the fail count. When the fail count reaches its internal limit, a simulated failure error will be raised. ]] ]
  5548. [endsect] [section:overload4 test::stream::stream (4 of 5 overloads)]
  5549. Construct a stream. [heading Synopsis] ``` stream( net::io_context& ioc, string_view s); ``` [heading Description]
  5550. The stream will be created in a disconnected state.
  5551. [heading Parameters] [table [[Name][Description]] [[`ioc`][
  5552. The `io_context` object that the stream will use to dispatch handlers for any asynchronous operations. ]] [[`s`][
  5553. A string which will be appended to the input area, not including the null terminator. ]] ]
  5554. [endsect] [section:overload5 test::stream::stream (5 of 5 overloads)]
  5555. Construct a stream. [heading Synopsis] ``` stream( net::io_context& ioc, fail_count& fc, string_view s); ``` [heading Description]
  5556. The stream will be created in a disconnected state.
  5557. [heading Parameters] [table [[Name][Description]] [[`ioc`][
  5558. The `io_context` object that the stream will use to dispatch handlers for any asynchronous operations. ]] [[`fc`][
  5559. The [link beast.ref.boost__beast__test__fail_count `test::fail_count`] to associate with the stream. Each I/O operation performed on the stream will increment the fail count. When the fail count reaches its internal limit, a simulated failure error will be raised. ]] [[`s`][
  5560. A string which will be appended to the input area, not including the null terminator. ]] ]
  5561. [endsect] [endsect] [section:write_size test::stream::write_size] [indexterm2 write_size..test::stream]
  5562. Set the maximum number of bytes returned by write\_some. [heading Synopsis] ``` void write_size( std::size_t n); ``` [heading Description] [endsect] [section:write_some test::stream::write_some] [indexterm2 write_some..test::stream]
  5563. Write some data to the stream. ``` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__test__stream.write_some.overload1 write_some]``( ConstBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__test__stream.write_some.overload1 more...]]`` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__test__stream.write_some.overload2 write_some]``( ConstBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__test__stream.write_some.overload2 more...]]`` ``` [section:overload1 test::stream::write_some (1 of 2 overloads)]
  5564. Write some data to the stream. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers); ``` [heading Description]
  5565. This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
  5566. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  5567. The data to be written. ]] ]
  5568. [heading Return Value]
  5569. The number of bytes written.
  5570. [heading Exceptions] [table [[Type][Thrown On]] [[`boost::system::system_error`][
  5571. Thrown on failure. ]] ]
  5572. [heading Remarks]
  5573. The `write_some` operation may not transmit all of the data to the peer. Consider using the function `net::write` if you need to ensure that all data is written before the blocking operation completes.
  5574. [endsect] [section:overload2 test::stream::write_some (2 of 2 overloads)]
  5575. Write some data to the stream. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( ConstBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  5576. This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
  5577. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  5578. The data to be written. ]] [[`ec`][
  5579. Set to indicate what error occurred, if any. ]] ]
  5580. [heading Return Value]
  5581. The number of bytes written.
  5582. [heading Remarks]
  5583. The `write_some` operation may not transmit all of the data to the peer. Consider using the function `net::write` if you need to ensure that all data is written before the blocking operation completes.
  5584. [endsect] [endsect] [section:stream_dtor_ test::stream::~stream] [indexterm2 ~stream..test::stream]
  5585. Destructor. [heading Synopsis] ``` ~stream(); ``` [heading Description]
  5586. If an asynchronous read operation is pending, it will simply be discarded with no notification to the completion handler.
  5587. If a connection is established while the stream is destroyed, the peer will see the error `net::error::connection_reset` when performing any reads or writes. [endsect] [endsect] [section:boost__beast__test__stream__read_op test::stream::read_op] [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/stream.hpp] ``` template< class __Handler__, class Buffers> class read_op ``` [heading Description] [endsect] [section:boost__beast__test__stream__read_op_base test::stream::read_op_base] [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/stream.hpp] ``` struct read_op_base ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__test__stream__read_op_base.operator_lp__rp_ [*operator()]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__read_op_base.read_op_base_dtor_ [*~read_op_base]]] [ ] ] ] [heading Description] [section:operator_lp__rp_ test::stream::read_op_base::operator()] [indexterm2 operator()..test::stream::read_op_base] [heading Synopsis] ``` void operator()( error_code ec); ``` [heading Description] [endsect] [section:read_op_base_dtor_ test::stream::read_op_base::~read_op_base] [indexterm2 ~read_op_base..test::stream::read_op_base] [heading Synopsis] ``` virtual ~read_op_base(); ``` [heading Description] [endsect] [endsect] [section:boost__beast__test__stream__state test::stream::state] [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/stream.hpp] ``` struct state ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__test__stream__state.cancel_read [*cancel_read]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.notify_read [*notify_read]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.remove [*remove]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.state [*state]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.state_dtor_ [*~state]]] [ ] ] ] [heading Data Members] [table [[Name][Description]] [ [[link beast.ref.boost__beast__test__stream__state.b [*b]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.code [*code]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.cv [*cv]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.fc [*fc]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.ioc [*ioc]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.m [*m]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.nread [*nread]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.nread_bytes [*nread_bytes]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.nwrite [*nwrite]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.nwrite_bytes [*nwrite_bytes]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.op [*op]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.read_max [*read_max]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.wp [*wp]]] [ ] ] [ [[link beast.ref.boost__beast__test__stream__state.write_max [*write_max]]] [ ] ] ] [heading Description] [section:b test::stream::state::b] [indexterm2 b..test::stream::state] [heading Synopsis] ``` flat_buffer b; ``` [heading Description] [endsect] [section:cancel_read test::stream::state::cancel_read] [indexterm2 cancel_read..test::stream::state] [heading Synopsis] ``` void cancel_read(); ``` [heading Description] [endsect] [section:code test::stream::state::code] [indexterm2 code..test::stream::state] [heading Synopsis] ``` status code = status::ok; ``` [heading Description] [endsect] [section:cv test::stream::state::cv] [indexterm2 cv..test::stream::state] [heading Synopsis] ``` std::condition_variable cv; ``` [heading Description] [endsect] [section:fc test::stream::state::fc] [indexterm2 fc..test::stream::state] [heading Synopsis] ``` fail_count * fc = nullptr; ``` [heading Description] [endsect] [section:ioc test::stream::state::ioc] [indexterm2 ioc..test::stream::state] [heading Synopsis] ``` net::io_context & ioc; ``` [heading Description] [endsect] [section:m test::stream::state::m] [indexterm2 m..test::stream::state] [heading Synopsis] ``` std::mutex m; ``` [heading Description] [endsect] [section:notify_read test::stream::state::notify_read] [indexterm2 notify_read..test::stream::state] [heading Synopsis] ``` void notify_read(); ``` [heading Description] [endsect] [section:nread test::stream::state::nread] [indexterm2 nread..test::stream::state] [heading Synopsis] ``` std::size_t nread = 0; ``` [heading Description] [endsect] [section:nread_bytes test::stream::state::nread_bytes] [indexterm2 nread_bytes..test::stream::state] [heading Synopsis] ``` std::size_t nread_bytes = 0; ``` [heading Description] [endsect] [section:nwrite test::stream::state::nwrite] [indexterm2 nwrite..test::stream::state] [heading Synopsis] ``` std::size_t nwrite = 0; ``` [heading Description] [endsect] [section:nwrite_bytes test::stream::state::nwrite_bytes] [indexterm2 nwrite_bytes..test::stream::state] [heading Synopsis] ``` std::size_t nwrite_bytes = 0; ``` [heading Description] [endsect] [section:op test::stream::state::op] [indexterm2 op..test::stream::state] [heading Synopsis] ``` std::unique_ptr< read_op_base > op; ``` [heading Description] [endsect] [section:read_max test::stream::state::read_max] [indexterm2 read_max..test::stream::state] [heading Synopsis] ``` std::size_t read_max =
  5588. (std::numeric_limits<std::size_t>::max)(); ``` [heading Description] [endsect] [section:remove test::stream::state::remove] [indexterm2 remove..test::stream::state] [heading Synopsis] ``` void remove(); ``` [heading Description] [endsect] [section:state test::stream::state::state] [indexterm2 state..test::stream::state] [heading Synopsis] ``` state( net::io_context& ioc_, boost::weak_ptr< service_impl > wp_, fail_count* fc_); ``` [heading Description] [endsect] [section:wp test::stream::state::wp] [indexterm2 wp..test::stream::state] [heading Synopsis] ``` boost::weak_ptr< service_impl > wp; ``` [heading Description] [endsect] [section:write_max test::stream::state::write_max] [indexterm2 write_max..test::stream::state] [heading Synopsis] ``` std::size_t write_max =
  5589. (std::numeric_limits<std::size_t>::max)(); ``` [heading Description] [endsect] [section:state_dtor_ test::stream::state::~state] [indexterm2 ~state..test::stream::state] [heading Synopsis] ``` ~state(); ``` [heading Description] [endsect] [endsect] [section:boost__beast__test__success_handler test::success_handler] [indexterm1 test::success_handler]
  5590. Return a test CompletionHandler which requires success. [heading Synopsis] Defined in header [include_file boost/beast/_experimental/test/handler.hpp] ``` handler success_handler(); ``` [heading Description]
  5591. The returned handler can be invoked with any signature whose first parameter is an `error_code`. The handler fails the test if:
  5592. * The handler is destroyed without being invoked, or
  5593. * The handler is invoked with a non-successful error code.
  5594. [endsect] [section:boost__beast__to_static_string to_static_string] [indexterm1 to_static_string]
  5595. Returns a static string representing an integer as a decimal. [heading Synopsis] Defined in header [include_file boost/beast/core/static_string.hpp] ``` template< class Integer> static_string< detail::max_digits(sizeof(Integer))> to_static_string( Integer x); ``` [heading Description]
  5596. [heading Parameters] [table [[Name][Description]] [[`x`][
  5597. The signed or unsigned integer to convert. This must be an integral type. ]] ]
  5598. [heading Return Value]
  5599. A [link beast.ref.boost__beast__static_string `static_string`] with an implementation defined maximum size large enough to hold the longest possible decimal representation of any integer of the given type.
  5600. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__unlimited_rate_policy unlimited_rate_policy]
  5601. A rate policy with unlimited throughput. [heading Synopsis] Defined in header [include_file boost/beast/core/rate_policy.hpp] ``` class unlimited_rate_policy ``` [heading Description]
  5602. This rate policy object does not apply any rate limit.
  5603. [heading Concepts]
  5604. * ['RatePolicy]
  5605. [heading See Also]
  5606. [link beast.ref.boost__beast__basic_stream `basic_stream`], [link beast.ref.boost__beast__tcp_stream `tcp_stream`]
  5607. Convenience header [include_file boost/beast/core.hpp] [endsect] [section:boost__beast__websocket__async_teardown websocket::async_teardown] [indexterm1 websocket::async_teardown]
  5608. Start tearing down a connection. ``` template< class Socket, class TeardownHandler> void ``[link beast.ref.boost__beast__websocket__async_teardown.overload1 async_teardown]``( role_type role, Socket& socket, TeardownHandler&& handler); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__async_teardown.overload1 more...]]`` ```
  5609. Start tearing down a `net::ip::tcp::socket`. ``` template< class __Protocol__, class __Executor__, class TeardownHandler> void ``[link beast.ref.boost__beast__websocket__async_teardown.overload2 async_teardown]``( role_type role, net::basic_stream_socket< Protocol, Executor >& socket, TeardownHandler&& handler); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__async_teardown.overload2 more...]]`` ``` [section:overload1 websocket::async_teardown (1 of 2 overloads)]
  5610. Start tearing down a connection. [heading Synopsis] Defined in header [include_file boost/beast/websocket/teardown.hpp] ``` template< class Socket, class TeardownHandler> void async_teardown( role_type role, Socket& socket, TeardownHandler&& handler); ``` [heading Description]
  5611. This begins tearing down a connection asynchronously. The implementation will call the overload of this function based on the `Socket` parameter used to consruct the socket. When `Stream` is a user defined type, and not a `net::ip::tcp::socket` or any `net::ssl::stream`, callers are responsible for providing a suitable overload of this function.
  5612. [heading Parameters] [table [[Name][Description]] [[`role`][
  5613. The role of the local endpoint ]] [[`socket`][
  5614. The socket to tear down. ]] [[`handler`][
  5615. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  5616. error_code const& error // result of operation
  5617. );
  5618. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  5619. Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:overload2 websocket::async_teardown (2 of 2 overloads)]
  5620. Start tearing down a `net::ip::tcp::socket`. [heading Synopsis] Defined in header [include_file boost/beast/websocket/teardown.hpp] ``` template< class __Protocol__, class __Executor__, class TeardownHandler> void async_teardown( role_type role, net::basic_stream_socket< Protocol, Executor >& socket, TeardownHandler&& handler); ``` [heading Description]
  5621. This begins tearing down a connection asynchronously. The implementation will call the overload of this function based on the `Stream` parameter used to consruct the socket. When `Stream` is a user defined type, and not a `net::ip::tcp::socket` or any `net::ssl::stream`, callers are responsible for providing a suitable overload of this function.
  5622. [heading Parameters] [table [[Name][Description]] [[`role`][
  5623. The role of the local endpoint ]] [[`socket`][
  5624. The socket to tear down. ]] [[`handler`][
  5625. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  5626. error_code const& error // result of operation
  5627. );
  5628. ``` ]] ]
  5629. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. Convenience header [include_file boost/beast/websocket.hpp] [endsect] [endsect] [section:boost__beast__websocket__close_code websocket::close_code] [indexterm1 websocket::close_code]
  5630. Close status codes. [heading Synopsis] Defined in header [include_file boost/beast/websocket/rfc6455.hpp] ``` enum close_code ``` [indexterm2 normal..websocket::close_code] [indexterm2 going_away..websocket::close_code] [indexterm2 protocol_error..websocket::close_code] [indexterm2 unknown_data..websocket::close_code] [indexterm2 bad_payload..websocket::close_code] [indexterm2 policy_error..websocket::close_code] [indexterm2 too_big..websocket::close_code] [indexterm2 needs_extension..websocket::close_code] [indexterm2 internal_error..websocket::close_code] [indexterm2 service_restart..websocket::close_code] [indexterm2 try_again_later..websocket::close_code] [indexterm2 none..websocket::close_code] [indexterm2 reserved1..websocket::close_code] [indexterm2 no_status..websocket::close_code] [indexterm2 abnormal..websocket::close_code] [indexterm2 reserved2..websocket::close_code] [indexterm2 reserved3..websocket::close_code] [heading Values] [table [[Name][Description]] [[[^normal]][Normal closure; the connection successfully completed whatever purpose for which it was created. ]] [[[^going_away]][The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection. ]] [[[^protocol_error]][The endpoint is terminating the connection due to a protocol error. ]] [[[^unknown_data]][The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data). ]] [[[^bad_payload]][The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message). ]] [[[^policy_error]][The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable. ]] [[[^too_big]][The endpoint is terminating the connection because a data frame was received that is too large. ]] [[[^needs_extension]][The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't. ]] [[[^internal_error]][The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request. ]] [[[^service_restart]][The server is terminating the connection because it is restarting. ]] [[[^try_again_later]][The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients. ]] [[[^none]][Used internally to mean "no error". This code is reserved and may not be sent.
  5631. ]] [[[^reserved1]][Reserved for future use by the WebSocket standard. This code is reserved and may not be sent.
  5632. ]] [[[^no_status]][No status code was provided even though one was expected. This code is reserved and may not be sent.
  5633. ]] [[[^abnormal]][Connection was closed without receiving a close frame. This code is reserved and may not be sent.
  5634. ]] [[[^reserved2]][Reserved for future use by the WebSocket standard. This code is reserved and may not be sent.
  5635. ]] [[[^reserved3]][Reserved for future use by the WebSocket standard. This code is reserved and may not be sent.
  5636. ]] ] [heading Description]
  5637. These codes accompany close frames.
  5638. [heading See Also]
  5639. [@https://tools.ietf.org/html/rfc6455#section-7.4.1 RFC 6455 7.4.1 Defined Status Codes]
  5640. Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__close_reason websocket::close_reason]
  5641. Description of the close reason. [heading Synopsis] Defined in header [include_file boost/beast/websocket/rfc6455.hpp] ``` struct close_reason ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__websocket__close_reason.close_reason [*close_reason]]] [ Default constructor. Construct from a code. Construct from a reason string. code is close_code::normal. Construct from a reason string literal. code is close_code::normal. Construct from a close code and reason string. ] ] [ [[link beast.ref.boost__beast__websocket__close_reason.operator_bool [*operator bool]]] [ Returns true if a code was specified. ] ] ] [heading Data Members] [table [[Name][Description]] [ [[link beast.ref.boost__beast__websocket__close_reason.code [*code]]] [ The close code. ] ] [ [[link beast.ref.boost__beast__websocket__close_reason.reason [*reason]]] [ The optional utf8-encoded reason string. ] ] ] [heading Description]
  5642. This object stores the close code (if any) and the optional utf-8 encoded implementation defined reason string. [section:close_reason websocket::close_reason::close_reason] [indexterm2 close_reason..websocket::close_reason]
  5643. Default constructor. ``` ``[link beast.ref.boost__beast__websocket__close_reason.close_reason.overload1 close_reason]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__close_reason.close_reason.overload1 more...]]`` ```
  5644. Construct from a code. ``` ``[link beast.ref.boost__beast__websocket__close_reason.close_reason.overload2 close_reason]``( std::uint16_t code_); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__close_reason.close_reason.overload2 more...]]`` ```
  5645. Construct from a reason string. code is close\_code::normal. ``` ``[link beast.ref.boost__beast__websocket__close_reason.close_reason.overload3 close_reason]``( string_view s); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__close_reason.close_reason.overload3 more...]]`` ```
  5646. Construct from a reason string literal. code is close\_code::normal. ``` ``[link beast.ref.boost__beast__websocket__close_reason.close_reason.overload4 close_reason]``( char const* s); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__close_reason.close_reason.overload4 more...]]`` ```
  5647. Construct from a close code and reason string. ``` ``[link beast.ref.boost__beast__websocket__close_reason.close_reason.overload5 close_reason]``( close_code code_, string_view s); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__close_reason.close_reason.overload5 more...]]`` ``` [section:overload1 websocket::close_reason::close_reason (1 of 5 overloads)]
  5648. Default constructor. [heading Synopsis] ``` close_reason(); ``` [heading Description]
  5649. The code will be none. Default constructed objects will explicitly convert to bool as `false`. [endsect] [section:overload2 websocket::close_reason::close_reason (2 of 5 overloads)]
  5650. Construct from a code. [heading Synopsis] ``` close_reason( std::uint16_t code_); ``` [heading Description] [endsect] [section:overload3 websocket::close_reason::close_reason (3 of 5 overloads)]
  5651. Construct from a reason string. code is close\_code::normal. [heading Synopsis] ``` close_reason( string_view s); ``` [heading Description] [endsect] [section:overload4 websocket::close_reason::close_reason (4 of 5 overloads)]
  5652. Construct from a reason string literal. code is close\_code::normal. [heading Synopsis] ``` close_reason( char const* s); ``` [heading Description] [endsect] [section:overload5 websocket::close_reason::close_reason (5 of 5 overloads)]
  5653. Construct from a close code and reason string. [heading Synopsis] ``` close_reason( close_code code_, string_view s); ``` [heading Description] [endsect] [endsect] [section:code websocket::close_reason::code] [indexterm2 code..websocket::close_reason]
  5654. The close code. [heading Synopsis] ``` std::uint16_t code = close_code::none; ``` [heading Description] [endsect] [section:operator_bool websocket::close_reason::operator bool] [indexterm2 operator bool..websocket::close_reason]
  5655. Returns `true` if a code was specified. [heading Synopsis] ``` operator bool() const; ``` [heading Description] [endsect] [section:reason websocket::close_reason::reason] [indexterm2 reason..websocket::close_reason]
  5656. The optional utf8-encoded reason string. [heading Synopsis] ``` reason_string reason; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__condition websocket::condition] [indexterm1 websocket::condition]
  5657. Error conditions corresponding to sets of error codes. [heading Synopsis] Defined in header [include_file boost/beast/websocket/error.hpp] ``` enum condition ``` [indexterm2 handshake_failed..websocket::condition] [indexterm2 protocol_violation..websocket::condition] [heading Values] [table [[Name][Description]] [[[^handshake_failed]][The WebSocket handshake failed. This condition indicates that the WebSocket handshake failed. If
  5658. the corresponding HTTP response indicates the keep-alive behavior,
  5659. then the handshake may be reattempted.
  5660. ]] [[[^protocol_violation]][A WebSocket protocol violation occurred. This condition indicates that the remote peer on the WebSocket
  5661. connection sent data which violated the protocol.
  5662. ]] ] [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__error websocket::error] [indexterm1 websocket::error]
  5663. Error codes returned from [link beast.ref.boost__beast__websocket__stream `websocket::stream`] operations. [heading Synopsis] Defined in header [include_file boost/beast/websocket/error.hpp] ``` enum error ``` [indexterm2 closed..websocket::error] [indexterm2 buffer_overflow..websocket::error] [indexterm2 partial_deflate_block..websocket::error] [indexterm2 message_too_big..websocket::error] [indexterm2 bad_http_version..websocket::error] [indexterm2 bad_method..websocket::error] [indexterm2 no_host..websocket::error] [indexterm2 no_connection..websocket::error] [indexterm2 no_connection_upgrade..websocket::error] [indexterm2 no_upgrade..websocket::error] [indexterm2 no_upgrade_websocket..websocket::error] [indexterm2 no_sec_key..websocket::error] [indexterm2 bad_sec_key..websocket::error] [indexterm2 no_sec_version..websocket::error] [indexterm2 bad_sec_version..websocket::error] [indexterm2 no_sec_accept..websocket::error] [indexterm2 bad_sec_accept..websocket::error] [indexterm2 upgrade_declined..websocket::error] [indexterm2 bad_opcode..websocket::error] [indexterm2 bad_data_frame..websocket::error] [indexterm2 bad_continuation..websocket::error] [indexterm2 bad_reserved_bits..websocket::error] [indexterm2 bad_control_fragment..websocket::error] [indexterm2 bad_control_size..websocket::error] [indexterm2 bad_unmasked_frame..websocket::error] [indexterm2 bad_masked_frame..websocket::error] [indexterm2 bad_size..websocket::error] [indexterm2 bad_frame_payload..websocket::error] [indexterm2 bad_close_code..websocket::error] [indexterm2 bad_close_size..websocket::error] [indexterm2 bad_close_payload..websocket::error] [heading Values] [table [[Name][Description]] [[[^closed]][The WebSocket stream was gracefully closed at both endpoints. ]] [[[^buffer_overflow]][The WebSocket operation caused a dynamic buffer overflow. ]] [[[^partial_deflate_block]][The WebSocket stream produced an incomplete deflate block. ]] [[[^message_too_big]][The WebSocket message exceeded the locally configured limit. ]] [[[^bad_http_version]][The WebSocket handshake was not HTTP/1.1. Error codes with this value will compare equal to @ref condition::handshake_failed
  5664. ]] [[[^bad_method]][The WebSocket handshake method was not GET. Error codes with this value will compare equal to @ref condition::handshake_failed
  5665. ]] [[[^no_host]][The WebSocket handshake Host field is missing. Error codes with this value will compare equal to @ref condition::handshake_failed
  5666. ]] [[[^no_connection]][The WebSocket handshake Connection field is missing. Error codes with this value will compare equal to @ref condition::handshake_failed
  5667. ]] [[[^no_connection_upgrade]][The WebSocket handshake Connection field is missing the upgrade token. Error codes with this value will compare equal to @ref condition::handshake_failed
  5668. ]] [[[^no_upgrade]][The WebSocket handshake Upgrade field is missing. Error codes with this value will compare equal to @ref condition::handshake_failed
  5669. ]] [[[^no_upgrade_websocket]][The WebSocket handshake Upgrade field is missing the websocket token. Error codes with this value will compare equal to @ref condition::handshake_failed
  5670. ]] [[[^no_sec_key]][The WebSocket handshake Sec-WebSocket-Key field is missing. Error codes with this value will compare equal to @ref condition::handshake_failed
  5671. ]] [[[^bad_sec_key]][The WebSocket handshake Sec-WebSocket-Key field is invalid. Error codes with this value will compare equal to @ref condition::handshake_failed
  5672. ]] [[[^no_sec_version]][The WebSocket handshake Sec-WebSocket-Version field is missing. Error codes with this value will compare equal to @ref condition::handshake_failed
  5673. ]] [[[^bad_sec_version]][The WebSocket handshake Sec-WebSocket-Version field is invalid. Error codes with this value will compare equal to @ref condition::handshake_failed
  5674. ]] [[[^no_sec_accept]][The WebSocket handshake Sec-WebSocket-Accept field is missing. Error codes with this value will compare equal to @ref condition::handshake_failed
  5675. ]] [[[^bad_sec_accept]][The WebSocket handshake Sec-WebSocket-Accept field is invalid. Error codes with this value will compare equal to @ref condition::handshake_failed
  5676. ]] [[[^upgrade_declined]][The WebSocket handshake was declined by the remote peer. Error codes with this value will compare equal to @ref condition::handshake_failed
  5677. ]] [[[^bad_opcode]][The WebSocket frame contained an illegal opcode. Error codes with this value will compare equal to @ref condition::protocol_violation
  5678. ]] [[[^bad_data_frame]][The WebSocket data frame was unexpected. Error codes with this value will compare equal to @ref condition::protocol_violation
  5679. ]] [[[^bad_continuation]][The WebSocket continuation frame was unexpected. Error codes with this value will compare equal to @ref condition::protocol_violation
  5680. ]] [[[^bad_reserved_bits]][The WebSocket frame contained illegal reserved bits. Error codes with this value will compare equal to @ref condition::protocol_violation
  5681. ]] [[[^bad_control_fragment]][The WebSocket control frame was fragmented. Error codes with this value will compare equal to @ref condition::protocol_violation
  5682. ]] [[[^bad_control_size]][The WebSocket control frame size was invalid. Error codes with this value will compare equal to @ref condition::protocol_violation
  5683. ]] [[[^bad_unmasked_frame]][The WebSocket frame was unmasked. Error codes with this value will compare equal to @ref condition::protocol_violation
  5684. ]] [[[^bad_masked_frame]][The WebSocket frame was masked. Error codes with this value will compare equal to @ref condition::protocol_violation
  5685. ]] [[[^bad_size]][The WebSocket frame size was not canonical. Error codes with this value will compare equal to @ref condition::protocol_violation
  5686. ]] [[[^bad_frame_payload]][The WebSocket frame payload was not valid utf8. Error codes with this value will compare equal to @ref condition::protocol_violation
  5687. ]] [[[^bad_close_code]][The WebSocket close frame reason code was invalid. Error codes with this value will compare equal to @ref condition::protocol_violation
  5688. ]] [[[^bad_close_size]][The WebSocket close frame payload size was invalid. Error codes with this value will compare equal to @ref condition::protocol_violation
  5689. ]] [[[^bad_close_payload]][The WebSocket close frame payload was not valid utf8. Error codes with this value will compare equal to @ref condition::protocol_violation
  5690. ]] ] [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__frame_type websocket::frame_type] [indexterm1 websocket::frame_type]
  5691. The type of received control frame. [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` enum frame_type ``` [indexterm2 close..websocket::frame_type] [indexterm2 ping..websocket::frame_type] [indexterm2 pong..websocket::frame_type] [heading Values] [table [[Name][Description]] [[[^close]][A close frame was received. ]] [[[^ping]][A ping frame was received. ]] [[[^pong]][A pong frame was received. ]] ] [heading Description]
  5692. Values of this type are passed to the control frame callback set using [link beast.ref.boost__beast__websocket__stream.control_callback `websocket::stream::control_callback`]. Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__is_upgrade websocket::is_upgrade] [indexterm1 websocket::is_upgrade]
  5693. Returns `true` if the specified HTTP request is a WebSocket Upgrade. [heading Synopsis] Defined in header [include_file boost/beast/websocket/rfc6455.hpp] ``` template< class __Allocator__> bool is_upgrade( beast::http::header< true, http::basic_fields< Allocator >> const& req); ``` [heading Description]
  5694. This function returns `true` when the passed HTTP Request indicates a WebSocket Upgrade. It does not validate the contents of the fields: it just trivially accepts requests which could only possibly be a valid or invalid WebSocket Upgrade message.
  5695. Callers who wish to manually read HTTP requests in their server implementation can use this function to determine if the request should be routed to an instance of [link beast.ref.boost__beast__websocket__stream `websocket::stream`].
  5696. [heading Example]
  5697. ``` void handle_connection(net::ip::tcp::socket& sock)
  5698. {
  5699. boost::beast::flat_buffer buffer;
  5700. boost::beast::http::request<boost::beast::http::string_body> req;
  5701. boost::beast::http::read(sock, buffer, req);
  5702. if(boost::beast::websocket::is_upgrade(req))
  5703. {
  5704. boost::beast::websocket::stream<decltype(sock)> ws{std::move(sock)};
  5705. ws.accept(req);
  5706. }
  5707. }
  5708. ```
  5709. [heading Parameters] [table [[Name][Description]] [[`req`][
  5710. The HTTP Request object to check. ]] ]
  5711. [heading Return Value]
  5712. `true` if the request is a WebSocket Upgrade.
  5713. Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__permessage_deflate websocket::permessage_deflate]
  5714. permessage-deflate extension options. [heading Synopsis] Defined in header [include_file boost/beast/websocket/option.hpp] ``` struct permessage_deflate ``` [heading Data Members] [table [[Name][Description]] [ [[link beast.ref.boost__beast__websocket__permessage_deflate.client_enable [*client_enable]]] [ true to offer the extension in the client role ] ] [ [[link beast.ref.boost__beast__websocket__permessage_deflate.client_max_window_bits [*client_max_window_bits]]] [ Maximum client window bits to offer. ] ] [ [[link beast.ref.boost__beast__websocket__permessage_deflate.client_no_context_takeover [*client_no_context_takeover]]] [ true if client_no_context_takeover desired ] ] [ [[link beast.ref.boost__beast__websocket__permessage_deflate.compLevel [*compLevel]]] [ Deflate compression level 0..9. ] ] [ [[link beast.ref.boost__beast__websocket__permessage_deflate.memLevel [*memLevel]]] [ Deflate memory level, 1..9. ] ] [ [[link beast.ref.boost__beast__websocket__permessage_deflate.server_enable [*server_enable]]] [ true to offer the extension in the server role ] ] [ [[link beast.ref.boost__beast__websocket__permessage_deflate.server_max_window_bits [*server_max_window_bits]]] [ Maximum server window bits to offer. ] ] [ [[link beast.ref.boost__beast__websocket__permessage_deflate.server_no_context_takeover [*server_no_context_takeover]]] [ true if server_no_context_takeover desired ] ] ] [heading Description]
  5715. These settings control the permessage-deflate extension, which allows messages to be compressed.
  5716. [heading Remarks]
  5717. Objects of this type are used with [link beast.ref.boost__beast__websocket__stream.set_option `websocket::stream::set_option`].
  5718. [section:client_enable websocket::permessage_deflate::client_enable] [indexterm2 client_enable..websocket::permessage_deflate]
  5719. `true` to offer the extension in the client role [heading Synopsis] ``` bool client_enable = false; ``` [heading Description] [endsect] [section:client_max_window_bits websocket::permessage_deflate::client_max_window_bits] [indexterm2 client_max_window_bits..websocket::permessage_deflate]
  5720. Maximum client window bits to offer. [heading Synopsis] ``` int client_max_window_bits = 15; ``` [heading Description]
  5721. [heading Remarks]
  5722. Due to a bug in ZLib, this value must be greater than 8.
  5723. [endsect] [section:client_no_context_takeover websocket::permessage_deflate::client_no_context_takeover] [indexterm2 client_no_context_takeover..websocket::permessage_deflate]
  5724. `true` if client\_no\_context\_takeover desired [heading Synopsis] ``` bool client_no_context_takeover = false; ``` [heading Description] [endsect] [section:compLevel websocket::permessage_deflate::compLevel] [indexterm2 compLevel..websocket::permessage_deflate]
  5725. Deflate compression level 0..9. [heading Synopsis] ``` int compLevel = 8; ``` [heading Description] [endsect] [section:memLevel websocket::permessage_deflate::memLevel] [indexterm2 memLevel..websocket::permessage_deflate]
  5726. Deflate memory level, 1..9. [heading Synopsis] ``` int memLevel = 4; ``` [heading Description] [endsect] [section:server_enable websocket::permessage_deflate::server_enable] [indexterm2 server_enable..websocket::permessage_deflate]
  5727. `true` to offer the extension in the server role [heading Synopsis] ``` bool server_enable = false; ``` [heading Description] [endsect] [section:server_max_window_bits websocket::permessage_deflate::server_max_window_bits] [indexterm2 server_max_window_bits..websocket::permessage_deflate]
  5728. Maximum server window bits to offer. [heading Synopsis] ``` int server_max_window_bits = 15; ``` [heading Description]
  5729. [heading Remarks]
  5730. Due to a bug in ZLib, this value must be greater than 8.
  5731. [endsect] [section:server_no_context_takeover websocket::permessage_deflate::server_no_context_takeover] [indexterm2 server_no_context_takeover..websocket::permessage_deflate]
  5732. `true` if server\_no\_context\_takeover desired [heading Synopsis] ``` bool server_no_context_takeover = false; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__ping_data websocket::ping_data] [indexterm1 websocket::ping_data]
  5733. The type representing the payload of ping and pong messages. [heading Synopsis] Defined in header [include_file boost/beast/websocket/rfc6455.hpp] ``` using ping_data = static_string< 125, char >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_string.const_iterator [*const_iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.const_pointer [*const_pointer]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.const_reference [*const_reference]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.const_reverse_iterator [*const_reverse_iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.difference_type [*difference_type]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.iterator [*iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.pointer [*pointer]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.reference [*reference]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.reverse_iterator [*reverse_iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.size_type [*size_type]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.string_view_type [*string_view_type]]] [ The type of string_view returned by the interface. ] ] [ [[link beast.ref.boost__beast__static_string.traits_type [*traits_type]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.value_type [*value_type]]] [ ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_string.append [*append]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.assign [*assign]]] [ Assign count copies of ch. Assign from another static_string Assign count characterss starting at npos from other. Assign the first count characters of s, including nulls. Assign a null terminated string. Assign from an iterator range of characters. Assign from any object convertible to string_view_type. ] ] [ [[link beast.ref.boost__beast__static_string.at [*at]]] [ Access specified character with bounds checking. ] ] [ [[link beast.ref.boost__beast__static_string.back [*back]]] [ Accesses the last character. ] ] [ [[link beast.ref.boost__beast__static_string.begin [*begin]]] [ Returns an iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.c_str [*c_str]]] [ Returns a non-modifiable standard C character array version of the string. ] ] [ [[link beast.ref.boost__beast__static_string.capacity [*capacity]]] [ Returns the number of characters that can be held in currently allocated storage. ] ] [ [[link beast.ref.boost__beast__static_string.cbegin [*cbegin]]] [ Returns an iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.cend [*cend]]] [ Returns an iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.clear [*clear]]] [ Clears the contents. ] ] [ [[link beast.ref.boost__beast__static_string.compare [*compare]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.copy [*copy]]] [ Copy a substring (pos, pos+count) to character string pointed to by dest. ] ] [ [[link beast.ref.boost__beast__static_string.crbegin [*crbegin]]] [ Returns a reverse iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.crend [*crend]]] [ Returns a reverse iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.data [*data]]] [ Returns a pointer to the first character of a string. ] ] [ [[link beast.ref.boost__beast__static_string.empty [*empty]]] [ Returns true if the string is empty. ] ] [ [[link beast.ref.boost__beast__static_string.end [*end]]] [ Returns an iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.erase [*erase]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.front [*front]]] [ Accesses the first character. ] ] [ [[link beast.ref.boost__beast__static_string.insert [*insert]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.length [*length]]] [ Returns the number of characters, excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.max_size [*max_size]]] [ Returns the maximum number of characters that can be stored, excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.operator_string_view_type [*operator string_view_type]]] [ Convert a static string to a string_view_type ] ] [ [[link beast.ref.boost__beast__static_string.operator_plus__eq_ [*operator+=]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.operator_eq_ [*operator=]]] [ Copy assignment. Assign from null-terminated string. Assign from single character. Assign from initializer list. Assign from string_view_type. ] ] [ [[link beast.ref.boost__beast__static_string.operator_lb__rb_ [*operator\[\]]]] [ Access specified character. ] ] [ [[link beast.ref.boost__beast__static_string.pop_back [*pop_back]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.push_back [*push_back]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.rbegin [*rbegin]]] [ Returns a reverse iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.rend [*rend]]] [ Returns a reverse iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.reserve [*reserve]]] [ Reserves storage. ] ] [ [[link beast.ref.boost__beast__static_string.resize [*resize]]] [ Changes the number of characters stored. ] ] [ [[link beast.ref.boost__beast__static_string.shrink_to_fit [*shrink_to_fit]]] [ Reduces memory usage by freeing unused memory. ] ] [ [[link beast.ref.boost__beast__static_string.size [*size]]] [ Returns the number of characters, excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.static_string [*static_string]]] [ Default constructor (empty string). Construct with count copies of character ch. Construct with a substring (pos, other.size()) of other. Construct with a substring (pos, count) of other. Construct with the first count characters of s, including nulls. Construct from a null terminated string. Construct from a range of characters. Copy constructor. Construct from an initializer list. Construct from a string_view Construct from any object convertible to string_view_type. ] ] [ [[link beast.ref.boost__beast__static_string.substr [*substr]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.swap [*swap]]] [ Exchange the contents of this string with another. ] ] ] [heading Data Members] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_string.max_size_n [*max_size_n]]] [ Maximum size of the string excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.npos [*npos]]] [ A special index. ] ] ]
  5734. These objects behave like `std::string` except that the storage is not dynamically allocated but rather fixed in size.
  5735. These strings offer performance advantages when a protocol imposes a natural small upper limit on the size of a value.
  5736. [heading Remarks]
  5737. The stored string is always null-terminated.
  5738. [heading See Also]
  5739. [link beast.ref.boost__beast__to_static_string `to_static_string`]
  5740. [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__reason_string websocket::reason_string] [indexterm1 websocket::reason_string]
  5741. The type representing the reason string in a close frame. [heading Synopsis] Defined in header [include_file boost/beast/websocket/rfc6455.hpp] ``` using reason_string = static_string< 123, char >; ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_string.const_iterator [*const_iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.const_pointer [*const_pointer]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.const_reference [*const_reference]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.const_reverse_iterator [*const_reverse_iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.difference_type [*difference_type]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.iterator [*iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.pointer [*pointer]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.reference [*reference]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.reverse_iterator [*reverse_iterator]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.size_type [*size_type]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.string_view_type [*string_view_type]]] [ The type of string_view returned by the interface. ] ] [ [[link beast.ref.boost__beast__static_string.traits_type [*traits_type]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.value_type [*value_type]]] [ ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_string.append [*append]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.assign [*assign]]] [ Assign count copies of ch. Assign from another static_string Assign count characterss starting at npos from other. Assign the first count characters of s, including nulls. Assign a null terminated string. Assign from an iterator range of characters. Assign from any object convertible to string_view_type. ] ] [ [[link beast.ref.boost__beast__static_string.at [*at]]] [ Access specified character with bounds checking. ] ] [ [[link beast.ref.boost__beast__static_string.back [*back]]] [ Accesses the last character. ] ] [ [[link beast.ref.boost__beast__static_string.begin [*begin]]] [ Returns an iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.c_str [*c_str]]] [ Returns a non-modifiable standard C character array version of the string. ] ] [ [[link beast.ref.boost__beast__static_string.capacity [*capacity]]] [ Returns the number of characters that can be held in currently allocated storage. ] ] [ [[link beast.ref.boost__beast__static_string.cbegin [*cbegin]]] [ Returns an iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.cend [*cend]]] [ Returns an iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.clear [*clear]]] [ Clears the contents. ] ] [ [[link beast.ref.boost__beast__static_string.compare [*compare]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.copy [*copy]]] [ Copy a substring (pos, pos+count) to character string pointed to by dest. ] ] [ [[link beast.ref.boost__beast__static_string.crbegin [*crbegin]]] [ Returns a reverse iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.crend [*crend]]] [ Returns a reverse iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.data [*data]]] [ Returns a pointer to the first character of a string. ] ] [ [[link beast.ref.boost__beast__static_string.empty [*empty]]] [ Returns true if the string is empty. ] ] [ [[link beast.ref.boost__beast__static_string.end [*end]]] [ Returns an iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.erase [*erase]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.front [*front]]] [ Accesses the first character. ] ] [ [[link beast.ref.boost__beast__static_string.insert [*insert]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.length [*length]]] [ Returns the number of characters, excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.max_size [*max_size]]] [ Returns the maximum number of characters that can be stored, excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.operator_string_view_type [*operator string_view_type]]] [ Convert a static string to a string_view_type ] ] [ [[link beast.ref.boost__beast__static_string.operator_plus__eq_ [*operator+=]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.operator_eq_ [*operator=]]] [ Copy assignment. Assign from null-terminated string. Assign from single character. Assign from initializer list. Assign from string_view_type. ] ] [ [[link beast.ref.boost__beast__static_string.operator_lb__rb_ [*operator\[\]]]] [ Access specified character. ] ] [ [[link beast.ref.boost__beast__static_string.pop_back [*pop_back]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.push_back [*push_back]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.rbegin [*rbegin]]] [ Returns a reverse iterator to the beginning. ] ] [ [[link beast.ref.boost__beast__static_string.rend [*rend]]] [ Returns a reverse iterator to the end. ] ] [ [[link beast.ref.boost__beast__static_string.reserve [*reserve]]] [ Reserves storage. ] ] [ [[link beast.ref.boost__beast__static_string.resize [*resize]]] [ Changes the number of characters stored. ] ] [ [[link beast.ref.boost__beast__static_string.shrink_to_fit [*shrink_to_fit]]] [ Reduces memory usage by freeing unused memory. ] ] [ [[link beast.ref.boost__beast__static_string.size [*size]]] [ Returns the number of characters, excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.static_string [*static_string]]] [ Default constructor (empty string). Construct with count copies of character ch. Construct with a substring (pos, other.size()) of other. Construct with a substring (pos, count) of other. Construct with the first count characters of s, including nulls. Construct from a null terminated string. Construct from a range of characters. Copy constructor. Construct from an initializer list. Construct from a string_view Construct from any object convertible to string_view_type. ] ] [ [[link beast.ref.boost__beast__static_string.substr [*substr]]] [ ] ] [ [[link beast.ref.boost__beast__static_string.swap [*swap]]] [ Exchange the contents of this string with another. ] ] ] [heading Data Members] [table [[Name][Description]] [ [[link beast.ref.boost__beast__static_string.max_size_n [*max_size_n]]] [ Maximum size of the string excluding the null terminator. ] ] [ [[link beast.ref.boost__beast__static_string.npos [*npos]]] [ A special index. ] ] ]
  5742. These objects behave like `std::string` except that the storage is not dynamically allocated but rather fixed in size.
  5743. These strings offer performance advantages when a protocol imposes a natural small upper limit on the size of a value.
  5744. [heading Remarks]
  5745. The stored string is always null-terminated.
  5746. [heading See Also]
  5747. [link beast.ref.boost__beast__to_static_string `to_static_string`]
  5748. [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__request_type websocket::request_type] [indexterm1 websocket::request_type]
  5749. The type of object holding HTTP Upgrade requests. [heading Synopsis] Defined in header [include_file boost/beast/websocket/rfc6455.hpp] ``` using request_type = http::request< http::empty_body >; ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__response_type websocket::response_type] [indexterm1 websocket::response_type]
  5750. The type of object holding HTTP Upgrade responses. [heading Synopsis] Defined in header [include_file boost/beast/websocket/rfc6455.hpp] ``` using response_type = http::response< http::string_body >; ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__seed_prng websocket::seed_prng] [indexterm1 websocket::seed_prng]
  5751. Manually provide a one-time seed to initialize the PRNG. [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` void seed_prng( std::seed_seq& ss); ``` [heading Description]
  5752. This function invokes the specified seed sequence to produce a seed suitable for use with the pseudo-random number generator used to create masks and perform WebSocket protocol handshakes.
  5753. If a seed is not manually provided, the implementation will perform a one-time seed generation using `std::random_device`. This function may be used when the application runs in an environment where the random device is unreliable or does not provide sufficient entropy.
  5754. [heading Preconditions]
  5755. This function may not be called after any websocket [link beast.ref.boost__beast__websocket__stream `websocket::stream`] objects have been constructed.
  5756. [heading Parameters] [table [[Name][Description]] [[`ss`][
  5757. A reference to a `std::seed_seq` which will be used to seed the pseudo-random number generator. The seed sequence should have at least 256 bits of entropy. ]] ]
  5758. [heading See Also]
  5759. [link beast.ref.boost__beast__websocket__stream.secure_prng `websocket::stream::secure_prng`]
  5760. Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream websocket::stream]
  5761. Provides message-oriented functionality using WebSocket. [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` template< class NextLayer, bool deflateSupported> class stream ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__websocket__stream.executor_type [*executor_type]]] [ The type of the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__websocket__stream.is_deflate_supported [*is_deflate_supported]]] [ Indicates if the permessage-deflate extension is supported. ] ] [ [[link beast.ref.boost__beast__websocket__stream.next_layer_type [*next_layer_type]]] [ The type of the next layer. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__websocket__stream.accept [*accept]]] [ Perform the WebSocket handshake in the server role. Read and respond to a WebSocket HTTP Upgrade request. Respond to a WebSocket HTTP Upgrade request. ] ] [ [[link beast.ref.boost__beast__websocket__stream.async_accept [*async_accept]]] [ Perform the WebSocket handshake asynchronously in the server role. ] ] [ [[link beast.ref.boost__beast__websocket__stream.async_close [*async_close]]] [ Send a websocket close control frame asynchronously. ] ] [ [[link beast.ref.boost__beast__websocket__stream.async_handshake [*async_handshake]]] [ Perform the WebSocket handshake asynchronously in the client role. ] ] [ [[link beast.ref.boost__beast__websocket__stream.async_ping [*async_ping]]] [ Send a websocket ping control frame asynchronously. ] ] [ [[link beast.ref.boost__beast__websocket__stream.async_pong [*async_pong]]] [ Send a websocket pong control frame asynchronously. ] ] [ [[link beast.ref.boost__beast__websocket__stream.async_read [*async_read]]] [ Read a complete message asynchronously. ] ] [ [[link beast.ref.boost__beast__websocket__stream.async_read_some [*async_read_some]]] [ Read some message data asynchronously. ] ] [ [[link beast.ref.boost__beast__websocket__stream.async_write [*async_write]]] [ Write a complete message asynchronously. ] ] [ [[link beast.ref.boost__beast__websocket__stream.async_write_some [*async_write_some]]] [ Write some message data asynchronously. ] ] [ [[link beast.ref.boost__beast__websocket__stream.auto_fragment [*auto_fragment]]] [ Set the automatic fragmentation option. Returns true if the automatic fragmentation option is set. ] ] [ [[link beast.ref.boost__beast__websocket__stream.binary [*binary]]] [ Set the binary message write option. Returns true if the binary message write option is set. ] ] [ [[link beast.ref.boost__beast__websocket__stream.close [*close]]] [ Send a websocket close control frame. ] ] [ [[link beast.ref.boost__beast__websocket__stream.control_callback [*control_callback]]] [ Set a callback to be invoked on each incoming control frame. Reset the control frame callback. ] ] [ [[link beast.ref.boost__beast__websocket__stream.get_executor [*get_executor]]] [ Get the executor associated with the object. ] ] [ [[link beast.ref.boost__beast__websocket__stream.get_option [*get_option]]] [ Get the permessage-deflate extension options. ] ] [ [[link beast.ref.boost__beast__websocket__stream.got_binary [*got_binary]]] [ Returns true if the latest message data indicates binary. ] ] [ [[link beast.ref.boost__beast__websocket__stream.got_text [*got_text]]] [ Returns true if the latest message data indicates text. ] ] [ [[link beast.ref.boost__beast__websocket__stream.handshake [*handshake]]] [ Perform the WebSocket handshake in the client role. ] ] [ [[link beast.ref.boost__beast__websocket__stream.is_message_done [*is_message_done]]] [ Returns true if the last completed read finished the current message. ] ] [ [[link beast.ref.boost__beast__websocket__stream.is_open [*is_open]]] [ Returns true if the stream is open. ] ] [ [[link beast.ref.boost__beast__websocket__stream.next_layer [*next_layer]]] [ Get a reference to the next layer. ] ] [ [[link beast.ref.boost__beast__websocket__stream.operator_eq_ [*operator=]]] [ Move assignment (deleted) ] ] [ [[link beast.ref.boost__beast__websocket__stream.ping [*ping]]] [ Send a websocket ping control frame. ] ] [ [[link beast.ref.boost__beast__websocket__stream.pong [*pong]]] [ Send a websocket pong control frame. ] ] [ [[link beast.ref.boost__beast__websocket__stream.read [*read]]] [ Read a complete message. ] ] [ [[link beast.ref.boost__beast__websocket__stream.read_message_max [*read_message_max]]] [ Set the maximum incoming message size option. Returns the maximum incoming message size setting. ] ] [ [[link beast.ref.boost__beast__websocket__stream.read_size_hint [*read_size_hint]]] [ Returns a suggested maximum buffer size for the next call to read. ] ] [ [[link beast.ref.boost__beast__websocket__stream.read_some [*read_some]]] [ Read some message data. ] ] [ [[link beast.ref.boost__beast__websocket__stream.reason [*reason]]] [ Returns the close reason received from the remote peer. ] ] [ [[link beast.ref.boost__beast__websocket__stream.secure_prng [*secure_prng]]] [ Set whether the PRNG is cryptographically secure. ] ] [ [[link beast.ref.boost__beast__websocket__stream.set_option [*set_option]]] [ Set the permessage-deflate extension options. ] ] [ [[link beast.ref.boost__beast__websocket__stream.stream [*stream]]] [ Constructor. ] ] [ [[link beast.ref.boost__beast__websocket__stream.text [*text]]] [ Set the text message write option. Returns true if the text message write option is set. ] ] [ [[link beast.ref.boost__beast__websocket__stream.write [*write]]] [ Write a complete message. ] ] [ [[link beast.ref.boost__beast__websocket__stream.write_buffer_bytes [*write_buffer_bytes]]] [ Set the write buffer size option. Returns the size of the write buffer. ] ] [ [[link beast.ref.boost__beast__websocket__stream.write_some [*write_some]]] [ Write some message data. ] ] [ [[link beast.ref.boost__beast__websocket__stream.stream_dtor_ [*~stream]]] [ Destructor. ] ] ] [heading Description]
  5762. The [link beast.ref.boost__beast__websocket__stream `websocket::stream`] class template provides asynchronous and blocking message-oriented functionality necessary for clients and servers to utilize the WebSocket protocol.
  5763. For asynchronous operations, the application must ensure that they are are all performed within the same implicit or explicit strand.
  5764. [heading Thread Safety]
  5765. ['Distinct] ['objects:] Safe. ['Shared] ['objects:] Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
  5766. [heading Example]
  5767. To declare the [link beast.ref.boost__beast__websocket__stream `websocket::stream`] object with a [link beast.ref.boost__beast__tcp_stream `tcp_stream`] in a multi-threaded asynchronous program using a strand, you may write: ``` websocket::stream<tcp_stream> ws{net::io_context::strand(ioc)};
  5768. ``` Alternatively, for a single-threaded or synchronous application you may write: ``` websocket::stream<tcp_stream> ws(ioc);
  5769. ```
  5770. [heading Template Parameters] [table [[Type][Description]] [[`NextLayer`][
  5771. The type representing the next layer, to which data will be read and written during operations. For synchronous operations, the type must support the ['SyncStream] concept. For asynchronous operations, the type must support the ['AsyncStream] concept. ]] [[`deflateSupported`][
  5772. A `bool` indicating whether or not the stream will be capable of negotiating the permessage-deflate websocket extension. Note that even if this is set to `true`, the permessage deflate options (set by the caller at runtime) must still have the feature enabled for a successful negotiation to occur. ]] ]
  5773. [heading Remarks]
  5774. A stream object must not be moved or destroyed while there are pending asynchronous operations associated with it.
  5775. [heading Concepts]
  5776. * ['AsyncStream]
  5777. * ['DynamicBuffer]
  5778. * ['SyncStream]
  5779. [heading See Also]
  5780. * [@https://tools.ietf.org/html/rfc6455#section-4.1 Websocket Opening Handshake Client Requirements (RFC6455)]
  5781. * [@https://tools.ietf.org/html/rfc6455#section-4.2 Websocket Opening Handshake Server Requirements (RFC6455)]
  5782. * [@https://tools.ietf.org/html/rfc6455#section-7.1.2 Websocket Closing Handshake (RFC6455)]
  5783. * [@https://tools.ietf.org/html/rfc6455#section-5.5.1 Websocket Close (RFC6455)]
  5784. * [@https://tools.ietf.org/html/rfc6455#section-5.5.2 WebSocket Ping (RFC6455)]
  5785. * [@https://tools.ietf.org/html/rfc6455#section-5.5.3 WebSocket Pong (RFC6455)]
  5786. * [@https://tools.ietf.org/html/rfc7230#section-5.4 Host field (RFC7230)]
  5787. * [@https://tools.ietf.org/html/rfc7230#section-3.1.1 request-target (RFC7230)]
  5788. * [@https://tools.ietf.org/html/rfc7230#section-5.3.1 origin-form (RFC7230)]
  5789. [section:accept websocket::stream::accept] [indexterm2 accept..websocket::stream]
  5790. Perform the WebSocket handshake in the server role. ``` void ``[link beast.ref.boost__beast__websocket__stream.accept.overload1 accept]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.accept.overload1 more...]]`` ```
  5791. Read and respond to a WebSocket HTTP Upgrade request. ``` void ``[link beast.ref.boost__beast__websocket__stream.accept.overload2 accept]``( error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.accept.overload2 more...]]`` template< class __ConstBufferSequence__> void ``[link beast.ref.boost__beast__websocket__stream.accept.overload3 accept]``( ConstBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.accept.overload3 more...]]`` template< class __ConstBufferSequence__> void ``[link beast.ref.boost__beast__websocket__stream.accept.overload4 accept]``( ConstBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.accept.overload4 more...]]`` ```
  5792. Respond to a WebSocket HTTP Upgrade request. ``` template< class __Body__, class __Allocator__> void ``[link beast.ref.boost__beast__websocket__stream.accept.overload5 accept]``( http::request< Body, http::basic_fields< Allocator >> const& req); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.accept.overload5 more...]]`` template< class __Body__, class __Allocator__> void ``[link beast.ref.boost__beast__websocket__stream.accept.overload6 accept]``( http::request< Body, http::basic_fields< Allocator >> const& req, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.accept.overload6 more...]]`` ``` [section:overload1 websocket::stream::accept (1 of 6 overloads)]
  5793. Perform the WebSocket handshake in the server role. [heading Synopsis] ``` void accept(); ``` [heading Description]
  5794. This function is used to perform the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  5795. The call blocks until one of the following conditions is true:
  5796. * The request is received and the response is sent.
  5797. * An error occurs.
  5798. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  5799. If a valid upgrade request is received, an HTTP response with a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`] is sent to the peer, otherwise a non-successful error is associated with the operation.
  5800. If the request size exceeds the capacity of the stream's internal buffer, the error [link beast.ref.boost__beast__websocket__error `websocket::buffer_overflow`] will be indicated. To handle larger requests, an application should read the HTTP request directly using [link beast.ref.boost__beast__http__read `http::read`] and then pass the request to the appropriate overload of [link beast.ref.boost__beast__websocket__stream.accept `websocket::stream::accept`] or [link beast.ref.boost__beast__websocket__stream.async_accept `websocket::stream::async_accept`]
  5801. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  5802. Thrown on failure. ]] ]
  5803. [heading See Also]
  5804. * [@https://tools.ietf.org/html/rfc6455#section-4.2 Websocket Opening Handshake Server Requirements (RFC6455)]
  5805. [endsect] [section:overload2 websocket::stream::accept (2 of 6 overloads)]
  5806. Read and respond to a WebSocket HTTP Upgrade request. [heading Synopsis] ``` void accept( error_code& ec); ``` [heading Description]
  5807. This function is used to perform the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  5808. The call blocks until one of the following conditions is true:
  5809. * The request is received and the response is sent.
  5810. * An error occurs.
  5811. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  5812. If a valid upgrade request is received, an HTTP response with a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`] is sent to the peer, otherwise a non-successful error is associated with the operation.
  5813. If the request size exceeds the capacity of the stream's internal buffer, the error [link beast.ref.boost__beast__websocket__error `websocket::buffer_overflow`] will be indicated. To handle larger requests, an application should read the HTTP request directly using [link beast.ref.boost__beast__http__read `http::read`] and then pass the request to the appropriate overload of [link beast.ref.boost__beast__websocket__stream.accept `websocket::stream::accept`] or [link beast.ref.boost__beast__websocket__stream.async_accept `websocket::stream::async_accept`]
  5814. [heading Parameters] [table [[Name][Description]] [[`ec`][
  5815. Set to indicate what error occurred, if any. ]] ]
  5816. [heading See Also]
  5817. * [@https://tools.ietf.org/html/rfc6455#section-4.2 Websocket Opening Handshake Server Requirements (RFC6455)]
  5818. [endsect] [section:overload3 websocket::stream::accept (3 of 6 overloads)]
  5819. Read and respond to a WebSocket HTTP Upgrade request. [heading Synopsis] ``` template< class __ConstBufferSequence__> void accept( ConstBufferSequence const& buffers); ``` [heading Description]
  5820. This function is used to perform the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  5821. The call blocks until one of the following conditions is true:
  5822. * The request is received and the response is sent.
  5823. * An error occurs.
  5824. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  5825. If a valid upgrade request is received, an HTTP response with a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`] is sent to the peer, otherwise a non-successful error is associated with the operation.
  5826. If the request size exceeds the capacity of the stream's internal buffer, the error [link beast.ref.boost__beast__websocket__error `websocket::buffer_overflow`] will be indicated. To handle larger requests, an application should read the HTTP request directly using [link beast.ref.boost__beast__http__read `http::read`] and then pass the request to the appropriate overload of [link beast.ref.boost__beast__websocket__stream.accept `websocket::stream::accept`] or [link beast.ref.boost__beast__websocket__stream.async_accept `websocket::stream::async_accept`]
  5827. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  5828. Caller provided data that has already been received on the stream. The implementation will copy the caller provided data before the function returns. ]] ]
  5829. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  5830. Thrown on failure. ]] ]
  5831. [heading See Also]
  5832. * [@https://tools.ietf.org/html/rfc6455#section-4.2 Websocket Opening Handshake Server Requirements (RFC6455)]
  5833. [endsect] [section:overload4 websocket::stream::accept (4 of 6 overloads)]
  5834. Read and respond to a WebSocket HTTP Upgrade request. [heading Synopsis] ``` template< class __ConstBufferSequence__> void accept( ConstBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  5835. This function is used to perform the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  5836. The call blocks until one of the following conditions is true:
  5837. * The request is received and the response is sent.
  5838. * An error occurs.
  5839. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  5840. If a valid upgrade request is received, an HTTP response with a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`] is sent to the peer, otherwise a non-successful error is associated with the operation.
  5841. If the request size exceeds the capacity of the stream's internal buffer, the error [link beast.ref.boost__beast__websocket__error `websocket::buffer_overflow`] will be indicated. To handle larger requests, an application should read the HTTP request directly using [link beast.ref.boost__beast__http__read `http::read`] and then pass the request to the appropriate overload of [link beast.ref.boost__beast__websocket__stream.accept `websocket::stream::accept`] or [link beast.ref.boost__beast__websocket__stream.async_accept `websocket::stream::async_accept`]
  5842. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  5843. Caller provided data that has already been received on the stream. The implementation will copy the caller provided data before the function returns. ]] [[`ec`][
  5844. Set to indicate what error occurred, if any. ]] ]
  5845. [heading See Also]
  5846. * [@https://tools.ietf.org/html/rfc6455#section-4.2 Websocket Opening Handshake Server Requirements (RFC6455)]
  5847. [endsect] [section:overload5 websocket::stream::accept (5 of 6 overloads)]
  5848. Respond to a WebSocket HTTP Upgrade request. [heading Synopsis] ``` template< class __Body__, class __Allocator__> void accept( http::request< Body, http::basic_fields< Allocator >> const& req); ``` [heading Description]
  5849. This function is used to perform the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  5850. The call blocks until one of the following conditions is true:
  5851. * The response is sent.
  5852. * An error occurs.
  5853. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  5854. If a valid upgrade request is received, an HTTP response with a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`] is sent to the peer, otherwise a non-successful error is associated with the operation.
  5855. [heading Parameters] [table [[Name][Description]] [[`req`][
  5856. An object containing the HTTP Upgrade request. Ownership is not transferred, the implementation will not access this object from other threads. ]] ]
  5857. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  5858. Thrown on failure. ]] ]
  5859. [heading See Also]
  5860. * [@https://tools.ietf.org/html/rfc6455#section-4.2 Websocket Opening Handshake Server Requirements (RFC6455)]
  5861. [endsect] [section:overload6 websocket::stream::accept (6 of 6 overloads)]
  5862. Respond to a WebSocket HTTP Upgrade request. [heading Synopsis] ``` template< class __Body__, class __Allocator__> void accept( http::request< Body, http::basic_fields< Allocator >> const& req, error_code& ec); ``` [heading Description]
  5863. This function is used to perform the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  5864. The call blocks until one of the following conditions is true:
  5865. * The response is sent.
  5866. * An error occurs.
  5867. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  5868. If a valid upgrade request is received, an HTTP response with a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`] is sent to the peer, otherwise a non-successful error is associated with the operation.
  5869. [heading Parameters] [table [[Name][Description]] [[`req`][
  5870. An object containing the HTTP Upgrade request. Ownership is not transferred, the implementation will not access this object from other threads. ]] [[`ec`][
  5871. Set to indicate what error occurred, if any. ]] ]
  5872. [heading See Also]
  5873. * [@https://tools.ietf.org/html/rfc6455#section-4.2 Websocket Opening Handshake Server Requirements (RFC6455)]
  5874. [endsect] [endsect] [section:async_accept websocket::stream::async_accept] [indexterm2 async_accept..websocket::stream]
  5875. Perform the WebSocket handshake asynchronously in the server role. ``` template< class AcceptHandler = net::default_completion_token_t<executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__websocket__stream.async_accept.overload1 async_accept]``( AcceptHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.async_accept.overload1 more...]]`` template< class __ConstBufferSequence__, class AcceptHandler = net::default_completion_token_t<executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__websocket__stream.async_accept.overload2 async_accept]``( ConstBufferSequence const& buffers, AcceptHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.async_accept.overload2 more...]]`` template< class __Body__, class __Allocator__, class AcceptHandler = net::default_completion_token_t<executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__websocket__stream.async_accept.overload3 async_accept]``( http::request< Body, http::basic_fields< Allocator >> const& req, AcceptHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.async_accept.overload3 more...]]`` ``` [section:overload1 websocket::stream::async_accept (1 of 3 overloads)]
  5876. Perform the WebSocket handshake asynchronously in the server role. [heading Synopsis] ``` template< class AcceptHandler = net::default_completion_token_t<executor_type>> ``__deduced__`` async_accept( AcceptHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  5877. This initiating function is used to asynchronously begin performing the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  5878. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  5879. * The request is received and the response is sent.
  5880. * An error occurs.
  5881. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_read_some` and `async_write_some` functions. No other operation may be performed on the stream until this operation completes.
  5882. If a valid upgrade request is received, an HTTP response with a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`] is sent to the peer, otherwise a non-successful error is associated with the operation.
  5883. If the request size exceeds the capacity of the stream's internal buffer, the error [link beast.ref.boost__beast__websocket__error `websocket::buffer_overflow`] will be indicated. To handle larger requests, an application should read the HTTP request directly using [link beast.ref.boost__beast__http__async_read `http::async_read`] and then pass the request to the appropriate overload of [link beast.ref.boost__beast__websocket__stream.accept `websocket::stream::accept`] or [link beast.ref.boost__beast__websocket__stream.async_accept `websocket::stream::async_accept`]
  5884. [heading Parameters] [table [[Name][Description]] [[`handler`][
  5885. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  5886. error_code const& ec // Result of operation
  5887. );
  5888. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  5889. [heading See Also]
  5890. * [@https://tools.ietf.org/html/rfc6455#section-4.2 Websocket Opening Handshake Server Requirements (RFC6455)]
  5891. [endsect] [section:overload2 websocket::stream::async_accept (2 of 3 overloads)]
  5892. Perform the WebSocket handshake asynchronously in the server role. [heading Synopsis] ``` template< class __ConstBufferSequence__, class AcceptHandler = net::default_completion_token_t<executor_type>> ``__deduced__`` async_accept( ConstBufferSequence const& buffers, AcceptHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  5893. This initiating function is used to asynchronously begin performing the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  5894. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  5895. * The request is received and the response is sent.
  5896. * An error occurs.
  5897. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_read_some` and `async_write_some` functions. No other operation may be performed on the stream until this operation completes.
  5898. If a valid upgrade request is received, an HTTP response with a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`] is sent to the peer, otherwise a non-successful error is associated with the operation.
  5899. If the request size exceeds the capacity of the stream's internal buffer, the error [link beast.ref.boost__beast__websocket__error `websocket::buffer_overflow`] will be indicated. To handle larger requests, an application should read the HTTP request directly using [link beast.ref.boost__beast__http__async_read `http::async_read`] and then pass the request to the appropriate overload of [link beast.ref.boost__beast__websocket__stream.accept `websocket::stream::accept`] or [link beast.ref.boost__beast__websocket__stream.async_accept `websocket::stream::async_accept`]
  5900. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  5901. Caller provided data that has already been received on the stream. This may be used for implementations allowing multiple protocols on the same stream. The buffered data will first be applied to the handshake, and then to received WebSocket frames. The implementation will copy the caller provided data before the function returns. ]] [[`handler`][
  5902. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  5903. error_code const& ec // Result of operation
  5904. );
  5905. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  5906. [heading See Also]
  5907. * [@https://tools.ietf.org/html/rfc6455#section-4.2 Websocket Opening Handshake Server Requirements (RFC6455)]
  5908. [endsect] [section:overload3 websocket::stream::async_accept (3 of 3 overloads)]
  5909. Perform the WebSocket handshake asynchronously in the server role. [heading Synopsis] ``` template< class __Body__, class __Allocator__, class AcceptHandler = net::default_completion_token_t<executor_type>> ``__deduced__`` async_accept( http::request< Body, http::basic_fields< Allocator >> const& req, AcceptHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  5910. This initiating function is used to asynchronously begin performing the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  5911. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  5912. * The request is received and the response is sent.
  5913. * An error occurs.
  5914. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_read_some` and `async_write_some` functions. No other operation may be performed on the stream until this operation completes.
  5915. If a valid upgrade request is received, an HTTP response with a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`] is sent to the peer, otherwise a non-successful error is associated with the operation.
  5916. [heading Parameters] [table [[Name][Description]] [[`req`][
  5917. An object containing the HTTP Upgrade request. Ownership is not transferred, the implementation will not access this object from other threads. ]] [[`handler`][
  5918. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  5919. error_code const& ec // Result of operation
  5920. );
  5921. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  5922. [heading See Also]
  5923. * [@https://tools.ietf.org/html/rfc6455#section-4.2 Websocket Opening Handshake Server Requirements (RFC6455)]
  5924. [endsect] [endsect] [section:async_close websocket::stream::async_close] [indexterm2 async_close..websocket::stream]
  5925. Send a websocket close control frame asynchronously. [heading Synopsis] ``` template< class CloseHandler = net::default_completion_token_t<executor_type>> ``__deduced__`` async_close( close_reason const& cr, CloseHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  5926. This function is used to asynchronously send a [@https://tools.ietf.org/html/rfc6455#section-5.5.1 close frame], which begins the websocket closing handshake. The session ends when both ends of the connection have sent and received a close frame.
  5927. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  5928. * The close frame finishes sending.
  5929. * An error occurs.
  5930. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_write_some` function. No other operations except for message reading operations should be initiated on the stream after a close operation is started.
  5931. After beginning the closing handshake, the program should not write further message data, pings, or pongs. Instead, the program should continue reading message data until an error occurs. A read returning [link beast.ref.boost__beast__websocket__error `websocket::closed`] indicates a successful connection closure.
  5932. [heading Parameters] [table [[Name][Description]] [[`cr`][
  5933. The reason for the close. If the close reason specifies a close code other than beast::websocket::close\_code::none, the close frame is sent with the close code and optional reason string. Otherwise, the close frame is sent with no payload. ]] [[`handler`][
  5934. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  5935. error_code const& ec // Result of operation
  5936. );
  5937. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  5938. [heading See Also]
  5939. * [@https://tools.ietf.org/html/rfc6455#section-7.1.2 Websocket Closing Handshake (RFC6455)]
  5940. [endsect] [section:async_handshake websocket::stream::async_handshake] [indexterm2 async_handshake..websocket::stream]
  5941. Perform the WebSocket handshake asynchronously in the client role. ``` template< class HandshakeHandler = net::default_completion_token_t<executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__websocket__stream.async_handshake.overload1 async_handshake]``( string_view host, string_view target, HandshakeHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.async_handshake.overload1 more...]]`` template< class HandshakeHandler = net::default_completion_token_t<executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__websocket__stream.async_handshake.overload2 async_handshake]``( response_type& res, string_view host, string_view target, HandshakeHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.async_handshake.overload2 more...]]`` ``` [section:overload1 websocket::stream::async_handshake (1 of 2 overloads)]
  5942. Perform the WebSocket handshake asynchronously in the client role. [heading Synopsis] ``` template< class HandshakeHandler = net::default_completion_token_t<executor_type>> ``__deduced__`` async_handshake( string_view host, string_view target, HandshakeHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  5943. This initiating function is used to asynchronously begin performing the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  5944. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  5945. * The request is sent and the response is received.
  5946. * An error occurs.
  5947. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_read_some` and `async_write_some` functions. No other operation may be performed on the stream until this operation completes.
  5948. The handshake is successful if the received HTTP response indicates the upgrade was accepted by the server, represented by a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`].
  5949. [heading Parameters] [table [[Name][Description]] [[`host`][
  5950. The name of the remote host. This is required by the HTTP protocol to set the "Host" header field. The implementation will not access the string data after the initiating function returns. ]] [[`target`][
  5951. The request-target, in origin-form. The server may use the target to distinguish different services on the same listening port. The implementation will not access the string data after the initiating function returns. ]] [[`handler`][
  5952. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  5953. error_code const& ec // Result of operation
  5954. );
  5955. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  5956. [heading Example]
  5957. ``` ws.async_handshake("localhost", "/",
  5958. [](error_code ec)
  5959. {
  5960. if(ec)
  5961. std::cerr << "Error: " << ec.message() << "\n";
  5962. });
  5963. ```
  5964. [heading See Also]
  5965. * [@https://tools.ietf.org/html/rfc6455#section-4.1 Websocket Opening Handshake Client Requirements (RFC6455)]
  5966. * [@https://tools.ietf.org/html/rfc7230#section-5.4 Host field (RFC7230)]
  5967. * [@https://tools.ietf.org/html/rfc7230#section-3.1.1 request-target (RFC7230)]
  5968. * [@https://tools.ietf.org/html/rfc7230#section-5.3.1 origin-form (RFC7230)]
  5969. [endsect] [section:overload2 websocket::stream::async_handshake (2 of 2 overloads)]
  5970. Perform the WebSocket handshake asynchronously in the client role. [heading Synopsis] ``` template< class HandshakeHandler = net::default_completion_token_t<executor_type>> ``__deduced__`` async_handshake( response_type& res, string_view host, string_view target, HandshakeHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  5971. This initiating function is used to asynchronously begin performing the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  5972. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  5973. * The request is sent and the response is received.
  5974. * An error occurs.
  5975. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_read_some` and `async_write_some` functions. No other operation may be performed on the stream until this operation completes.
  5976. The handshake is successful if the received HTTP response indicates the upgrade was accepted by the server, represented by a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`].
  5977. [heading Parameters] [table [[Name][Description]] [[`res`][
  5978. The HTTP Upgrade response returned by the remote endpoint. The caller may use the response to access any additional information sent by the server. This object will be assigned before the completion handler is invoked. ]] [[`host`][
  5979. The name of the remote host. This is required by the HTTP protocol to set the "Host" header field. The implementation will not access the string data after the initiating function returns. ]] [[`target`][
  5980. The request-target, in origin-form. The server may use the target to distinguish different services on the same listening port. The implementation will not access the string data after the initiating function returns. ]] [[`handler`][
  5981. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  5982. error_code const& ec // Result of operation
  5983. );
  5984. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  5985. [heading Example]
  5986. ``` response_type res;
  5987. ws.async_handshake(res, "localhost", "/",
  5988. [&res](error_code ec)
  5989. {
  5990. if(ec)
  5991. std::cerr << "Error: " << ec.message() << "\n";
  5992. else
  5993. std::cout << res;
  5994. });
  5995. ```
  5996. [heading See Also]
  5997. * [@https://tools.ietf.org/html/rfc6455#section-4.1 Websocket Opening Handshake Client Requirements (RFC6455)]
  5998. * [@https://tools.ietf.org/html/rfc7230#section-5.4 Host field (RFC7230)]
  5999. * [@https://tools.ietf.org/html/rfc7230#section-3.1.1 request-target (RFC7230)]
  6000. * [@https://tools.ietf.org/html/rfc7230#section-5.3.1 origin-form (RFC7230)]
  6001. [endsect] [endsect] [section:async_ping websocket::stream::async_ping] [indexterm2 async_ping..websocket::stream]
  6002. Send a websocket ping control frame asynchronously. [heading Synopsis] ``` template< class __WriteHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_ping( ping_data const& payload, WriteHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  6003. This function is used to asynchronously send a [@https://tools.ietf.org/html/rfc6455#section-5.5.2 ping frame], which usually elicits an automatic pong control frame response from the peer.
  6004. * The ping frame is written.
  6005. * An error occurs.
  6006. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_write_some` function. The program must ensure that no other calls to [link beast.ref.boost__beast__websocket__stream.ping `websocket::stream::ping`], [link beast.ref.boost__beast__websocket__stream.pong `websocket::stream::pong`], [link beast.ref.boost__beast__websocket__stream.async_ping `websocket::stream::async_ping`], or [link beast.ref.boost__beast__websocket__stream.async_pong `websocket::stream::async_pong`] are performed until this operation completes.
  6007. If a close frame is sent or received before the ping frame is sent, the error received by this completion handler will be `net::error::operation_aborted`.
  6008. [heading Parameters] [table [[Name][Description]] [[`payload`][
  6009. The payload of the ping message, which may be empty. The implementation will not access the contents of this object after the initiating function returns. ]] [[`handler`][
  6010. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  6011. error_code const& ec // Result of operation
  6012. );
  6013. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  6014. [endsect] [section:async_pong websocket::stream::async_pong] [indexterm2 async_pong..websocket::stream]
  6015. Send a websocket pong control frame asynchronously. [heading Synopsis] ``` template< class __WriteHandler__ = net::default_completion_token_t<executor_type>> ``__deduced__`` async_pong( ping_data const& payload, WriteHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  6016. This function is used to asynchronously send a [@https://tools.ietf.org/html/rfc6455#section-5.5.3 pong frame], which is usually sent automatically in response to a ping frame from the remote peer.
  6017. * The pong frame is written.
  6018. * An error occurs.
  6019. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_write_some` function. The program must ensure that no other calls to [link beast.ref.boost__beast__websocket__stream.ping `websocket::stream::ping`], [link beast.ref.boost__beast__websocket__stream.pong `websocket::stream::pong`], [link beast.ref.boost__beast__websocket__stream.async_ping `websocket::stream::async_ping`], or [link beast.ref.boost__beast__websocket__stream.async_pong `websocket::stream::async_pong`] are performed until this operation completes.
  6020. If a close frame is sent or received before the pong frame is sent, the error received by this completion handler will be `net::error::operation_aborted`.
  6021. WebSocket allows pong frames to be sent at any time, without first receiving a ping. An unsolicited pong sent in this fashion may indicate to the remote peer that the connection is still active.
  6022. [heading Parameters] [table [[Name][Description]] [[`payload`][
  6023. The payload of the pong message, which may be empty. The implementation will not access the contents of this object after the initiating function returns. ]] [[`handler`][
  6024. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  6025. error_code const& ec // Result of operation
  6026. );
  6027. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  6028. [endsect] [section:async_read websocket::stream::async_read] [indexterm2 async_read..websocket::stream]
  6029. Read a complete message asynchronously. [heading Synopsis] ``` template< class __DynamicBuffer__, class __ReadHandler__ = net::default_completion_token_t< executor_type>> ``__deduced__`` async_read( DynamicBuffer& buffer, ReadHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  6030. This function is used to asynchronously read a complete message.
  6031. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  6032. * A complete message is received.
  6033. * A close frame is received. In this case the error indicated by the function will be [link beast.ref.boost__beast__websocket__error `websocket::closed`].
  6034. * An error occurs.
  6035. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_read_some` and `async_write_some` functions. The program must ensure that no other calls to [link beast.ref.boost__beast__websocket__stream.read `websocket::stream::read`], [link beast.ref.boost__beast__websocket__stream.read_some `websocket::stream::read_some`], [link beast.ref.boost__beast__websocket__stream.async_read `websocket::stream::async_read`], or [link beast.ref.boost__beast__websocket__stream.async_read_some `websocket::stream::async_read_some`] are performed until this operation completes.
  6036. Received message data is appended to the buffer. The functions [link beast.ref.boost__beast__websocket__stream.got_binary `websocket::stream::got_binary`] and [link beast.ref.boost__beast__websocket__stream.got_text `websocket::stream::got_text`] may be used to query the stream and determine the type of the last received message.
  6037. Until the operation completes, the implementation will read incoming control frames and handle them automatically as follows:
  6038. * The [link beast.ref.boost__beast__websocket__stream.control_callback `websocket::stream::control_callback`] will be invoked for each control frame.
  6039. * For each received ping frame, a pong frame will be automatically sent.
  6040. * If a close frame is received, the WebSocket close procedure is performed. In this case, when the function returns, the error [link beast.ref.boost__beast__websocket__error `websocket::closed`] will be indicated.
  6041. Pong frames and close frames sent by the implementation while the read operation is outstanding do not prevent the application from also writing message data, sending pings, sending pongs, or sending close frames.
  6042. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  6043. A dynamic buffer to append message data to. ]] [[`handler`][
  6044. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  6045. error_code const& ec, // Result of operation
  6046. std::size_t bytes_written // Number of bytes appended to buffer
  6047. );
  6048. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  6049. [endsect] [section:async_read_some websocket::stream::async_read_some] [indexterm2 async_read_some..websocket::stream]
  6050. Read some message data asynchronously. ``` template< class __DynamicBuffer__, class __ReadHandler__ = net::default_completion_token_t< executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__websocket__stream.async_read_some.overload1 async_read_some]``( DynamicBuffer& buffer, std::size_t limit, ReadHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.async_read_some.overload1 more...]]`` template< class __MutableBufferSequence__, class __ReadHandler__ = net::default_completion_token_t< executor_type>> ``__deduced__`` ``[link beast.ref.boost__beast__websocket__stream.async_read_some.overload2 async_read_some]``( MutableBufferSequence const& buffers, ReadHandler&& handler = net::default_completion_token_t< executor_type >{}); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.async_read_some.overload2 more...]]`` ``` [section:overload1 websocket::stream::async_read_some (1 of 2 overloads)]
  6051. Read some message data asynchronously. [heading Synopsis] ``` template< class __DynamicBuffer__, class __ReadHandler__ = net::default_completion_token_t< executor_type>> ``__deduced__`` async_read_some( DynamicBuffer& buffer, std::size_t limit, ReadHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  6052. This function is used to asynchronously read some message data.
  6053. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  6054. * Some message data is received.
  6055. * A close frame is received. In this case the error indicated by the function will be [link beast.ref.boost__beast__websocket__error `websocket::closed`].
  6056. * An error occurs.
  6057. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_read_some` and `async_write_some` functions. The program must ensure that no other calls to [link beast.ref.boost__beast__websocket__stream.read `websocket::stream::read`], [link beast.ref.boost__beast__websocket__stream.read_some `websocket::stream::read_some`], [link beast.ref.boost__beast__websocket__stream.async_read `websocket::stream::async_read`], or [link beast.ref.boost__beast__websocket__stream.async_read_some `websocket::stream::async_read_some`] are performed until this operation completes.
  6058. Received message data is appended to the buffer. The functions [link beast.ref.boost__beast__websocket__stream.got_binary `websocket::stream::got_binary`] and [link beast.ref.boost__beast__websocket__stream.got_text `websocket::stream::got_text`] may be used to query the stream and determine the type of the last received message.
  6059. Until the operation completes, the implementation will read incoming control frames and handle them automatically as follows:
  6060. * The [link beast.ref.boost__beast__websocket__stream.control_callback `websocket::stream::control_callback`] will be invoked for each control frame.
  6061. * For each received ping frame, a pong frame will be automatically sent.
  6062. * If a close frame is received, the WebSocket close procedure is performed. In this case, when the function returns, the error [link beast.ref.boost__beast__websocket__error `websocket::closed`] will be indicated.
  6063. Pong frames and close frames sent by the implementation while the read operation is outstanding do not prevent the application from also writing message data, sending pings, sending pongs, or sending close frames.
  6064. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  6065. A dynamic buffer to append message data to. ]] [[`limit`][
  6066. An upper limit on the number of bytes this function will append into the buffer. If this value is zero, then a reasonable size will be chosen automatically. ]] [[`handler`][
  6067. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  6068. error_code const& ec, // Result of operation
  6069. std::size_t bytes_written // Number of bytes appended to buffer
  6070. );
  6071. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  6072. [endsect] [section:overload2 websocket::stream::async_read_some (2 of 2 overloads)]
  6073. Read some message data asynchronously. [heading Synopsis] ``` template< class __MutableBufferSequence__, class __ReadHandler__ = net::default_completion_token_t< executor_type>> ``__deduced__`` async_read_some( MutableBufferSequence const& buffers, ReadHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  6074. This function is used to asynchronously read some message data.
  6075. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  6076. * Some message data is received.
  6077. * A close frame is received. In this case the error indicated by the function will be [link beast.ref.boost__beast__websocket__error `websocket::closed`].
  6078. * An error occurs.
  6079. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_read_some` and `async_write_some` functions. The program must ensure that no other calls to [link beast.ref.boost__beast__websocket__stream.read `websocket::stream::read`], [link beast.ref.boost__beast__websocket__stream.read_some `websocket::stream::read_some`], [link beast.ref.boost__beast__websocket__stream.async_read `websocket::stream::async_read`], or [link beast.ref.boost__beast__websocket__stream.async_read_some `websocket::stream::async_read_some`] are performed until this operation completes.
  6080. Received message data is appended to the buffer. The functions [link beast.ref.boost__beast__websocket__stream.got_binary `websocket::stream::got_binary`] and [link beast.ref.boost__beast__websocket__stream.got_text `websocket::stream::got_text`] may be used to query the stream and determine the type of the last received message.
  6081. Until the operation completes, the implementation will read incoming control frames and handle them automatically as follows:
  6082. * The [link beast.ref.boost__beast__websocket__stream.control_callback `websocket::stream::control_callback`] will be invoked for each control frame.
  6083. * For each received ping frame, a pong frame will be automatically sent.
  6084. * If a close frame is received, the WebSocket close procedure is performed. In this case, when the function returns, the error [link beast.ref.boost__beast__websocket__error `websocket::closed`] will be indicated.
  6085. Pong frames and close frames sent by the implementation while the read operation is outstanding do not prevent the application from also writing message data, sending pings, sending pongs, or sending close frames.
  6086. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  6087. A buffer sequence to write message data into. The previous contents of the buffers will be overwritten, starting from the beginning. The implementation will make copies of this object as needed, but but ownership of the underlying memory is not transferred. The caller is responsible for ensuring that the memory locations pointed to by the buffer sequence remain valid until the completion handler is called. ]] [[`handler`][
  6088. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  6089. error_code const& ec, // Result of operation
  6090. std::size_t bytes_written // Number of bytes written to the buffers
  6091. );
  6092. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  6093. [endsect] [endsect] [section:async_write websocket::stream::async_write] [indexterm2 async_write..websocket::stream]
  6094. Write a complete message asynchronously. [heading Synopsis] ``` template< class __ConstBufferSequence__, class __WriteHandler__ = net::default_completion_token_t< executor_type>> ``__deduced__`` async_write( ConstBufferSequence const& buffers, WriteHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  6095. This function is used to asynchronously write a complete message.
  6096. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  6097. * The complete message is written.
  6098. * An error occurs.
  6099. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_write_some` function. The program must ensure that no other calls to [link beast.ref.boost__beast__websocket__stream.write `websocket::stream::write`], [link beast.ref.boost__beast__websocket__stream.write_some `websocket::stream::write_some`], [link beast.ref.boost__beast__websocket__stream.async_write `websocket::stream::async_write`], or [link beast.ref.boost__beast__websocket__stream.async_write_some `websocket::stream::async_write_some`] are performed until this operation completes.
  6100. The current setting of the [link beast.ref.boost__beast__websocket__stream.binary `websocket::stream::binary`] option controls whether the message opcode is set to text or binary. If the [link beast.ref.boost__beast__websocket__stream.auto_fragment `websocket::stream::auto_fragment`] option is set, the message will be split into one or more frames as necessary. The actual payload contents sent may be transformed as per the WebSocket protocol settings.
  6101. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  6102. A buffer sequence containing the entire message payload. The implementation will make copies of this object as needed, but ownership of the underlying memory is not transferred. The caller is responsible for ensuring that the memory locations pointed to by buffers remains valid until the completion handler is called. ]] [[`handler`][
  6103. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  6104. error_code const& ec, // Result of operation
  6105. std::size_t bytes_transferred // Number of bytes sent from the
  6106. // buffers. If an error occurred,
  6107. // this will be less than the buffer_size.
  6108. );
  6109. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  6110. [endsect] [section:async_write_some websocket::stream::async_write_some] [indexterm2 async_write_some..websocket::stream]
  6111. Write some message data asynchronously. [heading Synopsis] ``` template< class __ConstBufferSequence__, class __WriteHandler__ = net::default_completion_token_t< executor_type>> ``__deduced__`` async_write_some( bool fin, ConstBufferSequence const& buffers, WriteHandler&& handler = net::default_completion_token_t< executor_type >{}); ``` [heading Description]
  6112. This function is used to asynchronously write part of a message.
  6113. This call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  6114. * The message data is written.
  6115. * An error occurs.
  6116. The algorithm, known as a ['composed asynchronous operation], is implemented in terms of calls to the next layer's `async_write_some` function. The program must ensure that no other calls to [link beast.ref.boost__beast__websocket__stream.write `websocket::stream::write`], [link beast.ref.boost__beast__websocket__stream.write_some `websocket::stream::write_some`], [link beast.ref.boost__beast__websocket__stream.async_write `websocket::stream::async_write`], or [link beast.ref.boost__beast__websocket__stream.async_write_some `websocket::stream::async_write_some`] are performed until this operation completes.
  6117. If this is the beginning of a new message, the message opcode will be set to text or binary based on the current setting of the [link beast.ref.boost__beast__websocket__stream.binary `websocket::stream::binary`] (or [link beast.ref.boost__beast__websocket__stream.text `websocket::stream::text`]) option. The actual payload sent may be transformed as per the WebSocket protocol settings.
  6118. [heading Parameters] [table [[Name][Description]] [[`fin`][
  6119. `true` if this is the last part of the message. ]] [[`buffers`][
  6120. The buffers containing the message part to send. The implementation will make copies of this object as needed, but ownership of the underlying memory is not transferred. The caller is responsible for ensuring that the memory locations pointed to by buffers remains valid until the completion handler is called. ]] [[`handler`][
  6121. The completion handler to invoke when the operation completes. The implementation takes ownership of the handler by performing a decay-copy. The equivalent function signature of the handler must be: ``` void handler(
  6122. error_code const& ec, // Result of operation
  6123. std::size_t bytes_transferred // Number of bytes sent from the
  6124. // buffers. If an error occurred,
  6125. // this will be less than the buffer_size.
  6126. );
  6127. ``` Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. ]] ]
  6128. [endsect] [section:auto_fragment websocket::stream::auto_fragment] [indexterm2 auto_fragment..websocket::stream]
  6129. Set the automatic fragmentation option. ``` void ``[link beast.ref.boost__beast__websocket__stream.auto_fragment.overload1 auto_fragment]``( bool value); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.auto_fragment.overload1 more...]]`` ```
  6130. Returns `true` if the automatic fragmentation option is set. ``` bool ``[link beast.ref.boost__beast__websocket__stream.auto_fragment.overload2 auto_fragment]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.auto_fragment.overload2 more...]]`` ``` [section:overload1 websocket::stream::auto_fragment (1 of 2 overloads)]
  6131. Set the automatic fragmentation option. [heading Synopsis] ``` void auto_fragment( bool value); ``` [heading Description]
  6132. Determines if outgoing message payloads are broken up into multiple pieces.
  6133. When the automatic fragmentation size is turned on, outgoing message payloads are broken up into multiple frames no larger than the write buffer size.
  6134. The default setting is to fragment messages.
  6135. [heading Parameters] [table [[Name][Description]] [[`value`][
  6136. A `bool` indicating if auto fragmentation should be on. ]] ]
  6137. [heading Example]
  6138. Setting the automatic fragmentation option: ``` ws.auto_fragment(true);
  6139. ```
  6140. [endsect] [section:overload2 websocket::stream::auto_fragment (2 of 2 overloads)]
  6141. Returns `true` if the automatic fragmentation option is set. [heading Synopsis] ``` bool auto_fragment() const; ``` [heading Description] [endsect] [endsect] [section:binary websocket::stream::binary] [indexterm2 binary..websocket::stream]
  6142. Set the binary message write option. ``` void ``[link beast.ref.boost__beast__websocket__stream.binary.overload1 binary]``( bool value); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.binary.overload1 more...]]`` ```
  6143. Returns `true` if the binary message write option is set. ``` bool ``[link beast.ref.boost__beast__websocket__stream.binary.overload2 binary]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.binary.overload2 more...]]`` ``` [section:overload1 websocket::stream::binary (1 of 2 overloads)]
  6144. Set the binary message write option. [heading Synopsis] ``` void binary( bool value); ``` [heading Description]
  6145. This controls whether or not outgoing message opcodes are set to binary or text. The setting is only applied at the start when a caller begins a new message. Changing the opcode after a message is started will only take effect after the current message being sent is complete.
  6146. The default setting is to send text messages.
  6147. [heading Parameters] [table [[Name][Description]] [[`value`][
  6148. `true` if outgoing messages should indicate binary, or `false` if they should indicate text. ]] ]
  6149. [heading Example]
  6150. Setting the message type to binary. ``` ws.binary(true);
  6151. ```
  6152. [endsect] [section:overload2 websocket::stream::binary (2 of 2 overloads)]
  6153. Returns `true` if the binary message write option is set. [heading Synopsis] ``` bool binary() const; ``` [heading Description] [endsect] [endsect] [section:close websocket::stream::close] [indexterm2 close..websocket::stream]
  6154. Send a websocket close control frame. ``` void ``[link beast.ref.boost__beast__websocket__stream.close.overload1 close]``( close_reason const& cr); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.close.overload1 more...]]`` void ``[link beast.ref.boost__beast__websocket__stream.close.overload2 close]``( close_reason const& cr, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.close.overload2 more...]]`` ``` [section:overload1 websocket::stream::close (1 of 2 overloads)]
  6155. Send a websocket close control frame. [heading Synopsis] ``` void close( close_reason const& cr); ``` [heading Description]
  6156. This function is used to send a [@https://tools.ietf.org/html/rfc6455#section-5.5.1 close frame], which begins the websocket closing handshake. The session ends when both ends of the connection have sent and received a close frame.
  6157. The call blocks until one of the following conditions is true:
  6158. * The close frame is written.
  6159. * An error occurs.
  6160. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `write_some` function.
  6161. After beginning the closing handshake, the program should not write further message data, pings, or pongs. Instead, the program should continue reading message data until an error occurs. A read returning [link beast.ref.boost__beast__websocket__error `websocket::closed`] indicates a successful connection closure.
  6162. [heading Parameters] [table [[Name][Description]] [[`cr`][
  6163. The reason for the close. If the close reason specifies a close code other than beast::websocket::close\_code::none, the close frame is sent with the close code and optional reason string. Otherwise, the close frame is sent with no payload. ]] ]
  6164. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  6165. Thrown on failure. ]] ]
  6166. [heading See Also]
  6167. * [@https://tools.ietf.org/html/rfc6455#section-7.1.2 Websocket Closing Handshake (RFC6455)]
  6168. [endsect] [section:overload2 websocket::stream::close (2 of 2 overloads)]
  6169. Send a websocket close control frame. [heading Synopsis] ``` void close( close_reason const& cr, error_code& ec); ``` [heading Description]
  6170. This function is used to send a [@https://tools.ietf.org/html/rfc6455#section-5.5.1 close frame], which begins the websocket closing handshake. The session ends when both ends of the connection have sent and received a close frame.
  6171. The call blocks until one of the following conditions is true:
  6172. * The close frame is written.
  6173. * An error occurs.
  6174. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `write_some` function.
  6175. After beginning the closing handshake, the program should not write further message data, pings, or pongs. Instead, the program should continue reading message data until an error occurs. A read returning [link beast.ref.boost__beast__websocket__error `websocket::closed`] indicates a successful connection closure.
  6176. [heading Parameters] [table [[Name][Description]] [[`cr`][
  6177. The reason for the close. If the close reason specifies a close code other than beast::websocket::close\_code::none, the close frame is sent with the close code and optional reason string. Otherwise, the close frame is sent with no payload. ]] [[`ec`][
  6178. Set to indicate what error occurred, if any. ]] ]
  6179. [heading See Also]
  6180. * [@https://tools.ietf.org/html/rfc6455#section-7.1.2 Websocket Closing Handshake (RFC6455)]
  6181. [endsect] [endsect] [section:control_callback websocket::stream::control_callback] [indexterm2 control_callback..websocket::stream]
  6182. Set a callback to be invoked on each incoming control frame. ``` void ``[link beast.ref.boost__beast__websocket__stream.control_callback.overload1 control_callback]``( std::function< void(frame_type, string_view)> cb); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.control_callback.overload1 more...]]`` ```
  6183. Reset the control frame callback. ``` void ``[link beast.ref.boost__beast__websocket__stream.control_callback.overload2 control_callback]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.control_callback.overload2 more...]]`` ``` [section:overload1 websocket::stream::control_callback (1 of 2 overloads)]
  6184. Set a callback to be invoked on each incoming control frame. [heading Synopsis] ``` void control_callback( std::function< void(frame_type, string_view)> cb); ``` [heading Description]
  6185. Sets the callback to be invoked whenever a ping, pong, or close control frame is received during a call to one of the following functions:
  6186. * [link beast.ref.boost__beast__websocket__stream.read `websocket::stream::read`]
  6187. * [link beast.ref.boost__beast__websocket__stream.read_some `websocket::stream::read_some`]
  6188. * [link beast.ref.boost__beast__websocket__stream.async_read `websocket::stream::async_read`]
  6189. * [link beast.ref.boost__beast__websocket__stream.async_read_some `websocket::stream::async_read_some`]
  6190. Unlike completion handlers, the callback will be invoked for each control frame during a call to any synchronous or asynchronous read function. The operation is passive, with no associated error code, and triggered by reads.
  6191. For close frames, the close reason code may be obtained by calling the function [link beast.ref.boost__beast__websocket__stream.reason `websocket::stream::reason`].
  6192. [heading Parameters] [table [[Name][Description]] [[`cb`][
  6193. The function object to call, which must be invocable with this equivalent signature: ``` void
  6194. callback(
  6195. frame_type kind, // The type of frame
  6196. string_view payload // The payload in the frame
  6197. );
  6198. ``` The implementation type-erases the callback which may require a dynamic allocation. To prevent the possibility of a dynamic allocation, use `std::ref` to wrap the callback. If the read operation which receives the control frame is an asynchronous operation, the callback will be invoked using the same method as that used to invoke the final handler. ]] ]
  6199. [heading Remarks]
  6200. Incoming ping and close frames are automatically handled. Pings are responded to with pongs, and a close frame is responded to with a close frame leading to the closure of the stream. It is not necessary to manually send pings, pongs, or close frames from inside the control callback. Attempting to manually send a close frame from inside the control callback after receiving a close frame will result in undefined behavior.
  6201. [endsect] [section:overload2 websocket::stream::control_callback (2 of 2 overloads)]
  6202. Reset the control frame callback. [heading Synopsis] ``` void control_callback(); ``` [heading Description]
  6203. This function removes any previously set control frame callback. [endsect] [endsect] [section:executor_type websocket::stream::executor_type] [indexterm2 executor_type..websocket::stream]
  6204. The type of the executor associated with the object. [heading Synopsis] ``` using executor_type = beast::executor_type< next_layer_type >; ``` [heading Description] [endsect] [section:get_executor websocket::stream::get_executor] [indexterm2 get_executor..websocket::stream]
  6205. Get the executor associated with the object. [heading Synopsis] ``` executor_type get_executor(); ``` [heading Description]
  6206. This function may be used to obtain the executor object that the stream uses to dispatch handlers for asynchronous operations.
  6207. [heading Return Value]
  6208. A copy of the executor that stream will use to dispatch handlers.
  6209. [endsect] [section:get_option websocket::stream::get_option] [indexterm2 get_option..websocket::stream] ``` template< class Option> void ``[link beast.ref.boost__beast__websocket__stream.get_option.overload1 get_option]``( Option& opt); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.get_option.overload1 more...]]`` ```
  6210. Get the permessage-deflate extension options. ``` void ``[link beast.ref.boost__beast__websocket__stream.get_option.overload2 get_option]``( permessage_deflate& o); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.get_option.overload2 more...]]`` ``` [section:overload1 websocket::stream::get_option (1 of 2 overloads)] [heading Synopsis] ``` template< class Option> void get_option( Option& opt); ``` [heading Description] [endsect] [section:overload2 websocket::stream::get_option (2 of 2 overloads)]
  6211. Get the permessage-deflate extension options. [heading Synopsis] ``` void get_option( permessage_deflate& o); ``` [heading Description] [endsect] [endsect] [section:got_binary websocket::stream::got_binary] [indexterm2 got_binary..websocket::stream]
  6212. Returns `true` if the latest message data indicates binary. [heading Synopsis] ``` bool got_binary() const; ``` [heading Description]
  6213. This function informs the caller of whether the last received message frame represents a message with the binary opcode.
  6214. If there is no last message frame, the return value is undefined. [endsect] [section:got_text websocket::stream::got_text] [indexterm2 got_text..websocket::stream]
  6215. Returns `true` if the latest message data indicates text. [heading Synopsis] ``` bool got_text() const; ``` [heading Description]
  6216. This function informs the caller of whether the last received message frame represents a message with the text opcode.
  6217. If there is no last message frame, the return value is undefined. [endsect] [section:handshake websocket::stream::handshake] [indexterm2 handshake..websocket::stream]
  6218. Perform the WebSocket handshake in the client role. ``` void ``[link beast.ref.boost__beast__websocket__stream.handshake.overload1 handshake]``( string_view host, string_view target); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.handshake.overload1 more...]]`` void ``[link beast.ref.boost__beast__websocket__stream.handshake.overload2 handshake]``( response_type& res, string_view host, string_view target); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.handshake.overload2 more...]]`` void ``[link beast.ref.boost__beast__websocket__stream.handshake.overload3 handshake]``( string_view host, string_view target, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.handshake.overload3 more...]]`` void ``[link beast.ref.boost__beast__websocket__stream.handshake.overload4 handshake]``( response_type& res, string_view host, string_view target, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.handshake.overload4 more...]]`` ``` [section:overload1 websocket::stream::handshake (1 of 4 overloads)]
  6219. Perform the WebSocket handshake in the client role. [heading Synopsis] ``` void handshake( string_view host, string_view target); ``` [heading Description]
  6220. This function is used to perform the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  6221. The call blocks until one of the following conditions is true:
  6222. * The request is sent and the response is received.
  6223. * An error occurs.
  6224. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  6225. The handshake is successful if the received HTTP response indicates the upgrade was accepted by the server, represented by a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`].
  6226. [heading Parameters] [table [[Name][Description]] [[`host`][
  6227. The name of the remote host. This is required by the HTTP protocol to set the "Host" header field. ]] [[`target`][
  6228. The request-target, in origin-form. The server may use the target to distinguish different services on the same listening port. ]] ]
  6229. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  6230. Thrown on failure. ]] ]
  6231. [heading Example]
  6232. ``` ws.handshake("localhost", "/");
  6233. ```
  6234. [heading See Also]
  6235. * [@https://tools.ietf.org/html/rfc6455#section-4.1 Websocket Opening Handshake Client Requirements (RFC6455)]
  6236. * [@https://tools.ietf.org/html/rfc7230#section-5.4 Host field (RFC7230)]
  6237. * [@https://tools.ietf.org/html/rfc7230#section-3.1.1 request-target (RFC7230)]
  6238. * [@https://tools.ietf.org/html/rfc7230#section-5.3.1 origin-form (RFC7230)]
  6239. [endsect] [section:overload2 websocket::stream::handshake (2 of 4 overloads)]
  6240. Perform the WebSocket handshake in the client role. [heading Synopsis] ``` void handshake( response_type& res, string_view host, string_view target); ``` [heading Description]
  6241. This function is used to perform the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  6242. The call blocks until one of the following conditions is true:
  6243. * The request is sent and the response is received.
  6244. * An error occurs.
  6245. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  6246. The handshake is successful if the received HTTP response indicates the upgrade was accepted by the server, represented by a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`].
  6247. [heading Parameters] [table [[Name][Description]] [[`res`][
  6248. The HTTP Upgrade response returned by the remote endpoint. The caller may use the response to access any additional information sent by the server. ]] [[`host`][
  6249. The name of the remote host. This is required by the HTTP protocol to set the "Host" header field. ]] [[`target`][
  6250. The request-target, in origin-form. The server may use the target to distinguish different services on the same listening port. ]] ]
  6251. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  6252. Thrown on failure. ]] ]
  6253. [heading Example]
  6254. ``` response_type res;
  6255. ws.handshake(res, "localhost", "/");
  6256. std::cout << res;
  6257. ```
  6258. [heading See Also]
  6259. * [@https://tools.ietf.org/html/rfc6455#section-4.1 Websocket Opening Handshake Client Requirements (RFC6455)]
  6260. * [@https://tools.ietf.org/html/rfc7230#section-5.4 Host field (RFC7230)]
  6261. * [@https://tools.ietf.org/html/rfc7230#section-3.1.1 request-target (RFC7230)]
  6262. * [@https://tools.ietf.org/html/rfc7230#section-5.3.1 origin-form (RFC7230)]
  6263. [endsect] [section:overload3 websocket::stream::handshake (3 of 4 overloads)]
  6264. Perform the WebSocket handshake in the client role. [heading Synopsis] ``` void handshake( string_view host, string_view target, error_code& ec); ``` [heading Description]
  6265. This function is used to perform the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  6266. The call blocks until one of the following conditions is true:
  6267. * The request is sent and the response is received.
  6268. * An error occurs.
  6269. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  6270. The handshake is successful if the received HTTP response indicates the upgrade was accepted by the server, represented by a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`].
  6271. [heading Parameters] [table [[Name][Description]] [[`host`][
  6272. The name of the remote host. This is required by the HTTP protocol to set the "Host" header field. ]] [[`target`][
  6273. The request-target, in origin-form. The server may use the target to distinguish different services on the same listening port. ]] [[`ec`][
  6274. Set to indicate what error occurred, if any. ]] ]
  6275. [heading Example]
  6276. ``` error_code ec;
  6277. ws.handshake("localhost", "/", ec);
  6278. ```
  6279. [heading See Also]
  6280. * [@https://tools.ietf.org/html/rfc6455#section-4.1 Websocket Opening Handshake Client Requirements (RFC6455)]
  6281. * [@https://tools.ietf.org/html/rfc7230#section-5.4 Host field (RFC7230)]
  6282. * [@https://tools.ietf.org/html/rfc7230#section-3.1.1 request-target (RFC7230)]
  6283. * [@https://tools.ietf.org/html/rfc7230#section-5.3.1 origin-form (RFC7230)]
  6284. [endsect] [section:overload4 websocket::stream::handshake (4 of 4 overloads)]
  6285. Perform the WebSocket handshake in the client role. [heading Synopsis] ``` void handshake( response_type& res, string_view host, string_view target, error_code& ec); ``` [heading Description]
  6286. This function is used to perform the [@https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake WebSocket handshake], required before messages can be sent and received. During the handshake, the client sends the Websocket Upgrade HTTP request, and the server replies with an HTTP response indicating the result of the handshake.
  6287. The call blocks until one of the following conditions is true:
  6288. * The request is sent and the response is received.
  6289. * An error occurs.
  6290. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  6291. The handshake is successful if the received HTTP response indicates the upgrade was accepted by the server, represented by a [@https://tools.ietf.org/html/rfc7230#section-3.1.2 status-code] of [link beast.ref.boost__beast__http__status `http::switching_protocols`].
  6292. [heading Parameters] [table [[Name][Description]] [[`res`][
  6293. The HTTP Upgrade response returned by the remote endpoint. The caller may use the response to access any additional information sent by the server. ]] [[`host`][
  6294. The name of the remote host. This is required by the HTTP protocol to set the "Host" header field. ]] [[`target`][
  6295. The request-target, in origin-form. The server may use the target to distinguish different services on the same listening port. ]] [[`ec`][
  6296. Set to indicate what error occurred, if any. ]] ]
  6297. [heading Example]
  6298. ``` error_code ec;
  6299. response_type res;
  6300. ws.handshake(res, "localhost", "/", ec);
  6301. if(! ec)
  6302. std::cout << res;
  6303. ```
  6304. [heading See Also]
  6305. * [@https://tools.ietf.org/html/rfc6455#section-4.1 Websocket Opening Handshake Client Requirements (RFC6455)]
  6306. * [@https://tools.ietf.org/html/rfc7230#section-5.4 Host field (RFC7230)]
  6307. * [@https://tools.ietf.org/html/rfc7230#section-3.1.1 request-target (RFC7230)]
  6308. * [@https://tools.ietf.org/html/rfc7230#section-5.3.1 origin-form (RFC7230)]
  6309. [endsect] [endsect] [section:is_deflate_supported websocket::stream::is_deflate_supported] [indexterm2 is_deflate_supported..websocket::stream]
  6310. Indicates if the permessage-deflate extension is supported. [heading Synopsis] ``` using is_deflate_supported = std::integral_constant< bool, deflateSupported >; ``` [heading Description] [endsect] [section:is_message_done websocket::stream::is_message_done] [indexterm2 is_message_done..websocket::stream]
  6311. Returns `true` if the last completed read finished the current message. [heading Synopsis] ``` bool is_message_done() const; ``` [heading Description] [endsect] [section:is_open websocket::stream::is_open] [indexterm2 is_open..websocket::stream]
  6312. Returns `true` if the stream is open. [heading Synopsis] ``` bool is_open() const; ``` [heading Description]
  6313. The stream is open after a successful handshake, and when no error has occurred. [endsect] [section:next_layer websocket::stream::next_layer] [indexterm2 next_layer..websocket::stream]
  6314. Get a reference to the next layer. ``` next_layer_type& ``[link beast.ref.boost__beast__websocket__stream.next_layer.overload1 next_layer]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.next_layer.overload1 more...]]`` next_layer_type const & ``[link beast.ref.boost__beast__websocket__stream.next_layer.overload2 next_layer]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.next_layer.overload2 more...]]`` ``` [section:overload1 websocket::stream::next_layer (1 of 2 overloads)]
  6315. Get a reference to the next layer. [heading Synopsis] ``` next_layer_type& next_layer(); ``` [heading Description]
  6316. This function returns a reference to the next layer in a stack of stream layers.
  6317. [heading Return Value]
  6318. A reference to the next layer in the stack of stream layers.
  6319. [endsect] [section:overload2 websocket::stream::next_layer (2 of 2 overloads)]
  6320. Get a reference to the next layer. [heading Synopsis] ``` next_layer_type const & next_layer() const; ``` [heading Description]
  6321. This function returns a reference to the next layer in a stack of stream layers.
  6322. [heading Return Value]
  6323. A reference to the next layer in the stack of stream layers.
  6324. [endsect] [endsect] [section:next_layer_type websocket::stream::next_layer_type] [indexterm2 next_layer_type..websocket::stream]
  6325. The type of the next layer. [heading Synopsis] ``` using next_layer_type = typename std::remove_reference< NextLayer >::type; ``` [heading Description] [endsect] [section:operator_eq_ websocket::stream::operator=] [indexterm2 operator=..websocket::stream]
  6326. Move assignment (deleted) [heading Synopsis] ``` stream& operator=( stream&&); ``` [heading Description] [endsect] [section:ping websocket::stream::ping] [indexterm2 ping..websocket::stream]
  6327. Send a websocket ping control frame. ``` void ``[link beast.ref.boost__beast__websocket__stream.ping.overload1 ping]``( ping_data const& payload); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.ping.overload1 more...]]`` void ``[link beast.ref.boost__beast__websocket__stream.ping.overload2 ping]``( ping_data const& payload, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.ping.overload2 more...]]`` ``` [section:overload1 websocket::stream::ping (1 of 2 overloads)]
  6328. Send a websocket ping control frame. [heading Synopsis] ``` void ping( ping_data const& payload); ``` [heading Description]
  6329. This function is used to send a [@https://tools.ietf.org/html/rfc6455#section-5.5.2 ping frame], which usually elicits an automatic pong control frame response from the peer.
  6330. The call blocks until one of the following conditions is true:
  6331. * The ping frame is written.
  6332. * An error occurs.
  6333. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `write_some` function.
  6334. [heading Parameters] [table [[Name][Description]] [[`payload`][
  6335. The payload of the ping message, which may be empty. ]] ]
  6336. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  6337. Thrown on failure. ]] ]
  6338. [endsect] [section:overload2 websocket::stream::ping (2 of 2 overloads)]
  6339. Send a websocket ping control frame. [heading Synopsis] ``` void ping( ping_data const& payload, error_code& ec); ``` [heading Description]
  6340. This function is used to send a [@https://tools.ietf.org/html/rfc6455#section-5.5.2 ping frame], which usually elicits an automatic pong control frame response from the peer.
  6341. The call blocks until one of the following conditions is true:
  6342. * The ping frame is written.
  6343. * An error occurs.
  6344. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `write_some` function.
  6345. [heading Parameters] [table [[Name][Description]] [[`payload`][
  6346. The payload of the ping message, which may be empty. ]] [[`ec`][
  6347. Set to indicate what error occurred, if any. ]] ]
  6348. [endsect] [endsect] [section:pong websocket::stream::pong] [indexterm2 pong..websocket::stream]
  6349. Send a websocket pong control frame. ``` void ``[link beast.ref.boost__beast__websocket__stream.pong.overload1 pong]``( ping_data const& payload); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.pong.overload1 more...]]`` void ``[link beast.ref.boost__beast__websocket__stream.pong.overload2 pong]``( ping_data const& payload, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.pong.overload2 more...]]`` ``` [section:overload1 websocket::stream::pong (1 of 2 overloads)]
  6350. Send a websocket pong control frame. [heading Synopsis] ``` void pong( ping_data const& payload); ``` [heading Description]
  6351. This function is used to send a [@https://tools.ietf.org/html/rfc6455#section-5.5.3 pong frame], which is usually sent automatically in response to a ping frame from the remote peer.
  6352. The call blocks until one of the following conditions is true:
  6353. * The pong frame is written.
  6354. * An error occurs.
  6355. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `write_some` function.
  6356. WebSocket allows pong frames to be sent at any time, without first receiving a ping. An unsolicited pong sent in this fashion may indicate to the remote peer that the connection is still active.
  6357. [heading Parameters] [table [[Name][Description]] [[`payload`][
  6358. The payload of the pong message, which may be empty. ]] ]
  6359. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  6360. Thrown on failure. ]] ]
  6361. [endsect] [section:overload2 websocket::stream::pong (2 of 2 overloads)]
  6362. Send a websocket pong control frame. [heading Synopsis] ``` void pong( ping_data const& payload, error_code& ec); ``` [heading Description]
  6363. This function is used to send a [@https://tools.ietf.org/html/rfc6455#section-5.5.3 pong frame], which is usually sent automatically in response to a ping frame from the remote peer.
  6364. The call blocks until one of the following conditions is true:
  6365. * The pong frame is written.
  6366. * An error occurs.
  6367. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `write_some` function.
  6368. WebSocket allows pong frames to be sent at any time, without first receiving a ping. An unsolicited pong sent in this fashion may indicate to the remote peer that the connection is still active.
  6369. [heading Parameters] [table [[Name][Description]] [[`payload`][
  6370. The payload of the pong message, which may be empty. ]] [[`ec`][
  6371. Set to indicate what error occurred, if any. ]] ]
  6372. [endsect] [endsect] [section:read websocket::stream::read] [indexterm2 read..websocket::stream]
  6373. Read a complete message. ``` template< class __DynamicBuffer__> std::size_t ``[link beast.ref.boost__beast__websocket__stream.read.overload1 read]``( DynamicBuffer& buffer); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.read.overload1 more...]]`` template< class __DynamicBuffer__> std::size_t ``[link beast.ref.boost__beast__websocket__stream.read.overload2 read]``( DynamicBuffer& buffer, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.read.overload2 more...]]`` ``` [section:overload1 websocket::stream::read (1 of 2 overloads)]
  6374. Read a complete message. [heading Synopsis] ``` template< class __DynamicBuffer__> std::size_t read( DynamicBuffer& buffer); ``` [heading Description]
  6375. This function is used to read a complete message.
  6376. The call blocks until one of the following is true:
  6377. * A complete message is received.
  6378. * A close frame is received. In this case the error indicated by the function will be [link beast.ref.boost__beast__websocket__error `websocket::closed`].
  6379. * An error occurs.
  6380. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  6381. Received message data is appended to the buffer. The functions [link beast.ref.boost__beast__websocket__stream.got_binary `websocket::stream::got_binary`] and [link beast.ref.boost__beast__websocket__stream.got_text `websocket::stream::got_text`] may be used to query the stream and determine the type of the last received message.
  6382. Until the call returns, the implementation will read incoming control frames and handle them automatically as follows:
  6383. * The [link beast.ref.boost__beast__websocket__stream.control_callback `websocket::stream::control_callback`] will be invoked for each control frame.
  6384. * For each received ping frame, a pong frame will be automatically sent.
  6385. * If a close frame is received, the WebSocket closing handshake is performed. In this case, when the function returns, the error [link beast.ref.boost__beast__websocket__error `websocket::closed`] will be indicated.
  6386. [heading Return Value]
  6387. The number of message payload bytes appended to the buffer.
  6388. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  6389. A dynamic buffer to append message data to. ]] ]
  6390. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  6391. Thrown on failure. ]] ]
  6392. [endsect] [section:overload2 websocket::stream::read (2 of 2 overloads)]
  6393. Read a complete message. [heading Synopsis] ``` template< class __DynamicBuffer__> std::size_t read( DynamicBuffer& buffer, error_code& ec); ``` [heading Description]
  6394. This function is used to read a complete message.
  6395. The call blocks until one of the following is true:
  6396. * A complete message is received.
  6397. * A close frame is received. In this case the error indicated by the function will be [link beast.ref.boost__beast__websocket__error `websocket::closed`].
  6398. * An error occurs.
  6399. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  6400. Received message data is appended to the buffer. The functions [link beast.ref.boost__beast__websocket__stream.got_binary `websocket::stream::got_binary`] and [link beast.ref.boost__beast__websocket__stream.got_text `websocket::stream::got_text`] may be used to query the stream and determine the type of the last received message.
  6401. Until the call returns, the implementation will read incoming control frames and handle them automatically as follows:
  6402. * The [link beast.ref.boost__beast__websocket__stream.control_callback `websocket::stream::control_callback`] will be invoked for each control frame.
  6403. * For each received ping frame, a pong frame will be automatically sent.
  6404. * If a close frame is received, the WebSocket closing handshake is performed. In this case, when the function returns, the error [link beast.ref.boost__beast__websocket__error `websocket::closed`] will be indicated.
  6405. [heading Return Value]
  6406. The number of message payload bytes appended to the buffer.
  6407. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  6408. A dynamic buffer to append message data to. ]] [[`ec`][
  6409. Set to indicate what error occurred, if any. ]] ]
  6410. [endsect] [endsect] [section:read_message_max websocket::stream::read_message_max] [indexterm2 read_message_max..websocket::stream]
  6411. Set the maximum incoming message size option. ``` void ``[link beast.ref.boost__beast__websocket__stream.read_message_max.overload1 read_message_max]``( std::size_t amount); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.read_message_max.overload1 more...]]`` ```
  6412. Returns the maximum incoming message size setting. ``` std::size_t ``[link beast.ref.boost__beast__websocket__stream.read_message_max.overload2 read_message_max]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.read_message_max.overload2 more...]]`` ``` [section:overload1 websocket::stream::read_message_max (1 of 2 overloads)]
  6413. Set the maximum incoming message size option. [heading Synopsis] ``` void read_message_max( std::size_t amount); ``` [heading Description]
  6414. Sets the largest permissible incoming message size. Message frame fields indicating a size that would bring the total message size over this limit will cause a protocol failure.
  6415. The default setting is 16 megabytes. A value of zero indicates a limit of the maximum value of a `std::uint64_t`.
  6416. [heading Example]
  6417. Setting the maximum read message size. ``` ws.read_message_max(65536);
  6418. ```
  6419. [heading Parameters] [table [[Name][Description]] [[`amount`][
  6420. The limit on the size of incoming messages. ]] ]
  6421. [endsect] [section:overload2 websocket::stream::read_message_max (2 of 2 overloads)]
  6422. Returns the maximum incoming message size setting. [heading Synopsis] ``` std::size_t read_message_max() const; ``` [heading Description] [endsect] [endsect] [section:read_size_hint websocket::stream::read_size_hint] [indexterm2 read_size_hint..websocket::stream]
  6423. Returns a suggested maximum buffer size for the next call to read. ``` std::size_t ``[link beast.ref.boost__beast__websocket__stream.read_size_hint.overload1 read_size_hint]``( std::size_t initial_size = +tcp_frame_size) const; ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.read_size_hint.overload1 more...]]`` template< class __DynamicBuffer__> std::size_t ``[link beast.ref.boost__beast__websocket__stream.read_size_hint.overload2 read_size_hint]``( DynamicBuffer& buffer) const; ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.read_size_hint.overload2 more...]]`` ``` [section:overload1 websocket::stream::read_size_hint (1 of 2 overloads)]
  6424. Returns a suggested maximum buffer size for the next call to read. [heading Synopsis] ``` std::size_t read_size_hint( std::size_t initial_size = +tcp_frame_size) const; ``` [heading Description]
  6425. This function returns a reasonable upper limit on the number of bytes for the size of the buffer passed in the next call to read. The number is determined by the state of the current frame and whether or not the permessage-deflate extension is enabled.
  6426. [heading Parameters] [table [[Name][Description]] [[`initial_size`][
  6427. A non-zero size representing the caller's desired buffer size for when there is no information which may be used to calculate a more specific value. For example, when reading the first frame header of a message. ]] ]
  6428. [endsect] [section:overload2 websocket::stream::read_size_hint (2 of 2 overloads)]
  6429. Returns a suggested maximum buffer size for the next call to read. [heading Synopsis] ``` template< class __DynamicBuffer__> std::size_t read_size_hint( DynamicBuffer& buffer) const; ``` [heading Description]
  6430. This function returns a reasonable upper limit on the number of bytes for the size of the buffer passed in the next call to read. The number is determined by the state of the current frame and whether or not the permessage-deflate extension is enabled.
  6431. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  6432. The buffer which will be used for reading. The implementation will query the buffer to obtain the optimum size of a subsequent call to `buffer.prepare` based on the state of the current frame, if any. ]] ]
  6433. [endsect] [endsect] [section:read_some websocket::stream::read_some] [indexterm2 read_some..websocket::stream]
  6434. Read some message data. ``` template< class __DynamicBuffer__> std::size_t ``[link beast.ref.boost__beast__websocket__stream.read_some.overload1 read_some]``( DynamicBuffer& buffer, std::size_t limit); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.read_some.overload1 more...]]`` template< class __DynamicBuffer__> std::size_t ``[link beast.ref.boost__beast__websocket__stream.read_some.overload2 read_some]``( DynamicBuffer& buffer, std::size_t limit, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.read_some.overload2 more...]]`` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__websocket__stream.read_some.overload3 read_some]``( MutableBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.read_some.overload3 more...]]`` template< class __MutableBufferSequence__> std::size_t ``[link beast.ref.boost__beast__websocket__stream.read_some.overload4 read_some]``( MutableBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.read_some.overload4 more...]]`` ``` [section:overload1 websocket::stream::read_some (1 of 4 overloads)]
  6435. Read some message data. [heading Synopsis] ``` template< class __DynamicBuffer__> std::size_t read_some( DynamicBuffer& buffer, std::size_t limit); ``` [heading Description]
  6436. This function is used to read some message data.
  6437. The call blocks until one of the following is true:
  6438. * Some message data is received.
  6439. * A close frame is received. In this case the error indicated by the function will be [link beast.ref.boost__beast__websocket__error `websocket::closed`].
  6440. * An error occurs.
  6441. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  6442. Received message data is appended to the buffer. The functions [link beast.ref.boost__beast__websocket__stream.got_binary `websocket::stream::got_binary`] and [link beast.ref.boost__beast__websocket__stream.got_text `websocket::stream::got_text`] may be used to query the stream and determine the type of the last received message. The function [link beast.ref.boost__beast__websocket__stream.is_message_done `websocket::stream::is_message_done`] may be called to determine if the message received by the last read operation is complete.
  6443. Until the call returns, the implementation will read incoming control frames and handle them automatically as follows:
  6444. * The [link beast.ref.boost__beast__websocket__stream.control_callback `websocket::stream::control_callback`] will be invoked for each control frame.
  6445. * For each received ping frame, a pong frame will be automatically sent.
  6446. * If a close frame is received, the WebSocket closing handshake is performed. In this case, when the function returns, the error [link beast.ref.boost__beast__websocket__error `websocket::closed`] will be indicated.
  6447. [heading Return Value]
  6448. The number of message payload bytes appended to the buffer.
  6449. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  6450. A dynamic buffer to append message data to. ]] [[`limit`][
  6451. An upper limit on the number of bytes this function will append into the buffer. If this value is zero, then a reasonable size will be chosen automatically. ]] ]
  6452. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  6453. Thrown on failure. ]] ]
  6454. [endsect] [section:overload2 websocket::stream::read_some (2 of 4 overloads)]
  6455. Read some message data. [heading Synopsis] ``` template< class __DynamicBuffer__> std::size_t read_some( DynamicBuffer& buffer, std::size_t limit, error_code& ec); ``` [heading Description]
  6456. This function is used to read some message data.
  6457. The call blocks until one of the following is true:
  6458. * Some message data is received.
  6459. * A close frame is received. In this case the error indicated by the function will be [link beast.ref.boost__beast__websocket__error `websocket::closed`].
  6460. * An error occurs.
  6461. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  6462. Received message data is appended to the buffer. The functions [link beast.ref.boost__beast__websocket__stream.got_binary `websocket::stream::got_binary`] and [link beast.ref.boost__beast__websocket__stream.got_text `websocket::stream::got_text`] may be used to query the stream and determine the type of the last received message. The function [link beast.ref.boost__beast__websocket__stream.is_message_done `websocket::stream::is_message_done`] may be called to determine if the message received by the last read operation is complete.
  6463. Until the call returns, the implementation will read incoming control frames and handle them automatically as follows:
  6464. * The [link beast.ref.boost__beast__websocket__stream.control_callback `websocket::stream::control_callback`] will be invoked for each control frame.
  6465. * For each received ping frame, a pong frame will be automatically sent.
  6466. * If a close frame is received, the WebSocket closing handshake is performed. In this case, when the function returns, the error [link beast.ref.boost__beast__websocket__error `websocket::closed`] will be indicated.
  6467. [heading Return Value]
  6468. The number of message payload bytes appended to the buffer.
  6469. [heading Parameters] [table [[Name][Description]] [[`buffer`][
  6470. A dynamic buffer to append message data to. ]] [[`limit`][
  6471. An upper limit on the number of bytes this function will append into the buffer. If this value is zero, then a reasonable size will be chosen automatically. ]] [[`ec`][
  6472. Set to indicate what error occurred, if any. ]] ]
  6473. [endsect] [section:overload3 websocket::stream::read_some (3 of 4 overloads)]
  6474. Read some message data. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers); ``` [heading Description]
  6475. This function is used to read some message data.
  6476. The call blocks until one of the following is true:
  6477. * Some message data is received.
  6478. * A close frame is received. In this case the error indicated by the function will be [link beast.ref.boost__beast__websocket__error `websocket::closed`].
  6479. * An error occurs.
  6480. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  6481. The functions [link beast.ref.boost__beast__websocket__stream.got_binary `websocket::stream::got_binary`] and [link beast.ref.boost__beast__websocket__stream.got_text `websocket::stream::got_text`] may be used to query the stream and determine the type of the last received message. The function [link beast.ref.boost__beast__websocket__stream.is_message_done `websocket::stream::is_message_done`] may be called to determine if the message received by the last read operation is complete.
  6482. Until the call returns, the implementation will read incoming control frames and handle them automatically as follows:
  6483. * The [link beast.ref.boost__beast__websocket__stream.control_callback `websocket::stream::control_callback`] will be invoked for each control frame.
  6484. * For each received ping frame, a pong frame will be automatically sent.
  6485. * If a close frame is received, the WebSocket closing handshake is performed. In this case, when the function returns, the error [link beast.ref.boost__beast__websocket__error `websocket::closed`] will be indicated.
  6486. [heading Return Value]
  6487. The number of message payload bytes appended to the buffer.
  6488. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  6489. A buffer sequence to write message data into. The previous contents of the buffers will be overwritten, starting from the beginning. ]] ]
  6490. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  6491. Thrown on failure. ]] ]
  6492. [endsect] [section:overload4 websocket::stream::read_some (4 of 4 overloads)]
  6493. Read some message data. [heading Synopsis] ``` template< class __MutableBufferSequence__> std::size_t read_some( MutableBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  6494. This function is used to read some message data.
  6495. The call blocks until one of the following is true:
  6496. * Some message data is received.
  6497. * A close frame is received. In this case the error indicated by the function will be [link beast.ref.boost__beast__websocket__error `websocket::closed`].
  6498. * An error occurs.
  6499. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `read_some` and `write_some` functions.
  6500. The functions [link beast.ref.boost__beast__websocket__stream.got_binary `websocket::stream::got_binary`] and [link beast.ref.boost__beast__websocket__stream.got_text `websocket::stream::got_text`] may be used to query the stream and determine the type of the last received message. The function [link beast.ref.boost__beast__websocket__stream.is_message_done `websocket::stream::is_message_done`] may be called to determine if the message received by the last read operation is complete.
  6501. Until the call returns, the implementation will read incoming control frames and handle them automatically as follows:
  6502. * The [link beast.ref.boost__beast__websocket__stream.control_callback `websocket::stream::control_callback`] will be invoked for each control frame.
  6503. * For each received ping frame, a pong frame will be automatically sent.
  6504. * If a close frame is received, the WebSocket closing handshake is performed. In this case, when the function returns, the error [link beast.ref.boost__beast__websocket__error `websocket::closed`] will be indicated.
  6505. [heading Return Value]
  6506. The number of message payload bytes appended to the buffer.
  6507. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  6508. A buffer sequence to write message data into. The previous contents of the buffers will be overwritten, starting from the beginning. ]] [[`ec`][
  6509. Set to indicate what error occurred, if any. ]] ]
  6510. [endsect] [endsect] [section:reason websocket::stream::reason] [indexterm2 reason..websocket::stream]
  6511. Returns the close reason received from the remote peer. [heading Synopsis] ``` close_reason const & reason() const; ``` [heading Description]
  6512. This is only valid after a read completes with [link beast.ref.boost__beast__websocket__error `websocket::closed`]. [endsect] [section:secure_prng websocket::stream::secure_prng] [indexterm2 secure_prng..websocket::stream]
  6513. Set whether the PRNG is cryptographically secure. [heading Synopsis] ``` void secure_prng( bool value); ``` [heading Description]
  6514. This controls whether or not the source of pseudo-random numbers used to produce the masks required by the WebSocket protocol are of cryptographic quality. When the setting is `true`, a strong algorithm is used which cannot be guessed by observing outputs. When the setting is `false`, a much faster algorithm is used. Masking is only performed by streams operating in the client mode. For streams operating in the server mode, this setting has no effect. By default, newly constructed streams use a secure PRNG.
  6515. If the WebSocket stream is used with an encrypted SSL or TLS next layer, if it is known to the application that intermediate proxies are not vulnerable to cache poisoning, or if the application is designed such that an attacker cannot send arbitrary inputs to the stream interface, then the faster algorithm may be used.
  6516. For more information please consult the WebSocket protocol RFC.
  6517. [heading Parameters] [table [[Name][Description]] [[`value`][
  6518. `true` if the PRNG algorithm should be cryptographically secure. ]] ]
  6519. [endsect] [section:set_option websocket::stream::set_option] [indexterm2 set_option..websocket::stream] ``` template< class Option> void ``[link beast.ref.boost__beast__websocket__stream.set_option.overload1 set_option]``( Option opt); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.set_option.overload1 more...]]`` ```
  6520. Set the permessage-deflate extension options. ``` void ``[link beast.ref.boost__beast__websocket__stream.set_option.overload2 set_option]``( permessage_deflate const& o); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.set_option.overload2 more...]]`` ``` [section:overload1 websocket::stream::set_option (1 of 2 overloads)] [heading Synopsis] ``` template< class Option> void set_option( Option opt); ``` [heading Description] [endsect] [section:overload2 websocket::stream::set_option (2 of 2 overloads)]
  6521. Set the permessage-deflate extension options. [heading Synopsis] ``` void set_option( permessage_deflate const& o); ``` [heading Description]
  6522. [heading Exceptions] [table [[Type][Thrown On]] [[`invalid_argument`][
  6523. if `deflateSupported == false`, and either `client_enable` or `server_enable` is `true`. ]] ]
  6524. [endsect] [endsect] [section:stream websocket::stream::stream] [indexterm2 stream..websocket::stream]
  6525. Constructor. ``` ``[link beast.ref.boost__beast__websocket__stream.stream.overload1 stream]``( stream&&); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.stream.overload1 more...]]`` template< class... Args> explicit ``[link beast.ref.boost__beast__websocket__stream.stream.overload2 stream]``( Args&&... args); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.stream.overload2 more...]]`` ``` [section:overload1 websocket::stream::stream (1 of 2 overloads)]
  6526. Constructor. [heading Synopsis] ``` stream( stream&&); ``` [heading Description]
  6527. If `NextLayer` is move constructible, this function will move-construct a new stream from the existing stream.
  6528. After the move, the only valid operation on the moved-from object is destruction. [endsect] [section:overload2 websocket::stream::stream (2 of 2 overloads)]
  6529. Constructor. [heading Synopsis] ``` template< class... Args> stream( Args&&... args); ``` [heading Description]
  6530. This constructor creates a websocket stream and initializes the next layer object.
  6531. [heading Exceptions] [table [[Type][Thrown On]] [[`Any`][
  6532. exceptions thrown by the NextLayer constructor. ]] ]
  6533. [heading Parameters] [table [[Name][Description]] [[`args`][
  6534. The arguments to be passed to initialize the next layer object. The arguments are forwarded to the next layer's constructor. ]] ]
  6535. [endsect] [endsect] [section:text websocket::stream::text] [indexterm2 text..websocket::stream]
  6536. Set the text message write option. ``` void ``[link beast.ref.boost__beast__websocket__stream.text.overload1 text]``( bool value); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.text.overload1 more...]]`` ```
  6537. Returns `true` if the text message write option is set. ``` bool ``[link beast.ref.boost__beast__websocket__stream.text.overload2 text]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.text.overload2 more...]]`` ``` [section:overload1 websocket::stream::text (1 of 2 overloads)]
  6538. Set the text message write option. [heading Synopsis] ``` void text( bool value); ``` [heading Description]
  6539. This controls whether or not outgoing message opcodes are set to binary or text. The setting is only applied at the start when a caller begins a new message. Changing the opcode after a message is started will only take effect after the current message being sent is complete.
  6540. The default setting is to send text messages.
  6541. [heading Parameters] [table [[Name][Description]] [[`value`][
  6542. `true` if outgoing messages should indicate text, or `false` if they should indicate binary. ]] ]
  6543. [heading Example]
  6544. Setting the message type to text. ``` ws.text(true);
  6545. ```
  6546. [endsect] [section:overload2 websocket::stream::text (2 of 2 overloads)]
  6547. Returns `true` if the text message write option is set. [heading Synopsis] ``` bool text() const; ``` [heading Description] [endsect] [endsect] [section:write websocket::stream::write] [indexterm2 write..websocket::stream]
  6548. Write a complete message. ``` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__websocket__stream.write.overload1 write]``( ConstBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.write.overload1 more...]]`` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__websocket__stream.write.overload2 write]``( ConstBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.write.overload2 more...]]`` ``` [section:overload1 websocket::stream::write (1 of 2 overloads)]
  6549. Write a complete message. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write( ConstBufferSequence const& buffers); ``` [heading Description]
  6550. This function is used to write a complete message.
  6551. The call blocks until one of the following is true:
  6552. * The message is written.
  6553. * An error occurs.
  6554. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `write_some` function.
  6555. The current setting of the [link beast.ref.boost__beast__websocket__stream.binary `websocket::stream::binary`] option controls whether the message opcode is set to text or binary. If the [link beast.ref.boost__beast__websocket__stream.auto_fragment `websocket::stream::auto_fragment`] option is set, the message will be split into one or more frames as necessary. The actual payload contents sent may be transformed as per the WebSocket protocol settings.
  6556. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  6557. The buffers containing the message to send. ]] ]
  6558. [heading Return Value]
  6559. The number of bytes sent from the buffers.
  6560. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  6561. Thrown on failure. ]] ]
  6562. [endsect] [section:overload2 websocket::stream::write (2 of 2 overloads)]
  6563. Write a complete message. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write( ConstBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  6564. This function is used to write a complete message.
  6565. The call blocks until one of the following is true:
  6566. * The complete message is written.
  6567. * An error occurs.
  6568. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `write_some` function.
  6569. The current setting of the [link beast.ref.boost__beast__websocket__stream.binary `websocket::stream::binary`] option controls whether the message opcode is set to text or binary. If the [link beast.ref.boost__beast__websocket__stream.auto_fragment `websocket::stream::auto_fragment`] option is set, the message will be split into one or more frames as necessary. The actual payload contents sent may be transformed as per the WebSocket protocol settings.
  6570. [heading Parameters] [table [[Name][Description]] [[`buffers`][
  6571. The buffers containing the message to send. ]] [[`ec`][
  6572. Set to indicate what error occurred, if any. ]] ]
  6573. [heading Return Value]
  6574. The number of bytes sent from the buffers.
  6575. [endsect] [endsect] [section:write_buffer_bytes websocket::stream::write_buffer_bytes] [indexterm2 write_buffer_bytes..websocket::stream]
  6576. Set the write buffer size option. ``` void ``[link beast.ref.boost__beast__websocket__stream.write_buffer_bytes.overload1 write_buffer_bytes]``( std::size_t amount); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.write_buffer_bytes.overload1 more...]]`` ```
  6577. Returns the size of the write buffer. ``` std::size_t ``[link beast.ref.boost__beast__websocket__stream.write_buffer_bytes.overload2 write_buffer_bytes]``() const; ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.write_buffer_bytes.overload2 more...]]`` ``` [section:overload1 websocket::stream::write_buffer_bytes (1 of 2 overloads)]
  6578. Set the write buffer size option. [heading Synopsis] ``` void write_buffer_bytes( std::size_t amount); ``` [heading Description]
  6579. Sets the size of the write buffer used by the implementation to send frames. The write buffer is needed when masking payload data in the client role, compressing frames, or auto-fragmenting message data.
  6580. Lowering the size of the buffer can decrease the memory requirements for each connection, while increasing the size of the buffer can reduce the number of calls made to the next layer to write data.
  6581. The default setting is 4096. The minimum value is 8.
  6582. The write buffer size can only be changed when the stream is not open. Undefined behavior results if the option is modified after a successful WebSocket handshake.
  6583. [heading Example]
  6584. Setting the write buffer size. ``` ws.write_buffer_bytes(8192);
  6585. ```
  6586. [heading Parameters] [table [[Name][Description]] [[`amount`][
  6587. The size of the write buffer in bytes. ]] ]
  6588. [endsect] [section:overload2 websocket::stream::write_buffer_bytes (2 of 2 overloads)]
  6589. Returns the size of the write buffer. [heading Synopsis] ``` std::size_t write_buffer_bytes() const; ``` [heading Description] [endsect] [endsect] [section:write_some websocket::stream::write_some] [indexterm2 write_some..websocket::stream]
  6590. Write some message data. ``` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__websocket__stream.write_some.overload1 write_some]``( bool fin, ConstBufferSequence const& buffers); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.write_some.overload1 more...]]`` template< class __ConstBufferSequence__> std::size_t ``[link beast.ref.boost__beast__websocket__stream.write_some.overload2 write_some]``( bool fin, ConstBufferSequence const& buffers, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream.write_some.overload2 more...]]`` ``` [section:overload1 websocket::stream::write_some (1 of 2 overloads)]
  6591. Write some message data. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( bool fin, ConstBufferSequence const& buffers); ``` [heading Description]
  6592. This function is used to send part of a message.
  6593. The call blocks until one of the following is true:
  6594. * The message data is written.
  6595. * An error occurs.
  6596. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `write_some` function.
  6597. If this is the beginning of a new message, the message opcode will be set to text or binary based on the current setting of the [link beast.ref.boost__beast__websocket__stream.binary `websocket::stream::binary`] (or [link beast.ref.boost__beast__websocket__stream.text `websocket::stream::text`]) option. The actual payload sent may be transformed as per the WebSocket protocol settings.
  6598. [heading Parameters] [table [[Name][Description]] [[`fin`][
  6599. `true` if this is the last part of the message. ]] [[`buffers`][
  6600. The buffers containing the message part to send. ]] ]
  6601. [heading Return Value]
  6602. The number of bytes sent from the buffers.
  6603. [heading Exceptions] [table [[Type][Thrown On]] [[`system_error`][
  6604. Thrown on failure. ]] ]
  6605. [endsect] [section:overload2 websocket::stream::write_some (2 of 2 overloads)]
  6606. Write some message data. [heading Synopsis] ``` template< class __ConstBufferSequence__> std::size_t write_some( bool fin, ConstBufferSequence const& buffers, error_code& ec); ``` [heading Description]
  6607. This function is used to send part of a message.
  6608. The call blocks until one of the following is true:
  6609. * The message data is written.
  6610. * An error occurs.
  6611. The algorithm, known as a ['composed operation], is implemented in terms of calls to the next layer's `write_some` function.
  6612. If this is the beginning of a new message, the message opcode will be set to text or binary based on the current setting of the [link beast.ref.boost__beast__websocket__stream.binary `websocket::stream::binary`] (or [link beast.ref.boost__beast__websocket__stream.text `websocket::stream::text`]) option. The actual payload sent may be transformed as per the WebSocket protocol settings.
  6613. [heading Parameters] [table [[Name][Description]] [[`fin`][
  6614. `true` if this is the last part of the message. ]] [[`buffers`][
  6615. The buffers containing the message part to send. ]] [[`ec`][
  6616. Set to indicate what error occurred, if any. ]] ]
  6617. [heading Return Value]
  6618. The number of bytes sent from the buffers.
  6619. [heading Return Value]
  6620. The number of bytes consumed in the input buffers.
  6621. [endsect] [endsect] [section:stream_dtor_ websocket::stream::~stream] [indexterm2 ~stream..websocket::stream]
  6622. Destructor. [heading Synopsis] ``` ~stream(); ``` [heading Description]
  6623. Destroys the stream and all associated resources.
  6624. [heading Remarks]
  6625. A stream object must not be destroyed while there are pending asynchronous operations associated with it.
  6626. [endsect] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream__accept_op websocket::stream::accept_op] [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2], [role red error.class-detail-template.1][role red error.class-detail-template.2]> class accept_op ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream__close_op websocket::stream::close_op] [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2]> class close_op ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream__handshake_op websocket::stream::handshake_op] [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2]> class handshake_op ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream__idle_ping_op websocket::stream::idle_ping_op] [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2]> class idle_ping_op ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream__ping_op websocket::stream::ping_op] [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2]> class ping_op ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream__read_op websocket::stream::read_op] [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2], [role red error.class-detail-template.1][role red error.class-detail-template.2]> class read_op ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream__read_some_op websocket::stream::read_some_op] [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2], [role red error.class-detail-template.1][role red error.class-detail-template.2]> class read_some_op ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream__response_op websocket::stream::response_op] [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2]> class response_op ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream__write_op websocket::stream::write_op] [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2], [role red error.class-detail-template.1][role red error.class-detail-template.2]> class write_op ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream__write_some_op websocket::stream::write_some_op] [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream.hpp] ``` template< [role red error.class-detail-template.1][role red error.class-detail-template.2], [role red error.class-detail-template.1][role red error.class-detail-template.2]> class write_some_op ``` [heading Description] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream_base websocket::stream_base]
  6627. This class is used as a base for the [link beast.ref.boost__beast__websocket__stream `websocket::stream`] class template to group common types and constants. [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream_base.hpp] ``` struct stream_base ``` [heading Types] [table [[Name][Description]] [ [[link beast.ref.boost__beast__websocket__stream_base__decorator [*decorator]]] [ Stream option used to adjust HTTP fields of WebSocket upgrade request and responses. ] ] [ [[link beast.ref.boost__beast__websocket__stream_base__timeout [*timeout]]] [ Stream option to control the behavior of websocket timeouts. ] ] [ [[link beast.ref.boost__beast__websocket__stream_base.duration [*duration]]] [ The type used to represent durations. ] ] [ [[link beast.ref.boost__beast__websocket__stream_base.time_point [*time_point]]] [ The type used to represent time points. ] ] ] [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__websocket__stream_base.never [*never]]] [ Returns the special time_point value meaning "never". ] ] [ [[link beast.ref.boost__beast__websocket__stream_base.none [*none]]] [ Returns the special duration value meaning "none". ] ] ] [heading Description] [section:duration websocket::stream_base::duration] [indexterm2 duration..websocket::stream_base]
  6628. The type used to represent durations. [heading Synopsis] ``` using duration = std::chrono::steady_clock::duration; ``` [heading Description] [endsect] [section:never websocket::stream_base::never] [indexterm2 never..websocket::stream_base]
  6629. Returns the special time\_point value meaning "never". [heading Synopsis] ``` static time_point never(); ``` [heading Description] [endsect] [section:none websocket::stream_base::none] [indexterm2 none..websocket::stream_base]
  6630. Returns the special duration value meaning "none". [heading Synopsis] ``` static duration none(); ``` [heading Description] [endsect] [section:time_point websocket::stream_base::time_point] [indexterm2 time_point..websocket::stream_base]
  6631. The type used to represent time points. [heading Synopsis] ``` using time_point = std::chrono::steady_clock::time_point; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream_base__decorator websocket::stream_base::decorator]
  6632. Stream option used to adjust HTTP fields of WebSocket upgrade request and responses. [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream_base.hpp] ``` class decorator ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__websocket__stream_base__decorator.decorator [*decorator]]] [ Construct a decorator option. ] ] ] [heading Description] [section:decorator websocket::stream_base::decorator::decorator] [indexterm2 decorator..websocket::stream_base::decorator] ``` ``[link beast.ref.boost__beast__websocket__stream_base__decorator.decorator.overload1 decorator]``( decorator&&); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream_base__decorator.decorator.overload1 more...]]`` ```
  6633. Construct a decorator option. ``` template< class Decorator> explicit ``[link beast.ref.boost__beast__websocket__stream_base__decorator.decorator.overload2 decorator]``( Decorator&& f); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__stream_base__decorator.decorator.overload2 more...]]`` ``` [section:overload1 websocket::stream_base::decorator::decorator (1 of 2 overloads)] [heading Synopsis] ``` decorator( decorator&&); ``` [heading Description] [endsect] [section:overload2 websocket::stream_base::decorator::decorator (2 of 2 overloads)]
  6634. Construct a decorator option. [heading Synopsis] ``` template< class Decorator> decorator( Decorator&& f); ``` [heading Description]
  6635. [heading Parameters] [table [[Name][Description]] [[`f`][
  6636. An invocable function object. Ownership of the function object is transferred by decay-copy. ]] ]
  6637. [endsect] [endsect] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__stream_base__timeout websocket::stream_base::timeout]
  6638. Stream option to control the behavior of websocket timeouts. [heading Synopsis] Defined in header [include_file boost/beast/websocket/stream_base.hpp] ``` struct timeout ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__websocket__stream_base__timeout.suggested [*suggested]]] [ Construct timeout settings with suggested values for a role. ] ] ] [heading Data Members] [table [[Name][Description]] [ [[link beast.ref.boost__beast__websocket__stream_base__timeout.handshake_timeout [*handshake_timeout]]] [ Time limit on handshake, accept, and close operations: ] ] [ [[link beast.ref.boost__beast__websocket__stream_base__timeout.idle_timeout [*idle_timeout]]] [ The time limit after which a connection is considered idle. ] ] [ [[link beast.ref.boost__beast__websocket__stream_base__timeout.keep_alive_pings [*keep_alive_pings]]] [ Automatic ping setting. ] ] ] [heading Description]
  6639. Timeout features are available for asynchronous operations only. [section:handshake_timeout websocket::stream_base::timeout::handshake_timeout] [indexterm2 handshake_timeout..websocket::stream_base::timeout]
  6640. Time limit on handshake, accept, and close operations: [heading Synopsis] ``` duration handshake_timeout; ``` [heading Description]
  6641. This value whether or not there is a time limit, and the duration of that time limit, for asynchronous handshake, accept, and close operations. If this is equal to the value [link beast.ref.boost__beast__websocket__stream_base.none `websocket::stream_base::none`] then there will be no time limit. Otherwise, if any of the applicable operations takes longer than this amount of time, the operation will be canceled and a timeout error delivered to the completion handler. [endsect] [section:idle_timeout websocket::stream_base::timeout::idle_timeout] [indexterm2 idle_timeout..websocket::stream_base::timeout]
  6642. The time limit after which a connection is considered idle. [heading Synopsis] ``` duration idle_timeout; ``` [heading Description] [endsect] [section:keep_alive_pings websocket::stream_base::timeout::keep_alive_pings] [indexterm2 keep_alive_pings..websocket::stream_base::timeout]
  6643. Automatic ping setting. [heading Synopsis] ``` bool keep_alive_pings; ``` [heading Description]
  6644. If the idle interval is set, this setting affects the behavior of the stream when no data is received for the timeout interval as follows:
  6645. * When `keep_alive_pings` is `true`, an idle ping will be sent automatically. If another timeout interval elapses with no received data then the connection will be closed. An outstanding read operation must be pending, which will complete immediately the error [link beast.ref.boost__beast__error `timeout`].
  6646. * When `keep_alive_pings` is `false`, the connection will be closed. An outstanding read operation must be pending, which will complete immediately the error [link beast.ref.boost__beast__error `timeout`].
  6647. [endsect] [section:suggested websocket::stream_base::timeout::suggested] [indexterm2 suggested..websocket::stream_base::timeout]
  6648. Construct timeout settings with suggested values for a role. [heading Synopsis] ``` static timeout suggested( role_type role); ``` [heading Description]
  6649. This constructs the timeout settings with a predefined set of values which varies depending on the desired role. The values are selected upon construction, regardless of the current or actual role in use on the stream.
  6650. [heading Example]
  6651. This statement sets the timeout settings of the stream to the suggested values for the server role: ``` ```
  6652. [heading Parameters] [table [[Name][Description]] [[`role`][
  6653. The role of the websocket stream ([link beast.ref.boost__beast__role_type `client`] or [link beast.ref.boost__beast__role_type `server`]). ]] ]
  6654. [endsect] Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:boost__beast__websocket__teardown websocket::teardown] [indexterm1 websocket::teardown]
  6655. Tear down a connection. ``` template< class Socket> void ``[link beast.ref.boost__beast__websocket__teardown.overload1 teardown]``( role_type role, Socket& socket, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__teardown.overload1 more...]]`` ```
  6656. Tear down a `net::ip::tcp::socket`. ``` template< class __Protocol__, class __Executor__> void ``[link beast.ref.boost__beast__websocket__teardown.overload2 teardown]``( role_type role, net::basic_stream_socket< Protocol, Executor >& socket, error_code& ec); ``[''''&raquo;''' [link beast.ref.boost__beast__websocket__teardown.overload2 more...]]`` ``` [section:overload1 websocket::teardown (1 of 2 overloads)]
  6657. Tear down a connection. [heading Synopsis] Defined in header [include_file boost/beast/websocket/teardown.hpp] ``` template< class Socket> void teardown( role_type role, Socket& socket, error_code& ec); ``` [heading Description]
  6658. This tears down a connection. The implementation will call the overload of this function based on the `Socket` parameter used to consruct the socket. When `Socket` is a user defined type, and not a `net::ip::tcp::socket` or any `net::ssl::stream`, callers are responsible for providing a suitable overload of this function.
  6659. [heading Parameters] [table [[Name][Description]] [[`role`][
  6660. The role of the local endpoint ]] [[`socket`][
  6661. The socket to tear down. ]] [[`ec`][
  6662. Set to the error if any occurred. ]] ]
  6663. Convenience header [include_file boost/beast/websocket.hpp] [endsect] [section:overload2 websocket::teardown (2 of 2 overloads)]
  6664. Tear down a `net::ip::tcp::socket`. [heading Synopsis] Defined in header [include_file boost/beast/websocket/teardown.hpp] ``` template< class __Protocol__, class __Executor__> void teardown( role_type role, net::basic_stream_socket< Protocol, Executor >& socket, error_code& ec); ``` [heading Description]
  6665. This tears down a connection. The implementation will call the overload of this function based on the `Stream` parameter used to consruct the socket. When `Stream` is a user defined type, and not a `net::ip::tcp::socket` or any `net::ssl::stream`, callers are responsible for providing a suitable overload of this function.
  6666. [heading Parameters] [table [[Name][Description]] [[`role`][
  6667. The role of the local endpoint ]] [[`socket`][
  6668. The socket to tear down. ]] [[`ec`][
  6669. Set to the error if any occurred. ]] ]
  6670. Convenience header [include_file boost/beast/websocket.hpp] [endsect] [endsect] [section:boost__beast__zlib__Byte zlib::Byte] [indexterm1 zlib::Byte] [heading Synopsis] Defined in header [include_file boost/beast/zlib/zlib.hpp] ``` using Byte = unsigned char; ``` [heading Description] Convenience header [include_file boost/beast/zlib.hpp] [endsect] [section:boost__beast__zlib__Flush zlib::Flush] [indexterm1 zlib::Flush]
  6671. Flush option. [heading Synopsis] Defined in header [include_file boost/beast/zlib/zlib.hpp] ``` enum Flush ``` [indexterm2 none..zlib::Flush] [indexterm2 block..zlib::Flush] [indexterm2 partial..zlib::Flush] [indexterm2 sync..zlib::Flush] [indexterm2 full..zlib::Flush] [indexterm2 finish..zlib::Flush] [indexterm2 trees..zlib::Flush] [heading Values] [table [[Name][Description]] [[[^none]][ ]] [[[^block]][ ]] [[[^partial]][ ]] [[[^sync]][ ]] [[[^full]][ ]] [[[^finish]][ ]] [[[^trees]][ ]] ] [heading Description] Convenience header [include_file boost/beast/zlib.hpp] [endsect] [section:boost__beast__zlib__Strategy zlib::Strategy] [indexterm1 zlib::Strategy]
  6672. Compression strategy. [heading Synopsis] Defined in header [include_file boost/beast/zlib/zlib.hpp] ``` enum Strategy ``` [indexterm2 normal..zlib::Strategy] [indexterm2 filtered..zlib::Strategy] [indexterm2 huffman..zlib::Strategy] [indexterm2 rle..zlib::Strategy] [indexterm2 fixed..zlib::Strategy] [heading Values] [table [[Name][Description]] [[[^normal]][Default strategy. This is suitable for general purpose compression, and works
  6673. well in the majority of cases.
  6674. ]] [[[^filtered]][Filtered strategy. This strategy should be used when the data be compressed
  6675. is produced by a filter or predictor.
  6676. ]] [[[^huffman]][Huffman-only strategy. This strategy only performs Huffman encoding, without doing
  6677. any string matching.
  6678. ]] [[[^rle]][Run Length Encoding strategy. This strategy limits match distances to one, making it
  6679. equivalent to run length encoding. This can give better
  6680. performance for things like PNG image data.
  6681. ]] [[[^fixed]][Fixed table strategy. This strategy prevents the use of dynamic Huffman codes,
  6682. allowing for a simpler decoder for special applications.
  6683. ]] ] [heading Description]
  6684. These are used when compressing streams. Convenience header [include_file boost/beast/zlib.hpp] [endsect] [section:boost__beast__zlib__compression zlib::compression] [indexterm1 zlib::compression] [heading Synopsis] Defined in header [include_file boost/beast/zlib/zlib.hpp] ``` enum compression ``` [indexterm2 none..zlib::compression] [indexterm2 none..zlib::compression] [indexterm2 best_speed..zlib::compression] [indexterm2 best_size..zlib::compression] [indexterm2 default_size..zlib::compression] [heading Values] [table [[Name][Description]] [[[^none]][ ]] [[[^none]][ ]] [[[^best_speed]][ ]] [[[^best_size]][ ]] [[[^default_size]][ ]] ] [heading Description] Convenience header [include_file boost/beast/zlib.hpp] [endsect] [section:boost__beast__zlib__deflate_stream zlib::deflate_stream]
  6685. Raw deflate compressor. [heading Synopsis] Defined in header [include_file boost/beast/zlib/deflate_stream.hpp] ``` class deflate_stream : private deflate_stream ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__zlib__deflate_stream.clear [*clear]]] [ Clear the stream. ] ] [ [[link beast.ref.boost__beast__zlib__deflate_stream.deflate_stream [*deflate_stream]]] [ Construct a default deflate stream. ] ] [ [[link beast.ref.boost__beast__zlib__deflate_stream.params [*params]]] [ Update the compression level and strategy. ] ] [ [[link beast.ref.boost__beast__zlib__deflate_stream.pending [*pending]]] [ Return bits pending in the output. ] ] [ [[link beast.ref.boost__beast__zlib__deflate_stream.prime [*prime]]] [ Insert bits into the compressed output stream. ] ] [ [[link beast.ref.boost__beast__zlib__deflate_stream.reset [*reset]]] [ Reset the stream and compression settings. Reset the stream without deallocating memory. ] ] [ [[link beast.ref.boost__beast__zlib__deflate_stream.tune [*tune]]] [ Fine tune internal compression parameters. ] ] [ [[link beast.ref.boost__beast__zlib__deflate_stream.upper_bound [*upper_bound]]] [ Returns the upper limit on the size of a compressed block. ] ] [ [[link beast.ref.boost__beast__zlib__deflate_stream.write [*write]]] [ Compress input and write output. ] ] ] [heading Description]
  6686. This is a port of zlib's "deflate" functionality to C++. [section:clear zlib::deflate_stream::clear] [indexterm2 clear..zlib::deflate_stream]
  6687. Clear the stream. [heading Synopsis] ``` void clear(); ``` [heading Description]
  6688. This function resets the stream and frees all dynamically allocated internal buffers. The compression settings are left unchanged.
  6689. [heading Remarks]
  6690. Any unprocessed input or pending output from previous calls are discarded.
  6691. [endsect] [section:deflate_stream zlib::deflate_stream::deflate_stream] [indexterm2 deflate_stream..zlib::deflate_stream]
  6692. Construct a default deflate stream. [heading Synopsis] ``` deflate_stream(); ``` [heading Description]
  6693. Upon construction, the stream settings will be set to these default values:
  6694. * `level = 6`
  6695. * `windowBits = 15`
  6696. * `memLevel = 8`
  6697. * `strategy = Strategy::normal`
  6698. Although the stream is ready to be used immediately after construction, any required internal buffers are not dynamically allocated until needed. [endsect] [section:params zlib::deflate_stream::params] [indexterm2 params..zlib::deflate_stream]
  6699. Update the compression level and strategy. [heading Synopsis] ``` void params( z_params& zs, int level, Strategy strategy, error_code& ec); ``` [heading Description]
  6700. This function dynamically updates the compression level and compression strategy. The interpretation of level and strategy is as in [link beast.ref.boost__beast__zlib__deflate_stream.reset `zlib::deflate_stream::reset`]. This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression level is changed, the input available so far is compressed with the old level (and may be flushed); the new level will take effect only at the next call of [link beast.ref.boost__beast__zlib__deflate_stream.write `zlib::deflate_stream::write`].
  6701. Before the call of `params`, the stream state must be set as for a call of [link beast.ref.boost__beast__zlib__deflate_stream.write `zlib::deflate_stream::write`], since the currently available input may have to be compressed and flushed. In particular, `zs.avail_out` must be non-zero.
  6702. [heading Return Value]
  6703. `Z_OK` if success, `Z_STREAM_ERROR` if the source stream state was inconsistent or if a parameter was invalid, `error::need_buffers` if `zs.avail_out` was zero.
  6704. [endsect] [section:pending zlib::deflate_stream::pending] [indexterm2 pending..zlib::deflate_stream]
  6705. Return bits pending in the output. [heading Synopsis] ``` void pending( unsigned* value, int* bits); ``` [heading Description]
  6706. This function returns the number of bytes and bits of output that have been generated, but not yet provided in the available output. The bytes not provided would be due to the available output space having being consumed. The number of bits of output not provided are between 0 and 7, where they await more bits to join them in order to fill out a full byte. If pending or bits are `nullptr`, then those values are not set.
  6707. [heading Return Value]
  6708. `Z_OK` if success, or `Z_STREAM_ERROR` if the source stream state was inconsistent.
  6709. [endsect] [section:prime zlib::deflate_stream::prime] [indexterm2 prime..zlib::deflate_stream]
  6710. Insert bits into the compressed output stream. [heading Synopsis] ``` void prime( int bits, int value, error_code& ec); ``` [heading Description]
  6711. This function inserts bits in the deflate output stream. The intent is that this function is used to start off the deflate output with the bits leftover from a previous deflate stream when appending to it. As such, this function can only be used for raw deflate, and must be used before the first `write` call after an initialization. `bits` must be less than or equal to 16, and that many of the least significant bits of `value` will be inserted in the output.
  6712. [heading Return Value]
  6713. `error::need_buffers` if there was not enough room in the internal buffer to insert the bits.
  6714. [endsect] [section:reset zlib::deflate_stream::reset] [indexterm2 reset..zlib::deflate_stream]
  6715. Reset the stream and compression settings. ``` void ``[link beast.ref.boost__beast__zlib__deflate_stream.reset.overload1 reset]``( int level, int windowBits, int memLevel, Strategy strategy); ``[''''&raquo;''' [link beast.ref.boost__beast__zlib__deflate_stream.reset.overload1 more...]]`` ```
  6716. Reset the stream without deallocating memory. ``` void ``[link beast.ref.boost__beast__zlib__deflate_stream.reset.overload2 reset]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__zlib__deflate_stream.reset.overload2 more...]]`` ``` [section:overload1 zlib::deflate_stream::reset (1 of 2 overloads)]
  6717. Reset the stream and compression settings. [heading Synopsis] ``` void reset( int level, int windowBits, int memLevel, Strategy strategy); ``` [heading Description]
  6718. This function initializes the stream to the specified compression settings.
  6719. Although the stream is ready to be used immediately after a reset, any required internal buffers are not dynamically allocated until needed.
  6720. [heading Remarks]
  6721. Any unprocessed input or pending output from previous calls are discarded.
  6722. [endsect] [section:overload2 zlib::deflate_stream::reset (2 of 2 overloads)]
  6723. Reset the stream without deallocating memory. [heading Synopsis] ``` void reset(); ``` [heading Description]
  6724. This function performs the equivalent of calling `clear` followed by `reset` with the same compression settings, without deallocating the internal buffers.
  6725. [heading Remarks]
  6726. Any unprocessed input or pending output from previous calls are discarded.
  6727. [endsect] [endsect] [section:tune zlib::deflate_stream::tune] [indexterm2 tune..zlib::deflate_stream]
  6728. Fine tune internal compression parameters. [heading Synopsis] ``` void tune( int good_length, int max_lazy, int nice_length, int max_chain); ``` [heading Description]
  6729. Compression parameters should only be tuned by someone who understands the algorithm used by zlib's deflate for searching for the best matching string, and even then only by the most fanatic optimizer trying to squeeze out the last compressed bit for their specific input data. Read the deflate.c source code (ZLib) for the meaning of the max\_lazy, good\_length, nice\_length, and max\_chain parameters. [endsect] [section:upper_bound zlib::deflate_stream::upper_bound] [indexterm2 upper_bound..zlib::deflate_stream]
  6730. Returns the upper limit on the size of a compressed block. [heading Synopsis] ``` std::size_t upper_bound( std::size_t sourceLen) const; ``` [heading Description]
  6731. This function makes a conservative estimate of the maximum number of bytes needed to store the result of compressing a block of data based on the current compression level and strategy.
  6732. [heading Parameters] [table [[Name][Description]] [[`sourceLen`][
  6733. The size of the uncompressed data. ]] ]
  6734. [heading Return Value]
  6735. The maximum number of resulting compressed bytes.
  6736. [endsect] [section:write zlib::deflate_stream::write] [indexterm2 write..zlib::deflate_stream]
  6737. Compress input and write output. [heading Synopsis] ``` void write( z_params& zs, Flush flush, error_code& ec); ``` [heading Description]
  6738. This function compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush.
  6739. In each call, one or both of these actions are performed:
  6740. * Compress more input starting at `zs.next_in` and update `zs.next_in` and `zs.avail_in` accordingly. If not all input can be processed (because there is not enough room in the output buffer), `zs.next_in` and `zs.avail_in` are updated and processing will resume at this point for the next call.
  6741. * Provide more output starting at `zs.next_out` and update `zs.next_out` and `zs.avail_out` accordingly. This action is forced if the parameter flush is not `Flush::none`. Forcing flush frequently degrades the compression ratio, so this parameter should be set only when necessary (in interactive applications). Some output may be provided even if flush is not set.
  6742. Before the call, the application must ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating `zs.avail_in` or `zs.avail_out` accordingly; `zs.avail_out` should never be zero before the call. The application can consume the compressed output when it wants, for example when the output buffer is full (`zs.avail_out == 0`), or after each call of `write`. If `write` returns no error with zero `zs.avail_out`, it must be called again after making room in the output buffer because there might be more output pending.
  6743. Normally the parameter flush is set to `Flush::none`, which allows deflate to decide how much data to accumulate before producing output, in order to maximize compression.
  6744. If the parameter flush is set to `Flush::sync`, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. In particular `zs.avail_in` is zero after the call if enough output space has been provided before the call. Flushing may degrade compression for some compression algorithms and so it should be used only when necessary. This completes the current deflate block and follows it with an empty stored block that is three bits plus filler bits to the next byte, followed by the four bytes `{ 0x00, 0x00 0xff 0xff }`.
  6745. If flush is set to `Flush::partial`, all pending output is flushed to the output buffer, but the output is not aligned to a byte boundary. All of the input data so far will be available to the decompressor, as for Z\_SYNC\_FLUSH. This completes the current deflate block and follows it with an empty fixed codes block that is 10 bits long. This assures that enough bytes are output in order for the decompressor to finish the block before the empty fixed code block.
  6746. If flush is set to `Flush::block`, a deflate block is completed and emitted, as for `Flush::sync`, but the output is not aligned on a byte boundary, and up to seven bits of the current block are held to be written as the next byte after the next deflate block is completed. In this case, the decompressor may not be provided enough bits at this point in order to complete decompression of the data provided so far to the compressor. It may need to wait for the next block to be emitted. This is for advanced applications that need to control the emission of deflate blocks.
  6747. If flush is set to `Flush::full`, all output is flushed as with `Flush::sync`, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using `Flush::full` too often can seriously degrade compression.
  6748. If `write` returns with `zs.avail_out == 0`, this function must be called again with the same value of the flush parameter and more output space (updated `zs.avail_out`), until the flush is complete (`write` returns with non-zero `zs.avail_out`). In the case of a `Flush::full`or `Flush::sync`, make sure that `zs.avail_out` is greater than six to avoid repeated flush markers due to `zs.avail_out == 0` on return.
  6749. If the parameter flush is set to `Flush::finish`, pending input is processed, pending output is flushed and deflate returns the error `error::end_of_stream` if there was enough output space; if deflate returns with no error, this function must be called again with `Flush::finish` and more output space (updated `zs.avail_out`) but no more input data, until it returns the error `error::end_of_stream` or another error. After `write` has returned the `error::end_of_stream` error, the only possible operations on the stream are to reset or destroy.
  6750. `Flush::finish` can be used immediately after initialization if all the compression is to be done in a single step. In this case, `zs.avail_out` must be at least value returned by `upper_bound` (see below). Then `write` is guaranteed to return the `error::end_of_stream` error. If not enough output space is provided, deflate will not return `error::end_of_stream`, and it must be called again as described above.
  6751. `write` returns no error if some progress has been made (more input processed or more output produced), `error::end_of_stream` if all input has been consumed and all output has been produced (only when flush is set to `Flush::finish`), `error::stream_error` if the stream state was inconsistent (for example if `zs.next_in` or `zs.next_out` was `nullptr`), `error::need_buffers` if no progress is possible (for example `zs.avail_in` or `zs.avail_out` was zero). Note that `error::need_buffers` is not fatal, and `write` can be called again with more input and more output space to continue compressing. [endsect] Convenience header [include_file boost/beast/zlib.hpp] [endsect] [section:boost__beast__zlib__deflate_upper_bound zlib::deflate_upper_bound] [indexterm1 zlib::deflate_upper_bound]
  6752. Returns the upper limit on the size of a compressed block. [heading Synopsis] Defined in header [include_file boost/beast/zlib/deflate_stream.hpp] ``` std::size_t deflate_upper_bound( std::size_t bytes); ``` [heading Description]
  6753. This function makes a conservative estimate of the maximum number of bytes needed to store the result of compressing a block of data.
  6754. [heading Parameters] [table [[Name][Description]] [[`bytes`][
  6755. The size of the uncompressed data. ]] ]
  6756. [heading Return Value]
  6757. The maximum number of resulting compressed bytes.
  6758. Convenience header [include_file boost/beast/zlib.hpp] [endsect] [section:boost__beast__zlib__error zlib::error] [indexterm1 zlib::error]
  6759. Error codes returned by the deflate codecs. [heading Synopsis] Defined in header [include_file boost/beast/zlib/error.hpp] ``` enum error ``` [indexterm2 need_buffers..zlib::error] [indexterm2 end_of_stream..zlib::error] [indexterm2 need_dict..zlib::error] [indexterm2 stream_error..zlib::error] [indexterm2 invalid_block_type..zlib::error] [indexterm2 invalid_stored_length..zlib::error] [indexterm2 too_many_symbols..zlib::error] [indexterm2 invalid_code_lengths..zlib::error] [indexterm2 invalid_code_lenths..zlib::error] [indexterm2 invalid_bit_length_repeat..zlib::error] [indexterm2 missing_eob..zlib::error] [indexterm2 invalid_literal_length..zlib::error] [indexterm2 invalid_distance_code..zlib::error] [indexterm2 invalid_distance..zlib::error] [indexterm2 over_subscribed_length..zlib::error] [indexterm2 incomplete_length_set..zlib::error] [indexterm2 general..zlib::error] [heading Values] [table [[Name][Description]] [[[^need_buffers]][Additional buffers are required. This error indicates that one or both of the buffers
  6760. provided buffers do not have sufficient available bytes
  6761. to make forward progress.
  6762. This does not always indicate a failure condition.
  6763. @note This is the same as `Z_BUF_ERROR` returned by ZLib.
  6764. ]] [[[^end_of_stream]][End of stream reached. @note This is the same as `Z_STREAM_END` returned by ZLib.
  6765. ]] [[[^need_dict]][Preset dictionary required. This error indicates that a preset dictionary was not provided and is now
  6766. needed at this point.
  6767. This does not always indicate a failure condition.
  6768. @note This is the same as `Z_NEED_DICT` returned by ZLib.
  6769. ]] [[[^stream_error]][Invalid stream or parameters. This error is returned when invalid parameters are passed,
  6770. or the operation being performed is not consistent with the
  6771. state of the stream. For example, attempting to write data
  6772. when the end of stream is already reached.
  6773. @note This is the same as `Z_STREAM_ERROR` returned by ZLib.
  6774. ]] [[[^invalid_block_type]][Invalid block type. ]] [[[^invalid_stored_length]][Invalid stored block length. ]] [[[^too_many_symbols]][Too many length or distance symbols. ]] [[[^invalid_code_lengths]][Invalid code lengths. ]] [[[^invalid_code_lenths]][ ]] [[[^invalid_bit_length_repeat]][Invalid bit length repeat. ]] [[[^missing_eob]][Missing end of block code. ]] [[[^invalid_literal_length]][Invalid literal/length code. ]] [[[^invalid_distance_code]][Invalid distance code. ]] [[[^invalid_distance]][Invalid distance too far back. ]] [[[^over_subscribed_length]][Over-subscribed length code. ]] [[[^incomplete_length_set]][Incomplete length set. ]] [[[^general]][general error ]] ] [heading Description] Convenience header [include_file boost/beast/zlib.hpp] [endsect] [section:boost__beast__zlib__inflate_stream zlib::inflate_stream]
  6775. Raw deflate stream decompressor. [heading Synopsis] Defined in header [include_file boost/beast/zlib/inflate_stream.hpp] ``` class inflate_stream : private inflate_stream ``` [heading Member Functions] [table [[Name][Description]] [ [[link beast.ref.boost__beast__zlib__inflate_stream.clear [*clear]]] [ Put the stream in a newly constructed state. ] ] [ [[link beast.ref.boost__beast__zlib__inflate_stream.inflate_stream [*inflate_stream]]] [ Construct a raw deflate decompression stream. ] ] [ [[link beast.ref.boost__beast__zlib__inflate_stream.reset [*reset]]] [ Reset the stream. ] ] [ [[link beast.ref.boost__beast__zlib__inflate_stream.write [*write]]] [ Decompress input and produce output. ] ] ] [heading Description]
  6776. This implements a raw deflate stream decompressor. The deflate protocol is a compression protocol described in "DEFLATE Compressed Data Format Specification version 1.3" located here: [@https://tools.ietf.org/html/rfc1951 https://tools.ietf.org/html/rfc1951]
  6777. The implementation is a refactored port to C++ of ZLib's "inflate". A more detailed description of ZLib is at [@http://zlib.net/ http://zlib.net/].
  6778. Compression can be done in a single step if the buffers are large enough (for example if an input file is memory mapped), or can be done by repeated calls of the compression function. In the latter case, the application must provide more input and/or consume the output (providing more output space) before each call. [section:clear zlib::inflate_stream::clear] [indexterm2 clear..zlib::inflate_stream]
  6779. Put the stream in a newly constructed state. [heading Synopsis] ``` void clear(); ``` [heading Description]
  6780. All dynamically allocated memory is de-allocated. [endsect] [section:inflate_stream zlib::inflate_stream::inflate_stream] [indexterm2 inflate_stream..zlib::inflate_stream]
  6781. Construct a raw deflate decompression stream. [heading Synopsis] ``` inflate_stream(); ``` [heading Description]
  6782. The window size is set to the default of 15 bits. [endsect] [section:reset zlib::inflate_stream::reset] [indexterm2 reset..zlib::inflate_stream]
  6783. Reset the stream. ``` void ``[link beast.ref.boost__beast__zlib__inflate_stream.reset.overload1 reset]``(); ``[''''&raquo;''' [link beast.ref.boost__beast__zlib__inflate_stream.reset.overload1 more...]]`` void ``[link beast.ref.boost__beast__zlib__inflate_stream.reset.overload2 reset]``( int windowBits); ``[''''&raquo;''' [link beast.ref.boost__beast__zlib__inflate_stream.reset.overload2 more...]]`` ``` [section:overload1 zlib::inflate_stream::reset (1 of 2 overloads)]
  6784. Reset the stream. [heading Synopsis] ``` void reset(); ``` [heading Description]
  6785. This puts the stream in a newly constructed state with the previously specified window size, but without de-allocating any dynamically created structures. [endsect] [section:overload2 zlib::inflate_stream::reset (2 of 2 overloads)]
  6786. Reset the stream. [heading Synopsis] ``` void reset( int windowBits); ``` [heading Description]
  6787. This puts the stream in a newly constructed state with the specified window size, but without de-allocating any dynamically created structures. [endsect] [endsect] [section:write zlib::inflate_stream::write] [indexterm2 write..zlib::inflate_stream]
  6788. Decompress input and produce output. [heading Synopsis] ``` void write( z_params& zs, Flush flush, error_code& ec); ``` [heading Description]
  6789. This function decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush.
  6790. One or both of the following actions are performed:
  6791. * Decompress more input starting at `zs.next_in` and update `zs.next_in` and `zs.avail_in` accordingly. If not all input can be processed (because there is not enough room in the output buffer), `zs.next_in` is updated and processing will resume at this point for the next call.
  6792. * Provide more output starting at `zs.next_out` and update `zs.next_out` and `zs.avail_out` accordingly. `write` provides as much output as possible, until there is no more input data or no more space in the output buffer (see below about the flush parameter).
  6793. Before the call, the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating the values in `zs` accordingly. The application can consume the uncompressed output when it wants, for example when the output buffer is full (`zs.avail_out == 0`), or after each call. If `write` returns no error and with zero `zs.avail_out`, it must be called again after making room in the output buffer because there might be more output pending.
  6794. The flush parameter may be `Flush::none`, `Flush::sync`, `Flush::finish`, `Flush::block`, or `Flush::trees`. `Flush::sync` requests to flush as much output as possible to the output buffer. `Flush::block` requests to stop if and when it gets to the next deflate block boundary. When decoding the zlib or gzip format, this will cause `write` to return immediately after the header and before the first block. When doing a raw inflate, `write` will go ahead and process the first block, and will return when it gets to the end of that block, or when it runs out of data.
  6795. The `Flush::block` option assists in appending to or combining deflate streams. Also to assist in this, on return `write` will set `zs.data_type` to the number of unused bits in the last byte taken from `zs.next_in`, plus 64 if `write` is currently decoding the last block in the deflate stream, plus 128 if `write` returned immediately after decoding an end-of-block code or decoding the complete header up to just before the first byte of the deflate stream. The end-of-block will not be indicated until all of the uncompressed data from that block has been written to `zs.next_out`. The number of unused bits may in general be greater than seven, except when bit 7 of `zs.data_type` is set, in which case the number of unused bits will be less than eight. `zs.data_type` is set as noted here every time `write` returns for all flush options, and so can be used to determine the amount of currently consumed input in bits.
  6796. The `Flush::trees` option behaves as `Flush::block` does, but it also returns when the end of each deflate block header is reached, before any actual data in that block is decoded. This allows the caller to determine the length of the deflate block header for later use in random access within a deflate block. 256 is added to the value of `zs.data_type` when `write` returns immediately after reaching the end of the deflate block header.
  6797. `write` should normally be called until it returns `error::end_of_stream` or another error. However if all decompression is to be performed in a single step (a single call of `write`), the parameter flush should be set to `Flush::finish`. In this case all pending input is processed and all pending output is flushed; `zs.avail_out` must be large enough to hold all of the uncompressed data for the operation to complete. (The size of the uncompressed data may have been saved by the compressor for this purpose.) The use of `Flush::finish` is not required to perform an inflation in one step. However it may be used to inform inflate that a faster approach can be used for the single call. `Flush::finish` also informs inflate to not maintain a sliding window if the stream completes, which reduces inflate's memory footprint. If the stream does not complete, either because not all of the stream is provided or not enough output space is provided, then a sliding window will be allocated and `write` can be called again to continue the operation as if `Flush::none` had been used.
  6798. In this implementation, `write` always flushes as much output as possible to the output buffer, and always uses the faster approach on the first call. So the effects of the flush parameter in this implementation are on the return value of `write` as noted below, when `write` returns early when `Flush::block` or `Flush::trees` is used, and when `write` avoids the allocation of memory for a sliding window when `Flush::finish` is used.
  6799. If a preset dictionary is needed after this call, `write` sets `zs.adler` to the Adler-32 checksum of the dictionary chosen by the compressor and returns `error::need_dictionary`; otherwise it sets `zs.adler` to the Adler-32 checksum of all output produced so far (that is, `zs.total_out bytes`) and returns no error, `error::end_of_stream`, or an error code as described below. At the end of the stream, `write` checks that its computed adler32 checksum is equal to that saved by the compressor and returns `error::end_of_stream` only if the checksum is correct.
  6800. This function returns no error if some progress has been made (more input processed or more output produced), `error::end_of_stream` if the end of the compressed data has been reached and all uncompressed output has been produced, `error::need_dictionary` if a preset dictionary is needed at this point, `error::invalid_data` if the input data was corrupted (input stream not conforming to the zlib format or incorrect check value), `error::stream_error` if the stream structure was inconsistent (for example if `zs.next_in` or `zs.next_out` was null), `error::need_buffers` if no progress is possible or if there was not enough room in the output buffer when `Flush::finish` is used. Note that `error::need_buffers` is not fatal, and `write` can be called again with more input and more output space to continue decompressing. [endsect] Convenience header [include_file boost/beast/zlib.hpp] [endsect] [section:boost__beast__zlib__kind zlib::kind] [indexterm1 zlib::kind] [heading Synopsis] Defined in header [include_file boost/beast/zlib/zlib.hpp] ``` enum kind ``` [indexterm2 binary..zlib::kind] [indexterm2 text..zlib::kind] [indexterm2 unknown..zlib::kind] [heading Values] [table [[Name][Description]] [[[^binary]][ ]] [[[^text]][ ]] [[[^unknown]][ ]] ] [heading Description] Convenience header [include_file boost/beast/zlib.hpp] [endsect] [section:boost__beast__zlib__uInt zlib::uInt] [indexterm1 zlib::uInt] [heading Synopsis] Defined in header [include_file boost/beast/zlib/zlib.hpp] ``` using uInt = unsigned int; ``` [heading Description] Convenience header [include_file boost/beast/zlib.hpp] [endsect] [section:boost__beast__zlib__z_params zlib::z_params]
  6801. Deflate codec parameters. [heading Synopsis] Defined in header [include_file boost/beast/zlib/zlib.hpp] ``` struct z_params ``` [heading Data Members] [table [[Name][Description]] [ [[link beast.ref.boost__beast__zlib__z_params.avail_in [*avail_in]]] [ The number of bytes of input available at next_in. ] ] [ [[link beast.ref.boost__beast__zlib__z_params.avail_out [*avail_out]]] [ The remaining bytes of space at next_out. ] ] [ [[link beast.ref.boost__beast__zlib__z_params.data_type [*data_type]]] [ ] ] [ [[link beast.ref.boost__beast__zlib__z_params.next_in [*next_in]]] [ A pointer to the next input byte. ] ] [ [[link beast.ref.boost__beast__zlib__z_params.next_out [*next_out]]] [ A pointer to the next output byte. ] ] [ [[link beast.ref.boost__beast__zlib__z_params.total_in [*total_in]]] [ The total number of input bytes read so far. ] ] [ [[link beast.ref.boost__beast__zlib__z_params.total_out [*total_out]]] [ The total number of bytes output so far. ] ] ] [heading Description]
  6802. Objects of this type are filled in by callers and provided to the deflate codec to define the input and output areas for the next compress or decompress operation.
  6803. The application must update next\_in and avail\_in when avail\_in has dropped to zero. It must update next\_out and avail\_out when avail\_out has dropped to zero. The application must initialize zalloc, zfree and opaque before calling the init function. All other fields are set by the compression library and must not be updated by the application.
  6804. The fields total\_in and total\_out can be used for statistics or progress reports. After compression, total\_in holds the total size of the uncompressed data and may be saved for use in the decompressor (particularly if the decompressor wants to decompress everything in a single step). [section:avail_in zlib::z_params::avail_in] [indexterm2 avail_in..zlib::z_params]
  6805. The number of bytes of input available at `next_in`. [heading Synopsis] ``` std::size_t avail_in; ``` [heading Description]
  6806. If there is no more input, this should be set to zero. [endsect] [section:avail_out zlib::z_params::avail_out] [indexterm2 avail_out..zlib::z_params]
  6807. The remaining bytes of space at `next_out`. [heading Synopsis] ``` std::size_t avail_out; ``` [heading Description] [endsect] [section:data_type zlib::z_params::data_type] [indexterm2 data_type..zlib::z_params] [heading Synopsis] ``` int data_type = unknown; ``` [heading Description] [endsect] [section:next_in zlib::z_params::next_in] [indexterm2 next_in..zlib::z_params]
  6808. A pointer to the next input byte. [heading Synopsis] ``` void const * next_in; ``` [heading Description]
  6809. If there is no more input, this may be set to `nullptr`. [endsect] [section:next_out zlib::z_params::next_out] [indexterm2 next_out..zlib::z_params]
  6810. A pointer to the next output byte. [heading Synopsis] ``` void * next_out; ``` [heading Description] [endsect] [section:total_in zlib::z_params::total_in] [indexterm2 total_in..zlib::z_params]
  6811. The total number of input bytes read so far. [heading Synopsis] ``` std::size_t total_in = 0; ``` [heading Description] [endsect] [section:total_out zlib::z_params::total_out] [indexterm2 total_out..zlib::z_params]
  6812. The total number of bytes output so far. [heading Synopsis] ``` std::size_t total_out = 0; ``` [heading Description] [endsect] Convenience header [include_file boost/beast/zlib.hpp] [endsect]