aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-10-01 13:50:11 -0700
committerdaneren2005 <daneren2005@gmail.com>2013-10-01 13:50:11 -0700
commit64b9fdf2ad2cc74bdc807165285a68149d82811f (patch)
tree43edb84db318759c10ebdeca7c3bdb3f89c43992 /src/github/daneren2005
parent7d376801e8fd5b8274a7386006b55b5dc5767f77 (diff)
downloaddsub-64b9fdf2ad2cc74bdc807165285a68149d82811f.tar.gz
dsub-64b9fdf2ad2cc74bdc807165285a68149d82811f.tar.bz2
dsub-64b9fdf2ad2cc74bdc807165285a68149d82811f.zip
Stream Proxy parses all headers
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r--src/github/daneren2005/dsub/service/StreamProxy.java16
1 files changed, 15 insertions, 1 deletions
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;
}