use Conversations 1.x.y as user agent string in http upload and download
This commit is contained in:
parent
8d90b3fbf1
commit
5a5e0e7121
|
@ -36,8 +36,8 @@ public abstract class AbstractGenerator {
|
|||
"urn:xmpp:receipts"
|
||||
};
|
||||
private String mVersion = null;
|
||||
public final String IDENTITY_NAME = "Conversations";
|
||||
public final String IDENTITY_TYPE = "phone";
|
||||
protected final String IDENTITY_NAME = "Conversations";
|
||||
protected final String IDENTITY_TYPE = "phone";
|
||||
|
||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
|
||||
|
||||
|
@ -54,7 +54,7 @@ public abstract class AbstractGenerator {
|
|||
return this.mVersion;
|
||||
}
|
||||
|
||||
protected String getIdentityName() {
|
||||
public String getIdentityName() {
|
||||
return IDENTITY_NAME + " " + getIdentityVersion();
|
||||
}
|
||||
|
||||
|
|
|
@ -181,6 +181,7 @@ public class HttpDownloadConnection implements Transferable {
|
|||
changeStatus(STATUS_CHECKING);
|
||||
HttpURLConnection connection = (HttpURLConnection) mUrl.openConnection();
|
||||
connection.setRequestMethod("HEAD");
|
||||
connection.setRequestProperty("User-Agent", mXmppConnectionService.getIqGenerator().getIdentityName());
|
||||
if (connection instanceof HttpsURLConnection) {
|
||||
mHttpConnectionManager.setupTrustManager((HttpsURLConnection) connection, interactive);
|
||||
}
|
||||
|
@ -236,6 +237,7 @@ public class HttpDownloadConnection implements Transferable {
|
|||
if (connection instanceof HttpsURLConnection) {
|
||||
mHttpConnectionManager.setupTrustManager((HttpsURLConnection) connection, interactive);
|
||||
}
|
||||
connection.setRequestProperty("User-Agent",mXmppConnectionService.getIqGenerator().getIdentityName());
|
||||
connection.connect();
|
||||
is = new BufferedInputStream(connection.getInputStream());
|
||||
file.getParentFile().mkdirs();
|
||||
|
|
|
@ -165,6 +165,7 @@ public class HttpUploadConnection implements Transferable {
|
|||
connection.setRequestMethod("PUT");
|
||||
connection.setFixedLengthStreamingMode((int) file.getExpectedSize());
|
||||
connection.setRequestProperty("Content-Type", mime == null ? "application/octet-stream" : mime);
|
||||
connection.setRequestProperty("User-Agent",mXmppConnectionService.getIqGenerator().getIdentityName());
|
||||
connection.setDoOutput(true);
|
||||
connection.connect();
|
||||
os = connection.getOutputStream();
|
||||
|
|
Loading…
Reference in a new issue