Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Parameters Without Values in IOwinRequest.Query Dictionary #540

Open
chupAkabRRa opened this issue Sep 19, 2024 · 0 comments
Open

Comments

@chupAkabRRa
Copy link

Description

While creating a custom LoggingMiddleware, we encountered an issue where parameters without a value are not included in the IOwinRequest.Query dictionary. Our use case requires logging all parameters passed to our service, but parameters with no associated value and no "=" sign (e.g., ?param) are omitted from the query dictionary.

To resolve this, we had to manually parse the QueryString. This behavior is not explicitly documented, and it was unexpected.

Proposed Fix

I believe the issue lies in the ParseDelimited() method in src/Microsoft.Owin/Infrastructure/OwinHelpers.cs. The following check:

if (equalIndex < delimiterIndex)

ignores the possibility of parsing parameters without a corresponding value.

Steps to Reproduce

  1. Create a middleware that inspects the IOwinRequest.Query dictionary.
  2. Send a request with a query string containing parameters without values and without "=" sign (e.g., ?param1=1&param2).
  3. Notice that param2 is missing from the Query dictionary.
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

No branches or pull requests

1 participant