Project

General

Profile

Actions

Feature #1908

closed

autoselect-random-port feature for lighttpd needed

Added by cdumke about 12 years ago. Updated about 12 years ago.

Status:
Wontfix
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

I need lighttpd to autoselect its port.

Background: I have an apache-httpd authenticating the user-session. For each user-session a lighttpd/WebDAV-process is started using the user-id of the connected user. The script starting the lighttpd writes a lighttpd.conf for the user and sets up the rewriting of the user-request in the apache-httpd. For this to work the script must either select an unused port and use it in the lighttpd.conf/server.port-option (difficult), or the lighttpd uses port 0 in its bind()-call and lets the operating system find an unused port (easy). For the second solution the script must be able to learn the port the lighttpd-process got.

I implemented the changes needed for this port-autoselect feature in my appended patch.

I added the following:

  1. lighttpd.conf has a new option "server.port-file" (value is the path the selected port is written to)
  2. the "server.port"-options has new semantics: server.port=0 means autoselect a random port, server.port=-1 means use the default port (80/443)

Files

lighttpd-1.4.21-random-port.patch (11.9 KB) lighttpd-1.4.21-random-port.patch patch implements random-port feature cdumke, 2009-02-19 15:26
Actions #1

Updated by stbuehler about 12 years ago

  • Target version changed from 1.4.21 to 1.4.22
Actions #2

Updated by stbuehler about 12 years ago

  • Target version changed from 1.4.22 to 1.4.23
Actions #3

Updated by Olaf-van-der-Spek about 12 years ago

Wouldn't it be possible to open the port 'yourself' and then pass the descriptor to Lighttpd?
That way you could even use port 80 without starting as root.

Actions #4

Updated by cdumke about 12 years ago

Olaf-van-der-Spek wrote:

Wouldn't it be possible to open the port 'yourself' and then pass the descriptor to Lighttpd?

How do I do that (pass an open socket to lighttpd)?
What do You mean with "descriptor"?

That way you could even use port 80 without starting as root.

Actions #5

Updated by stbuehler about 12 years ago

  • Status changed from New to Wontfix

I don't think this feature is needed upstream. Just patch it yourself if you need such special features (as you already did), or use other ways like using a unix-socket instead of tcp (should be faster for local connections anyway).

Actions #6

Updated by Olaf-van-der-Spek about 12 years ago

cdumke wrote:

Olaf-van-der-Spek wrote:

Wouldn't it be possible to open the port 'yourself' and then pass the descriptor to Lighttpd?

How do I do that (pass an open socket to lighttpd)?

You don't, with the current code.

What do You mean with "descriptor"?

http://www.google.com/search?q=file%20descriptor

Actions

Also available in: Atom