Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

SELF HOST: Support weak and strong wildcards in URL prefixes #2978

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

SELF HOST: Support weak and strong wildcards in URL prefixes #2978

wants to merge 1 commit into from

Conversation

vradarserver
Copy link

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the Nancy code style guidelines
  • I have provided test coverage for my change (where applicable)

Description

The Nancy.Hosting.Self library supports the rewriting of localhost URIs to wildcard URL prefixes. At the moment the rewrite feature only supports the use of the strong wildcard (http://+:etc).

There are occasions where you want to guarantee that you only pick up requests for which no other application has registered a matching prefix. In order to do this Nancy needs to rewrite the localhost URI using the weak wildcard (http://*:etc).

This pull request adds a new property to HostConfiguration called UseWeakWildcard. The property defaults to false. When it is false behaviour remains unchanged, the strong wildcard is used when deriving URL prefixes from localhost URIs. However, when it is set to true the weak wildcard gets used instead.

There are three new unit tests that show:

  1. If you do nothing then the strong wildcard is used, as per current behaviour.
  2. If you explicitly clear UseWeakWildcard then the strong wildcard is used.
  3. If you set UseWeakWildcard then the weak wildcard is used.

@dnfclas
Copy link

dnfclas commented Sep 7, 2019

CLA assistant check
All CLA requirements met.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants