Comments (9)
Why not create a directory with the single file you want to serve?
from darkhttpd.
I can kinda appreciate this from a simplicity and security standpoint - locking serving down to a single path. Who wants to implement it?
from darkhttpd.
@kugland the same reason I don't just spin up nginx instead: it's way less convenient.
from darkhttpd.
I have this use case as well. I just need to serve a single HTML page on localhost, which I request using window.open()
on Chromium, then I register a ServiceWorker
from a script in the HTML which is used to stream data to the Tab which opened the window
. I don't even need darkhttpd
to remain active once the single request is served. I can use Native Messaging to start the local server, ideally the server would terminate itself once the request is served - the script and ServiceWorker
in the served HTML will remain active.
from darkhttpd.
I am not an expert in C. Otherwise I would file a PR as this is exactly what I am looking for for my own projects in the browser and potentially as a base to import into QuickJS.
from darkhttpd.
I couldn't keep myself from trying to implement this. Here is my naive approach:
g-rden@134f825
I am not sure what --chroot should do. Should it error, change to the directory the file is in or something else? Probably the second, but it could get quite annoying to get the directory name and the file name without the path.
from darkhttpd.
I couldn't keep myself from trying to implement this. Here is my naive approach: g-rden@134f825
I am not sure what --chroot should do. Should it error, change to the directory the file is in or something else? Probably the second, but it could get quite annoying to get the directory name and the file name without the path.
You could open the file and keep the file handle, and then chroot to an empty directory.
from darkhttpd.
g-rden@b83124b this implements the second option for --chroot. I think this makes the most sense.
from darkhttpd.
Nice work @g-rden, please open a PR!
from darkhttpd.
Related Issues (20)
- Linting? Code formatting? HOT 2
- Can not listen to IPv6 address. HOT 2
- [FR] ability to use css HOT 7
- darkhttp possibly logs incorrect size for requests.
- Skip link to parent directory when in root HOT 1
- macOS: Access to some macOS special files should be filtered out HOT 3
- PROPFIND / Read-Only WebDAV HOT 6
- Listen on IPv4 and IPv6 HOT 2
- Support FreeBSD 14+ chroot as non-root feature HOT 2
- Better argument parsing HOT 16
- Is the date header necessary? HOT 3
- Directory listings missing size in Kodi HOT 6
- With `--forward-https` set `client` ip from `X-Forwarded-For` HOT 1
- 500 for not found directory listing HOT 3
- Tests don't pass, but say they do
- --help / usage sorting is unintuitive HOT 1
- Update generated html HOT 5
- [FR] Print IEC formatted file sizes in directory listing HOT 4
- Use of stdout after fclose() HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from darkhttpd.