Http method selectable
This commit is contained in:
parent
1b8dc5de5f
commit
3f76813e80
@ -674,7 +674,7 @@ public class Action
|
||||
Miscellaneous.logEvent("i", "HTTP", "Attempting download of " + url, 4); //getResources().getString("attemptingDownloadOf");
|
||||
|
||||
if(this.getParameter1()) // use authentication
|
||||
new DownloadTask().execute(url, username, password, methodnochindiesignaturaufnehmen);
|
||||
new DownloadTask().execute(url, username, password, method);
|
||||
else
|
||||
new DownloadTask().execute(url, null, null);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class AsyncTasks
|
||||
|
||||
try
|
||||
{
|
||||
String result = Miscellaneous.downloadURL("https://server47.de/automation/?action=getLatestVersionCode", null, null).trim();
|
||||
String result = Miscellaneous.downloadURL("https://server47.de/automation/?action=getLatestVersionCode", null, null, ActivityManageActionTriggerUrl.methodGet).trim();
|
||||
int latestVersion = Integer.parseInt(result);
|
||||
|
||||
// At this point the update check itself has already been successful.
|
||||
|
@ -48,6 +48,7 @@ import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpPut;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.params.BasicHttpParams;
|
||||
@ -181,9 +182,7 @@ public class Miscellaneous extends Service
|
||||
|
||||
public static String downloadURLwithoutCertificateChecking(String url, String username, String password, String method)
|
||||
{
|
||||
boolean errorFound = false;
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
HttpParams params = new BasicHttpParams();
|
||||
params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
|
||||
@ -191,23 +190,23 @@ public class Miscellaneous extends Service
|
||||
HttpClient httpclient = new DefaultHttpClient(params);
|
||||
httpclient = Actions.getInsecureSslClient(httpclient);
|
||||
|
||||
HttpEntityEnclosingRequestBase httpRequest;
|
||||
switch (method)
|
||||
{
|
||||
case ActivityManageActionTriggerUrl.methodPost:
|
||||
httpRequest = new HttpPost(url);
|
||||
break;
|
||||
case ActivityManageActionTriggerUrl.methodGet:
|
||||
default:
|
||||
httpRequest = new HttpEntityEnclosingRequestBase()
|
||||
HttpRequestBase httpRequest;
|
||||
if(
|
||||
method.equals(ActivityManageActionTriggerUrl.methodPost)
|
||||
||
|
||||
(username != null && password != null)
|
||||
)
|
||||
httpRequest = new HttpPost(url);
|
||||
else
|
||||
httpRequest = new HttpGet(url);
|
||||
/*httpRequest = new HttpEntityEnclosingRequestBase()
|
||||
{
|
||||
@Override
|
||||
public String getMethod()
|
||||
{
|
||||
@Override
|
||||
public String getMethod()
|
||||
{somethingMissing
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
return "GET";
|
||||
}
|
||||
};*/
|
||||
|
||||
// Add http simple authentication if specified
|
||||
if(username != null && password != null)
|
||||
@ -227,8 +226,7 @@ public class Miscellaneous extends Service
|
||||
catch(Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "HTTP error", Log.getStackTraceString(e), 3);
|
||||
errorFound = true;
|
||||
return "httpError";
|
||||
return "httpError";
|
||||
}
|
||||
// finally
|
||||
// {
|
||||
|
@ -79,7 +79,7 @@ public class News
|
||||
if (!(new File(filePath)).exists() || Settings.lastNewsPolltime == Settings.default_lastNewsPolltime || now.getTimeInMillis() >= Settings.lastNewsPolltime + (long)(Settings.newsDisplayForXDays * 24 * 60 * 60 * 1000))
|
||||
{
|
||||
String newsUrl = "https://server47.de/automation/appNews.php";
|
||||
newsContent = Miscellaneous.downloadURL(newsUrl, null, null);
|
||||
newsContent = Miscellaneous.downloadURL(newsUrl, null, null, ActivityManageActionTriggerUrl.methodGet);
|
||||
|
||||
// Cache content to local storage
|
||||
if(Miscellaneous.writeStringToFile(filePath, newsContent))
|
||||
|
@ -1,2 +1,3 @@
|
||||
* Fixed: Overlay permission for start other program action only required if startByActivity() is selected
|
||||
* Fixed: Broadcast receiver trigger would not trigger anything, but crash
|
||||
* Added: One can now choose between GET and POST when using triggerURL action
|
Loading…
Reference in New Issue
Block a user