Commit 880099c8 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer 🎼
Browse files

use UserAgent defined in the app

parent 00ced4ed
# [/e/ NC/Dav Android Library](https://e.foundation/)
# ~~[Nextcloud](https://nextcloud.com) Android Library~~ [![Build Status](https://drone.nextcloud.com/api/badges/nextcloud/android-library/status.svg)](https://drone.nextcloud.com/nextcloud/android-library) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d9f94f04e0f447a6b21c0ae08f6f7594)](https://www.codacy.com/app/Nextcloud/android-library?utm_source=github.com&utm_medium=referral&utm_content=nextcloud/android-library&utm_campaign=Badge_Grade)
~~[Nextcloud](https://nextcloud.com) Android Library~~ [![Build Status](https://drone.nextcloud.com/api/badges/nextcloud/android-library/status.svg)](https://drone.nextcloud.com/nextcloud/android-library) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d9f94f04e0f447a6b21c0ae08f6f7594)](https://www.codacy.com/app/Nextcloud/android-library?utm_source=github.com&utm_medium=referral&utm_content=nextcloud/android-library&utm_campaign=Badge_Grade)
## Introduction
Using Nextcloud Android library it will be the easiest way to communicate with Nextcloud servers.
......
......@@ -204,19 +204,6 @@ public class OwnCloudClient extends HttpClient {
}
}
/**
* Requests the received method.
*
* Executes the method through the inherited HttpClient.executedMethod(method).
*
* @param method HTTP method request.
*/
@Override
public int executeMethod(HttpMethod method) throws IOException{
return executeMethod(method,
mUseNextcloudUserAgent ? OwnCloudClientManagerFactory.getNextcloudUserAgent() : OwnCloudClientManagerFactory.getUserAgent());
}
/**
* Requests the received method.
*
......@@ -224,9 +211,8 @@ public class OwnCloudClient extends HttpClient {
* With the specified userAgent
*
* @param method HTTP method request.
* @param userAgent value of user agent parameters.
*/
public int executeMethod(HttpMethod method, String userAgent) throws IOException {
public int executeMethod(HttpMethod method) throws IOException {
try {
// Update User Agent
HttpParams params = method.getParams();
......@@ -237,6 +223,7 @@ public class OwnCloudClient extends HttpClient {
} else {
userAgent = OwnCloudClientManagerFactory.getUserAgent();
}*/
String userAgent = OwnCloudClientManagerFactory.getUserAgent();
params.setParameter(HttpMethodParams.USER_AGENT, userAgent);
Log_OC.d(TAG + " #" + mInstanceNumber, "REQUEST " +
......
......@@ -92,7 +92,7 @@ public class CreateFolderRemoteOperation extends RemoteOperation {
try {
mkCol = new MkColMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath));
client.setUseNextcloudUserAgent(true);
client.setUseNextcloudUserAgent(false);
client.executeMethod(mkCol, READ_TIMEOUT, CONNECTION_TIMEOUT);
if (HttpStatus.SC_METHOD_NOT_ALLOWED == mkCol.getStatusCode()) {
......
......@@ -85,7 +85,7 @@ public class LightReadFolderRemoteOperation extends RemoteOperation {
protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result = null;
PropFindMethod propfind = null;
String userAgent ="";
//String userAgent ="";
try {
// remote request
if(allowGzip){
......@@ -93,14 +93,14 @@ public class LightReadFolderRemoteOperation extends RemoteOperation {
WebdavUtils.getMinimumPropSet(), // PropFind Properties
this.depth);
propfind.setRequestHeader("Accept-Encoding", "gzip");
userAgent = "gzipUserAgent";
//userAgent = "gzipUserAgent";
}else{
propfind = new PropFindMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath),
WebdavUtils.getAllPropSet(), // PropFind Properties
this.depth);
}
int status = client.executeMethod(propfind, userAgent);
int status = client.executeMethod(propfind/*, userAgent*/);
// check and process response
boolean isSuccess = (status == HttpStatus.SC_MULTI_STATUS || status == HttpStatus.SC_OK);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment