示例#1
0
  public HttpResponse a(q q1, Map map) {
    String s = q1.c();
    HashMap hashmap = new HashMap();
    hashmap.putAll(q1.h());
    hashmap.putAll(map);
    if (a != null) {
      String s1 = a.a(s);
      map = s1;
      if (s1 == null) {
        throw new IOException(
            (new StringBuilder()).append("URL blocked by rewriter: ").append(s).toString());
      }
    } else {
      map = s;
    }
    map = a(new URL(map), q1);
    String s2;
    for (Iterator iterator = hashmap.keySet().iterator();
        iterator.hasNext();
        map.addRequestProperty(s2, (String) hashmap.get(s2))) {
      s2 = (String) iterator.next();
    }

    a(((HttpURLConnection) (map)), q1);
    q1 = new ProtocolVersion("HTTP", 1, 1);
    if (map.getResponseCode() == -1) {
      throw new IOException("Could not retrieve response code from HttpUrlConnection.");
    }
    q1 =
        new BasicHttpResponse(
            new BasicStatusLine(q1, map.getResponseCode(), map.getResponseMessage()));
    q1.setEntity(a(((HttpURLConnection) (map))));
    map = map.getHeaderFields().entrySet().iterator();
    do {
      if (!map.hasNext()) {
        break;
      }
      java.util.Map.Entry entry = (java.util.Map.Entry) map.next();
      if (entry.getKey() != null) {
        q1.addHeader(
            new BasicHeader((String) entry.getKey(), (String) ((List) entry.getValue()).get(0)));
      }
    } while (true);
    return q1;
  }