mozhttpd improvements: Make port 0 the default, add a method to get the URL

RESOLVED FIXED

Status

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: wlach, Assigned: wlach)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

In IRC discussions today, we figured that we want the following changes to mozhttpd:

* Port 0 should be the default in the constructor (not 8888). A random port is normally what we want, to eliminate race conditions.
* We should have a convenience method to get a URL of the server root (e.g. http://192.168.1.5:3222)
Blocks: 878133
I'd probably write it as def get_url(path="/"), so you could call get_url() to get the root, or get_url("/foo/bar.html") to get a sub-path. I basically implemented this in one line in a unit test, it should absolutely be a convenience method:
https://github.com/mozilla/mozbase/blob/master/mozcrash/tests/test.py#L154

Comment 2

5 years ago
a big +1 from me wrt comment 1
No longer blocks: 878133
See Also: → bug 878133
Created attachment 760928 [details] [diff] [review]
Make port 0 default for mozhttpd and add method to get the URL

Simple patch to fix this bug
Assignee: nobody → wlachance
Attachment #760928 - Flags: review?(jhammel)

Comment 4

5 years ago
Comment on attachment 760928 [details] [diff] [review]
Make port 0 default for mozhttpd and add method to get the URL

lgtm
Attachment #760928 - Flags: review?(jhammel) → review+
Pushed: https://github.com/mozilla/mozbase/commit/930b34fe826ff0cdb36d583a14e5e1084ec72c20
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.