Skip to content

Commit

Permalink
Set a fixed_8 encoding on the socket, since we need to be able to rea…
Browse files Browse the repository at this point in the history
…d something without throwing exceptions. Add in some loop logic to the chunked encoding to make sure we can read large chunks
  • Loading branch information
Whiteknight committed Jun 28, 2012
1 parent d770c23 commit 4897e48
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/net/protocol/Http.winxed
Expand Up @@ -56,6 +56,7 @@ class Rosella.Net.Protocol.Http : Rosella.Net.Protocol
{
:(string host, int port, string fullpath) = Rosella.Net.Http.get_host_information(request, request.get_proxy(), user_agent);
var socket = self.__get_socket(host, port, user_agent);
socket.encoding("fixed_8");

if (!self.__send_request(socket, request, fullpath, user_agent))
return Rosella.Net.Http.Response.__error_network_failure(request);
Expand Down Expand Up @@ -178,8 +179,11 @@ class Rosella.Net.Protocol.Http : Rosella.Net.Protocol
int chunk_length = Rosella.String.to_integer(line, 16);
if (chunk_length == 0)
break;
string raw = socket.read(chunk_length);
push(buf, raw);
while (chunk_length > 0) {
string raw = socket.read(chunk_length);
chunk_length -= length(raw);
push(buf, raw);
}
socket.readline();
user_agent.request_progress_tick();
}
Expand Down

0 comments on commit 4897e48

Please sign in to comment.