Index: libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java |
diff --git a/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java b/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java |
index 6796cd076d45eb8da866a989f02d6362df3756aa..0b106be59ce6cc7d7dd4e97dfe0890e9091fc9e7 100644 |
--- a/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java |
+++ b/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java |
@@ -22,7 +22,9 @@ import java.io.InputStreamReader; |
import java.net.HttpURLConnection; |
import java.net.URL; |
import java.util.HashSet; |
+import java.util.LinkedList; |
import java.util.List; |
+import java.util.Map; |
import org.adblockplus.libadblockplus.AdblockPlusException; |
import org.adblockplus.libadblockplus.FilterEngine; |
@@ -124,10 +126,26 @@ public class AndroidWebRequest extends WebRequest |
} |
} |
- connection.disconnect(); |
- |
response.setStatus(NsStatus.OK); |
response.setResponse(sb.toString()); |
+ |
+ if (connection.getHeaderFields().size() > 0) |
+ { |
+ List<HeaderEntry> responseHeaders = new LinkedList<HeaderEntry>(); |
+ for (Map.Entry<String, List<String>> eachEntry : connection.getHeaderFields().entrySet()) |
+ { |
+ for (String eachValue : eachEntry.getValue()) |
+ { |
+ if (eachEntry.getKey() != null && eachValue != null) |
+ { |
+ responseHeaders.add(new HeaderEntry(eachEntry.getKey(), eachValue)); |
+ } |
+ } |
+ } |
+ response.setReponseHeaders(responseHeaders); |
+ } |
+ |
+ connection.disconnect(); |
} |
else |
{ |