You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I put this up as I encountered a web page, whos content was sliced into chunks. This comes with HTTP/1.1 and its header "Transfer-Encoding: chunked". The chunks start with a hexadecimal number for their size and a "0" for the last chunk. With "echo $this->get(..);" you will see them. Chunks and HTTP/1.1 is a general behaviour these days.
Simpletest uses "GET /mypage.php HTTP/1.0" in http.php telling a server it will not understand the "Transfer-Encoding: chunked" header. That is why I should NOT have seen any chunked content.
I tested with 5 servers today. Two of them sent me chunked content. As I am not into (Apache) server configuration I cannot say much to why it was not handled. https://httpd.apache.org/docs/2.2/de/env.html
One can always set the "Content-Lenght: 1234" header in the application itself, which whould prevent servers (e.g. Apache) from chunking.
I'm not sure, if we can override it by setting an additional header.
You are right, in the long run, we need to change this to 1.1 and
adjust the Socket class to evaluate the return header ['transfer-encoding'] == 'chunked'
and handle and return the chunked content properly.
Kind of re-assembling or glueing the stream of chunked data into a whole piece again.
The function from SO is helpful. Thank you for that.
I put this up as I encountered a web page, whos content was sliced into chunks. This comes with HTTP/1.1 and its header "Transfer-Encoding: chunked". The chunks start with a hexadecimal number for their size and a "0" for the last chunk. With "echo $this->get(..);" you will see them. Chunks and HTTP/1.1 is a general behaviour these days.
Simpletest uses "GET /mypage.php HTTP/1.0" in http.php telling a server it will not understand the "Transfer-Encoding: chunked" header. That is why I should NOT have seen any chunked content.
I tested with 5 servers today. Two of them sent me chunked content. As I am not into (Apache) server configuration I cannot say much to why it was not handled.
https://httpd.apache.org/docs/2.2/de/env.html
One can always set the "Content-Lenght: 1234" header in the application itself, which whould prevent servers (e.g. Apache) from chunking.
Another way is to enable Simpletest to handle HTTP/1.1 protocol. That may be more an effort than just the chunked content. Here is some info about how much work it is to dechunk:
http://stackoverflow.com/questions/10793017/how-to-easily-decode-http-chunked-encoded-string-when-making-raw-http-request
I guess in the very long run Simplettest cannot stay with HTTP/1.0. So its about selecting information already about how to go that way.
The text was updated successfully, but these errors were encountered: