don't follow redirects (see issue #52)

pull/2/head
rfc2822 11 years ago
parent dbc89cb4fe
commit a45aed6914

@ -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()

@ -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) {

Loading…
Cancel
Save