1
0
mirror of https://github.com/etesync/android synced 2024-11-22 07:58:09 +00:00

don't follow redirects (see issue #52)

This commit is contained in:
rfc2822 2013-10-30 17:20:04 +01:00
parent dbc89cb4fe
commit a45aed6914
2 changed files with 11 additions and 3 deletions

View File

@ -246,7 +246,7 @@ public class LocalCalendar extends LocalCollection<Event> {
try {
e.setOrganizer(new Organizer("mailto:" + cursor.getString(15)));
} catch (URISyntaxException ex) {
Log.e(TAG, "Error parsing organizer email address, ignoring");
Log.e(TAG, "Error parsing organizer URI, ignoring");
}
Uri attendeesUri = Attendees.CONTENT_URI.buildUpon()

View File

@ -32,12 +32,14 @@ import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpOptions;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.params.ClientPNames;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.EnglishReasonPhraseCatalog;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.CoreProtocolPNames;
import android.util.Log;
import at.bitfire.davdroid.Constants;
@ToString
@ -71,18 +73,24 @@ public class WebDavResource {
if (isCollection && !location.getPath().endsWith("/"))
location = new URI(location.getScheme(), location.getSchemeSpecificPart() + "/", null);
// create new HTTP client
client = new DefaultHttpClient();
client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "DAVdroid/" + Constants.APP_VERSION);
// authenticate
client.getCredentialsProvider().setCredentials(new AuthScope(location.getHost(), location.getPort()),
new UsernamePasswordCredentials(username, password));
// preemptive auth is available for Basic auth only
if (preemptive) {
Log.i(TAG, "Using preemptive Basic Authentication");
client.addRequestInterceptor(new PreemptiveAuthInterceptor(), 0);
}
client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "DAVdroid");
// allow gzip compression
GzipDecompressingEntity.enable(client);
// redirections
client.getParams().setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, false);
}
protected WebDavResource(WebDavCollection parent, URI uri) {