{"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":"
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 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 Below shows you can example of a chunked response. Here the chunk length is 0x928 which equals 2344 bytes.<\/p>\n <\/p>\n http:\/\/www.httpwatch.com\/httpgallery\/chunked\/<\/a> <\/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":"\nTransfer-Encoding Chunked<\/strong><\/h2>\n
Example<\/strong><\/h2>\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
References<\/strong><\/h2>\n
\nhttp:\/\/www.codeproject.com\/Articles\/648526\/All-about-http-chunked-responses<\/a><\/p>\n