Skip to content

Commit

Permalink
Use default redirect strategy handling PROPFIND just fine.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Jan 10, 2025
1 parent 2c632d8 commit f9fe96d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 57 deletions.
14 changes: 8 additions & 6 deletions src/main/java/com/github/sardine/impl/SardineImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.cookie.CookieSpecFactory;
import org.apache.hc.client5.http.entity.GzipDecompressingEntity;
import org.apache.hc.client5.http.impl.DefaultRedirectStrategy;
import org.apache.hc.client5.http.impl.DefaultSchemePortResolver;
import org.apache.hc.client5.http.impl.auth.BasicAuthCache;
import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
Expand All @@ -47,6 +48,7 @@
import org.apache.hc.client5.http.impl.routing.SystemDefaultRoutePlanner;
import org.apache.hc.client5.http.io.HttpClientConnectionManager;
import org.apache.hc.client5.http.protocol.HttpClientContext;
import org.apache.hc.client5.http.protocol.RedirectStrategy;
import org.apache.hc.client5.http.routing.HttpRoutePlanner;
import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
import org.apache.hc.client5.http.socket.PlainConnectionSocketFactory;
Expand Down Expand Up @@ -1100,7 +1102,7 @@ protected <T> T execute(HttpClientContext context, HttpUriRequestBase request, H
Integer httpMajorVersion = (Integer) context.getAttribute(HTTP_MAJOR_VERSION);

if (httpMajorVersion != null){
request.setVersion(new ProtocolVersion("HTTP", httpMajorVersion, 0));
request.setVersion(new ProtocolVersion("HTTP", httpMajorVersion, 0));
}
HttpContext requestLocalContext = new BasicHttpContext(context);
try
Expand Down Expand Up @@ -1154,7 +1156,7 @@ protected HttpClientBuilder configure(ProxySelector selector, CredentialsProvide
return HttpClients.custom()
.setUserAgent("Sardine/" + version)
.setDefaultCredentialsProvider(credentials)
// .setRedirectStrategy(this.createDefaultRedirectStrategy())
.setRedirectStrategy(this.createDefaultRedirectStrategy())
.setDefaultRequestConfig(RequestConfig.custom()
// Only selectively enable this for PUT but not all entity enclosing methods
.setExpectContinueEnabled(false).build())
Expand All @@ -1167,10 +1169,10 @@ protected DefaultSchemePortResolver createDefaultSchemePortResolver()
return new DefaultSchemePortResolver();
}

// protected SardineRedirectStrategy createDefaultRedirectStrategy()
// {
// return new SardineRedirectStrategy();
// }
protected RedirectStrategy createDefaultRedirectStrategy()
{
return new DefaultRedirectStrategy();
}

/**
* Creates a new registry for default ports with socket factories.
Expand Down
51 changes: 0 additions & 51 deletions src/main/java/com/github/sardine/impl/SardineRedirectStrategy.java

This file was deleted.

0 comments on commit f9fe96d

Please sign in to comment.