Example #1
0
 private static void b(HttpURLConnection httpurlconnection, q q1) {
   byte abyte0[] = q1.p();
   if (abyte0 != null) {
     httpurlconnection.setDoOutput(true);
     httpurlconnection.addRequestProperty("Content-Type", q1.o());
     httpurlconnection = new DataOutputStream(httpurlconnection.getOutputStream());
     httpurlconnection.write(abyte0);
     httpurlconnection.close();
   }
 }
Example #2
0
  static void a(HttpURLConnection httpurlconnection, q q1) {
    switch (q1.a()) {
      default:
        throw new IllegalStateException("Unknown method type.");

      case -1:
        byte abyte0[] = q1.l();
        if (abyte0 != null) {
          httpurlconnection.setDoOutput(true);
          httpurlconnection.setRequestMethod("POST");
          httpurlconnection.addRequestProperty("Content-Type", q1.k());
          httpurlconnection = new DataOutputStream(httpurlconnection.getOutputStream());
          httpurlconnection.write(abyte0);
          httpurlconnection.close();
        }
        return;

      case 0: // '\0'
        httpurlconnection.setRequestMethod("GET");
        return;

      case 3: // '\003'
        httpurlconnection.setRequestMethod("DELETE");
        return;

      case 1: // '\001'
        httpurlconnection.setRequestMethod("POST");
        b(httpurlconnection, q1);
        return;

      case 2: // '\002'
        httpurlconnection.setRequestMethod("PUT");
        b(httpurlconnection, q1);
        return;

      case 4: // '\004'
        httpurlconnection.setRequestMethod("HEAD");
        return;

      case 5: // '\005'
        httpurlconnection.setRequestMethod("OPTIONS");
        return;

      case 6: // '\006'
        httpurlconnection.setRequestMethod("TRACE");
        return;

      case 7: // '\007'
        httpurlconnection.setRequestMethod("PATCH");
        b(httpurlconnection, q1);
        return;
    }
  }
Example #3
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;
  }
Example #4
0
 private HttpURLConnection a(URL url, q q1) {
   HttpURLConnection httpurlconnection = a(url);
   int i = q1.s();
   httpurlconnection.setConnectTimeout(i);
   httpurlconnection.setReadTimeout(i);
   httpurlconnection.setUseCaches(false);
   httpurlconnection.setDoInput(true);
   if ("https".equals(url.getProtocol()) && b != null) {
     ((HttpsURLConnection) httpurlconnection).setSSLSocketFactory(b);
   }
   return httpurlconnection;
 }