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

Add missing API: HttpRequest.FilePath #278

Closed
Clounea opened this issue Feb 8, 2023 · 4 comments · Fixed by #285
Closed

Add missing API: HttpRequest.FilePath #278

Clounea opened this issue Feb 8, 2023 · 4 comments · Fixed by #285
Assignees
Milestone

Comments

@Clounea
Copy link
Contributor

Clounea commented Feb 8, 2023

Summary

When I try the IHttpModule and HttpApplication in the adapter, I found that HttpRequest.FilePath is used in my module(in Sharepoint Online) but it is not supported.

Motivation and goals

HttpRequest.FilePath is used in my module(in Sharepoint Online) but it is not supported. I wonder if there is plan to support the API.

In scope

HttpRequest.FilePath

Usage example:

request.FilePath.Contains("/api")
request.FilePath.Contains(".")
request.FilePath.EndsWith(".aspx")

@joperezr
Copy link
Member

joperezr commented Feb 8, 2023

Seems like FilePath is really only looking for the first part of the url with a period that "looks like a file". We can add an adapter that uses the same semantics.

@CZEMacLeod
Copy link
Contributor

@joperezr @twsouthwick This is a pretty naïve implementation - it might pass muster for some use cases, but FilePath and PathInfo are used as part of the handler/endpoint resolution system. If the folder of a file contains a . your result is wrong.
e.g. /files.unsorted/file1.txt
or /v4.8.1/learning/how_does_filepath_work.html
See https://github.com/CZEMacLeod/systemweb-adapters/tree/czemacleod/ihttphandler

@twsouthwick
Copy link
Member

@CZEMacLeod good call. I hadn't realized that - during my tests on framework, I happened to use ".aspx" as the file type so things worked for the naive case. I've switched the current approach to just plumb a feature through to the HttpRequest APIs so the implementation can be added later if/when IHttpHandlers are supported.

btw Are you currently using IHttpHandlers that you have in that branch?

@CZEMacLeod
Copy link
Contributor

Not actively using it no. It was an experiment to see how much would be needed and as a precursor to trying to do a system.web.optimization port.
I think you mentioned having a module/handler branch that used endpoints better than my try so didn't persue it.

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 a pull request may close this issue.

4 participants