Skip to content

Commit

Permalink
webdav: preserve request URL in protocol info
Browse files Browse the repository at this point in the history
Motivation:
When http request redirected to a pool, then new location contains the
dcache internally resolved file path, which doesn't match the prefix
anymore. Thus if a pool redirects a client back, then client will get
404.

Modification:
Update HttpTransfer#createProtocolInfo to use the original request path
then creating ProtocolInfo

Result:
correct behaviour on redirect with prefix.

Ticket: #10446
Acked-by: Paul Millar
Target: master, 9.0, 8.2
Require-book: no
Require-notes: yes
(cherry picked from commit 8a4273f)
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
  • Loading branch information
kofemann authored and lemora committed Apr 15, 2023
1 parent 0db4aed commit 21c8870
Showing 1 changed file with 9 additions and 3 deletions.
Expand Up @@ -1543,14 +1543,20 @@ private class HttpTransfer extends RedirectedTransfer<String> {
protected HttpProtocolInfo.Disposition _disposition;
private boolean _isSSL;

/**
* The original request path that will be passed to pool for fall-back redirect.
*/
private final String _requestPath;

public HttpTransfer(PnfsHandler pnfs, Subject subject,
Restriction restriction, FsPath path) throws URISyntaxException {
super(pnfs, subject, restriction, path);
initializeTransfer(this, subject);
_clientAddressForPool = getClientAddress();

ServletRequest.getRequest().setAttribute(TRANSACTION_ATTRIBUTE,
getTransaction());
var request = ServletRequest.getRequest();
request.setAttribute(TRANSACTION_ATTRIBUTE, getTransaction());
_requestPath = ServletRequest.stripToPath(request.getRequestURI());
}

protected ProtocolInfo createProtocolInfo(InetSocketAddress address) {
Expand All @@ -1561,7 +1567,7 @@ protected ProtocolInfo createProtocolInfo(InetSocketAddress address) {
PROTOCOL_INFO_MINOR_VERSION,
address,
getCellName(), getCellDomainName(),
_path.toString(),
_requestPath,
_location,
_disposition,
_wantedChecksum);
Expand Down

0 comments on commit 21c8870

Please sign in to comment.