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 support for custom headers #9

Open
sbluhm opened this issue Sep 19, 2020 · 3 comments
Open

Add support for custom headers #9

sbluhm opened this issue Sep 19, 2020 · 3 comments

Comments

@sbluhm
Copy link
Contributor

sbluhm commented Sep 19, 2020

Users might need custom headers. Especially, if you want to allow CORS. For example:
Access-Control-Allow-Origin: 'https://www.example.com'
Access-Control-Allow-Headers: 'cache-control'

This could be included in the server section of the config.xml

@couling
Copy link
Owner

couling commented Sep 20, 2020

This seems like a reasonable request. Is it acceptable for your purposes to add these headers to every response (error or success, GET, PUT or OPTIONS?)

@sbluhm
Copy link
Contributor Author

sbluhm commented Sep 21, 2020

This is how I approached it. Making sure/disclaiming the headers are ALWAYS injected on a per-server basis.

I have done it for both legs of the first "if" statement of sendResponse:
https://github.com/sbluhm/WebDAV-Daemon/blob/CustomHeaders/webdavd.c#L1589
https://github.com/sbluhm/WebDAV-Daemon/blob/CustomHeaders/webdavd.c#L1628
Would there be a better place?

@sbluhm
Copy link
Contributor Author

sbluhm commented Sep 21, 2020

Actually, I have the pull request ready now. Can you please have a look at line https://github.com/sbluhm/WebDAV-Daemon/blame/CustomHeaders/configuration.c#L283 for me?
I am not releasing the memory for xmlTextReaderGetAttribute here and have no clue how to do this. According to the documentation, you have to de-allocate it.

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

No branches or pull requests

2 participants