Git Product home page Git Product logo

Comments (9)

kugland avatar kugland commented on August 16, 2024 1

Why not create a directory with the single file you want to serve?

from darkhttpd.

emikulic avatar emikulic commented on August 16, 2024 1

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.

iliazeus avatar iliazeus commented on August 16, 2024

@kugland the same reason I don't just spin up nginx instead: it's way less convenient.

from darkhttpd.

guest271314 avatar guest271314 commented on August 16, 2024

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.

guest271314 avatar guest271314 commented on August 16, 2024

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.

g-rden avatar g-rden commented on August 16, 2024

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.

kugland avatar kugland commented on August 16, 2024

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 avatar g-rden commented on August 16, 2024

g-rden@b83124b this implements the second option for --chroot. I think this makes the most sense.

from darkhttpd.

emikulic avatar emikulic commented on August 16, 2024

Nice work @g-rden, please open a PR!

from darkhttpd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.