Skip to content

Conversation

@ricksbrown
Copy link
Contributor

Purpose of changes

This change allows Webdrivermanager to use Nexus Repository Manager 3 raw repositories as a download mirror.

Problem
We use Nexus Repository Manager as mirror for our webdrivers. The behavior of Nexus is different - the directory listings come from a REST url, for example we set this:
wdm.chromeDriverMirrorUrl=http://nexus.example.com/nexus/service/rest/repository/browse/mirror/chromedriver/

Which gives us links that point somewhere else on the Nexus instance, e.g. this:
http://nexus.example.com/repository/mirror/chromedriver/2.40/chromedriver_linux64.zip

Because the driver URL does not startsWith mirror URL Webdrivermanager refuses to follow these links.

Solution
There were three choices (I have currently chosen Option 2), all affecting this line of code:

} else if (link.startsWith(driverStr) && !link.contains("icons")
  1. Simply remove the "startsWith" check completely, I was very tempted to go this option. Does it matter where the driver binary is located? The code would become this:
} else if (!link.contains("icons")
  1. Do a "same origin" check on the URL. While I do not know why these links are checked, if it is for the purposes of security then this ought to suffice.
} else if (link.startsWith(driverOrigin) && !link.contains("icons")
  1. Leave the behavior as is but put the behavior of Option 1 behind a flag, something like this:
} else if ((config.isAvoidOriginCheck() || link.startsWith(driverStr)) && !link.contains("icons")

If you'd prefer me to update the PR with any of the alternate options let me know.

Types of changes

  • Bug-fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How has this been tested?

I have tested this against our Nexus Repository Manager instance and also against the taobao mirror which continues to work as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants