From 64b9fdf2ad2cc74bdc807165285a68149d82811f Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Tue, 1 Oct 2013 13:50:11 -0700 Subject: Stream Proxy parses all headers --- src/github/daneren2005/dsub/service/StreamProxy.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/github/daneren2005/dsub/service/StreamProxy.java b/src/github/daneren2005/dsub/service/StreamProxy.java index 76d8382c..0b269de6 100644 --- a/src/github/daneren2005/dsub/service/StreamProxy.java +++ b/src/github/daneren2005/dsub/service/StreamProxy.java @@ -103,9 +103,10 @@ public class StreamProxy implements Runnable { HttpRequest request = null; InputStream is; String firstLine; + BufferedReader reader = null; try { is = client.getInputStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(is), 8192); + reader = new BufferedReader(new InputStreamReader(is), 8192); firstLine = reader.readLine(); } catch (IOException e) { Log.e(TAG, "Error parsing request", e); @@ -123,6 +124,19 @@ public class StreamProxy implements Runnable { String realUri = uri.substring(1); Log.i(TAG, realUri); request = new BasicHttpRequest(method, realUri); + + // Get all of the headers + try { + String line; + while(line = reader.readLine() && !"".equals(line)) { + String headerName = line.substring(0, line.indexOf(':')); + String headerValue = line.substring(line.indexOf(': ') + 2); + request.addHeader(headerName, headerValue); + } + } catch(IOException e) { + // Don't really care once past first line + } + return request; } -- cgit v1.2.3