From 1fee27e582e9ad9981dd54adad6d47f18a1aae4d Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Fri, 23 Jul 2010 12:45:33 -0700 Subject: fix -http-proxy implementation to work correctly with chunked encoding. Change-Id: I3d8a18bd0849c75d0133b234a8aa74069ad71baa --- CHANGES.TXT | 3 +++ android/qemu-setup.c | 6 ++++++ proxy/proxy_http_rewriter.c | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/CHANGES.TXT b/CHANGES.TXT index bbf1de2..fda6476 100644 --- a/CHANGES.TXT +++ b/CHANGES.TXT @@ -41,6 +41,9 @@ OTHER: - Fix net shaping regression: -netspeed and -netdelay did not work anymore. +- Fix -http-proxy implementation to properly work with chunked encodings. + Also accept strings like "http://:8080" as a valid proxy address. + ============================================================================== Changes between 6.0 and 5.0 diff --git a/android/qemu-setup.c b/android/qemu-setup.c index 0b6b564..4f05c24 100644 --- a/android/qemu-setup.c +++ b/android/qemu-setup.c @@ -422,6 +422,12 @@ void android_emulation_setup( void ) proxy_name_len = p - env; proxy_port = atoi(p+1); + /* handle the rare case where the proxy name is omitted, e.g. "http://:8080" */ + if (proxy_name_len == 0) { + proxy_name = "localhost"; + proxy_name_len = strlen(proxy_name); + } + D( "setting up http proxy: server=%.*s port=%d", proxy_name_len, proxy_name, proxy_port ); diff --git a/proxy/proxy_http_rewriter.c b/proxy/proxy_http_rewriter.c index afd929c..7645ecc 100644 --- a/proxy/proxy_http_rewriter.c +++ b/proxy/proxy_http_rewriter.c @@ -751,6 +751,12 @@ rewrite_connection_read_body( RewriteConnection* conn, int fd ) root->name, length); return DATA_ERROR; } + /* proxy_connection_receive_line() did remove the + * trailing \r\n, but we must preserve it when we + * send the chunk size to the proxy. + */ + stralloc_add_str(root->str, "\r\n"); + conn->chunk_length = length; conn->chunk_total = 0; if (length == 0) { -- cgit v1.1