Index: libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java |
=================================================================== |
--- a/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java |
+++ b/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java |
@@ -17,17 +17,19 @@ |
package org.adblockplus.android; |
import java.io.BufferedReader; |
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; |
import org.adblockplus.libadblockplus.HeaderEntry; |
import org.adblockplus.libadblockplus.ServerResponse; |
import org.adblockplus.libadblockplus.ServerResponse.NsStatus; |
import org.adblockplus.libadblockplus.WebRequest; |
@@ -119,20 +121,31 @@ |
int character; |
while ((character = reader.read()) != -1) |
{ |
sb.append((char) character); |
} |
} |
- connection.disconnect(); |
- |
response.setStatus(NsStatus.OK); |
response.setResponse(sb.toString()); |
+ |
+ // headers |
René Jeschke
2016/07/12 16:05:09
This comment can be removed.
anton
2016/07/13 06:31:19
Acknowledged.
|
+ if (connection.getHeaderFields().size() > 0) { |
René Jeschke
2016/07/12 16:05:09
Please pay attention to our coding style. Opening
anton
2016/07/13 06:31:19
Acknowledged.
|
+ List<HeaderEntry> responseHeaders = new LinkedList<HeaderEntry>(); |
+ for (Map.Entry<String, List<String>> eachEntry : |
René Jeschke
2016/07/12 16:05:09
Please pay attention to indentation, this line (an
anton
2016/07/13 06:31:19
Acknowledged.
|
+ 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 |
{ |
response.setStatus(NsStatus.ERROR_FAILURE); |
} |
return response; |
} |
catch (final Throwable t) |