{"id":820,"date":"2014-01-01T00:00:00","date_gmt":"2014-01-01T00:00:00","guid":{"rendered":"https:\/\/fir3netwp.gmsrrpobkbd.com\/2014\/01\/01\/http-what-does-transfer-encoding-chunked-mean\/"},"modified":"2021-08-01T01:18:17","modified_gmt":"2021-08-01T01:18:17","slug":"http-what-does-transfer-encoding-chunked-mean","status":"publish","type":"post","link":"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html","title":{"rendered":"HTTP – What does ‘Transfer-Encoding : Chunked’ mean?"},"content":{"rendered":"

Content-Length<\/strong><\/h2>\n

The content-length header informs the client of the byte length of the HTTP body. This is typically used for HTTP 1.1 (i.e persistent connection<\/span>s) to ensure the client knows when the current response\/request is complete so that the connection can be reused for further requests.<\/p>\n

Transfer-Encoding Chunked<\/strong><\/h2>\n

However in certain cirucumstances the server may want to start sending the HTTP body back to the client before it actually knows the content-length (i.e because the body is still being generated by the server).<\/p>\n

To achieve this the HTTP content-length header is replaced with the HTTP header ‘Transfer-Encoding : Chunked<\/strong>‘ and the response body sent back to the client in chunks.<\/p>\n

Each chuck is then constructed starting with the length of current chunk in hexadecimal, then ‘\\r\\n’, the actual chunk and then finally another ‘\\r\\n’<\/p>\n

Example<\/strong><\/h2>\n

Below shows you can example of a chunked response. Here the chunk length is 0x928 which equals 2344 bytes.<\/p>\n

HTTP\/1.1 200 OK\r\nDate: Thu, 05 Dec 2013 20:13:54 GMT\r\nServer: Server\r\nPragma: no-cache\r\nx-amz-id-1: 1BBZYT3T0FZ8JEAE59MC\r\np3p: policyref=\"http:\/\/www.amazon.co.uk\/w3c\/p3p.xml\",CP=\"CAO<\/a> DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC \"\r\nCache-Control: no-cache\r\nExpires: -1\r\nx-amz-id-2: VIK8CP84Ok1oJo1uxyN8ikt7mZCNNoq4UYNYa\/9BuyXs4hCsu0Uk8dr2nwLjN+k3\r\nVary: Accept-Encoding,User-Agent\r\nContent-Encoding: gzip\r\nContent-Type: text\/html; charset=ISO-8859-1\r\nSet-Cookie: ubid-acbuk=279-2585849-5868911; path=\/; domain=.amazon.co.uk; expires=Tue, 01-Jan-2036 00:00:01 GMT\r\nsession-id-time=2082758401l; path=\/; domain=.amazon.co.uk; expires=Tue, 01-Jan-2036 00:00:01 GMT\r\nsession-id=280-1566970-1360932; path=\/; domain=.amazon.co.uk; expires=Tue, 01-Jan-2036 00:00:01 GMT\r\nTransfer-Encoding: chunked\r\n\r\n928\r\n\r\n <!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\"\r\n\u00a0\u00a0 \"http:\/\/www.w3.org\/TR\/html4\/loose.dtd<\/a>\">\r\n<html>\r\n\u00a0 <head>\r\n\u00a0\u00a0\u00a0 ......(omitted)\r\n\u00a0 <\/head>\r\n<\/html>\r\n<\/pre>\n

 <\/p>\n

References<\/strong><\/h2>\n

http:\/\/www.httpwatch.com\/httpgallery\/chunked\/<\/a>
\n
http:\/\/www.codeproject.com\/Articles\/648526\/All-about-http-chunked-responses<\/a><\/p>\n

 <\/p>\n","protected":false},"excerpt":{"rendered":"

Content-Length The content-length header informs the client of the byte length of the HTTP body. This is typically used for HTTP 1.1 (i.e persistent connections) to ensure the client knows when the current response\/request is complete so that the connection can be reused for further requests. Transfer-Encoding Chunked However in certain cirucumstances the server may … Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"yoast_head":"\nHTTP - What does 'Transfer-Encoding : Chunked' mean? - Fir3net<\/title>\n<meta name=\"description\" content=\"Content-Length The content-length header informs the client of the byte length of the HTTP body. This is typically used for HTTP 1.1 (i.e persistent\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTTP - What does 'Transfer-Encoding : Chunked' mean? - Fir3net\" \/>\n<meta property=\"og:description\" content=\"Content-Length The content-length header informs the client of the byte length of the HTTP body. This is typically used for HTTP 1.1 (i.e persistent\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html\" \/>\n<meta property=\"og:site_name\" content=\"Fir3net\" \/>\n<meta property=\"article:published_time\" content=\"2014-01-01T00:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-01T01:18:17+00:00\" \/>\n<meta name=\"author\" content=\"Rick Donato\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rick Donato\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html\"},\"author\":{\"name\":\"Rick Donato\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037\"},\"headline\":\"HTTP – What does ‘Transfer-Encoding : Chunked’ mean?\",\"datePublished\":\"2014-01-01T00:00:00+00:00\",\"dateModified\":\"2021-08-01T01:18:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html\"},\"wordCount\":178,\"publisher\":{\"@id\":\"https:\/\/www.fir3net.com\/#organization\"},\"articleSection\":[\"Networking Concepts\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html\",\"url\":\"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html\",\"name\":\"HTTP - What does 'Transfer-Encoding : Chunked' mean? - Fir3net\",\"isPartOf\":{\"@id\":\"https:\/\/www.fir3net.com\/#website\"},\"datePublished\":\"2014-01-01T00:00:00+00:00\",\"dateModified\":\"2021-08-01T01:18:17+00:00\",\"description\":\"Content-Length The content-length header informs the client of the byte length of the HTTP body. This is typically used for HTTP 1.1 (i.e persistent\",\"breadcrumb\":{\"@id\":\"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.fir3net.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Networking\",\"item\":\"https:\/\/www.fir3net.com\/networking\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Networking Concepts\",\"item\":\"https:\/\/www.fir3net.com\/networking\/concepts-networking\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"HTTP – What does ‘Transfer-Encoding : Chunked’ mean?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.fir3net.com\/#website\",\"url\":\"https:\/\/www.fir3net.com\/\",\"name\":\"Fir3net\",\"description\":\"Keeping you in the know\",\"publisher\":{\"@id\":\"https:\/\/www.fir3net.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.fir3net.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.fir3net.com\/#organization\",\"name\":\"Fir3net\",\"url\":\"https:\/\/www.fir3net.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png\",\"contentUrl\":\"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png\",\"width\":390,\"height\":88,\"caption\":\"Fir3net\"},\"image\":{\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037\",\"name\":\"Rick Donato\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g\",\"caption\":\"Rick Donato\"},\"description\":\"Rick Donato is a Network Automation Architect\/Evangelist and the founder of Packet Coders.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HTTP - What does 'Transfer-Encoding : Chunked' mean? - Fir3net","description":"Content-Length The content-length header informs the client of the byte length of the HTTP body. This is typically used for HTTP 1.1 (i.e persistent","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html","og_locale":"en_US","og_type":"article","og_title":"HTTP - What does 'Transfer-Encoding : Chunked' mean? - Fir3net","og_description":"Content-Length The content-length header informs the client of the byte length of the HTTP body. This is typically used for HTTP 1.1 (i.e persistent","og_url":"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html","og_site_name":"Fir3net","article_published_time":"2014-01-01T00:00:00+00:00","article_modified_time":"2021-08-01T01:18:17+00:00","author":"Rick Donato","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rick Donato","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html#article","isPartOf":{"@id":"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html"},"author":{"name":"Rick Donato","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037"},"headline":"HTTP – What does ‘Transfer-Encoding : Chunked’ mean?","datePublished":"2014-01-01T00:00:00+00:00","dateModified":"2021-08-01T01:18:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html"},"wordCount":178,"publisher":{"@id":"https:\/\/www.fir3net.com\/#organization"},"articleSection":["Networking Concepts"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html","url":"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html","name":"HTTP - What does 'Transfer-Encoding : Chunked' mean? - Fir3net","isPartOf":{"@id":"https:\/\/www.fir3net.com\/#website"},"datePublished":"2014-01-01T00:00:00+00:00","dateModified":"2021-08-01T01:18:17+00:00","description":"Content-Length The content-length header informs the client of the byte length of the HTTP body. This is typically used for HTTP 1.1 (i.e persistent","breadcrumb":{"@id":"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.fir3net.com\/Networking\/Protocols\/http-what-does-transfer-encoding-chunked-mean.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.fir3net.com\/"},{"@type":"ListItem","position":2,"name":"Networking","item":"https:\/\/www.fir3net.com\/networking"},{"@type":"ListItem","position":3,"name":"Networking Concepts","item":"https:\/\/www.fir3net.com\/networking\/concepts-networking"},{"@type":"ListItem","position":4,"name":"HTTP – What does ‘Transfer-Encoding : Chunked’ mean?"}]},{"@type":"WebSite","@id":"https:\/\/www.fir3net.com\/#website","url":"https:\/\/www.fir3net.com\/","name":"Fir3net","description":"Keeping you in the know","publisher":{"@id":"https:\/\/www.fir3net.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.fir3net.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.fir3net.com\/#organization","name":"Fir3net","url":"https:\/\/www.fir3net.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png","contentUrl":"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png","width":390,"height":88,"caption":"Fir3net"},"image":{"@id":"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037","name":"Rick Donato","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g","caption":"Rick Donato"},"description":"Rick Donato is a Network Automation Architect\/Evangelist and the founder of Packet Coders."}]}},"_links":{"self":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts\/820"}],"collection":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/comments?post=820"}],"version-history":[{"count":0,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts\/820\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/media?parent=820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/categories?post=820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/tags?post=820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}