Esempio n. 1
0
 private Downloader getDownloader(DownloadRequest request) {
   if (URLUtil.isHttpUrl(request.getSource()) || URLUtil.isHttpsUrl(request.getSource())) {
     return new HttpDownloader(request);
   }
   Log.e(TAG, "Could not find appropriate downloader for " + request.getSource());
   return null;
 }
Esempio n. 2
0
 public static int a(Context paramContext, JSONObject paramJSONObject, boolean paramBoolean)
 {
   String str1 = ac.a(2);
   if (!URLUtil.isHttpUrl(str1))
   {
     x.f();
     return -1;
   }
   HttpPost localHttpPost = new HttpPost(str1);
   BasicHttpParams localBasicHttpParams = new BasicHttpParams();
   HttpConnectionParams.setConnectionTimeout(localBasicHttpParams, 30000);
   HttpConnectionParams.setSoTimeout(localBasicHttpParams, 30000);
   DefaultHttpClient localDefaultHttpClient = new DefaultHttpClient(localBasicHttpParams);
   if (paramContext.getPackageManager().checkPermission(z[25], paramContext.getPackageName()) == 0)
   {
     NetworkInfo localNetworkInfo = ((ConnectivityManager)paramContext.getSystemService(z[30])).getActiveNetworkInfo();
     if ((localNetworkInfo != null) && (localNetworkInfo.getType() != 1))
     {
       String str5 = localNetworkInfo.getExtraInfo();
       if ((str5 != null) && ((str5.equals(z[22])) || (str5.equals(z[19])) || (str5.equals(z[33])))) {
         localDefaultHttpClient.getParams().setParameter(z[34], new HttpHost(z[24], 80));
       }
     }
   }
   String str2 = "";
   if (paramJSONObject != null) {
     str2 = paramJSONObject.toString();
   }
   if (ai.a(str2))
   {
     x.c();
     return -2;
   }
   localHttpPost.addHeader(z[28], z[31]);
   localHttpPost.addHeader(z[26], z[21]);
   localHttpPost.addHeader(z[35], z[21]);
   localHttpPost.addHeader(z[23], a.v(paramContext));
   String str3;
   int i;
   if (str2 == null)
   {
     str3 = ac.a(paramContext);
     if (!ai.a(str3)) {
       break label343;
     }
     x.c();
     i = 0;
   }
   for (;;)
   {
     if (i != 0) {
       break label405;
     }
     x.c();
     return -3;
     str3 = ac.a(paramContext, str2, 2);
     break;
     label343:
     String str4 = ac.b(str3);
     if (ai.a(str4))
     {
       x.c();
       i = 0;
     }
     else
     {
       localHttpPost.addHeader(z[29], z[32] + str4);
       i = 1;
     }
   }
   try
   {
     label405:
     byte[] arrayOfByte1 = str2.getBytes(z[10]);
     ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
     GZIPOutputStream localGZIPOutputStream = new GZIPOutputStream(localByteArrayOutputStream);
     localGZIPOutputStream.write(arrayOfByte1);
     localGZIPOutputStream.close();
     byte[] arrayOfByte2 = localByteArrayOutputStream.toByteArray();
     localByteArrayOutputStream.close();
     ByteArrayEntity localByteArrayEntity = new ByteArrayEntity(arrayOfByte2);
     localByteArrayEntity.setContentEncoding(z[21]);
     localHttpPost.setEntity(localByteArrayEntity);
     try
     {
       int j = localDefaultHttpClient.execute(localHttpPost).getStatusLine().getStatusCode();
       new StringBuilder(z[20]).append(j).toString();
       x.c();
       switch (j)
       {
       default: 
         if (j / 100 == 5) {
           return 500;
         }
       case 401: 
         x.e();
         return 401;
       case 404: 
         return 404;
       case 429: 
         return 429;
         return -5;
       }
     }
     catch (ClientProtocolException localClientProtocolException)
     {
       new StringBuilder(z[27]).append(localClientProtocolException.getMessage()).toString();
       x.f();
       return -1;
     }
     catch (IOException localIOException2)
     {
       for (;;)
       {
         new StringBuilder(z[36]).append(localIOException2.getMessage()).toString();
         x.f();
       }
     }
     return 200;
   }
   catch (UnsupportedEncodingException localUnsupportedEncodingException)