twisted / twisted

Event-driven networking engine written in Python.
https://www.twisted.org
Other
5.49k stars 1.15k forks source link

string format for specifying interface/port/transport to listen on #7391

Closed twisted-trac closed 20 years ago

twisted-trac commented 21 years ago
itamarst's avatar @itamarst reported
Trac ID trac#68
Type enhancement
Created 2003-07-14 11:58:18Z
Searchable metadata ``` trac-id__68 68 type__enhancement enhancement reporter__itamarst itamarst priority__low low milestone__ branch__ branch_author__ status__closed closed resolution__fixed fixed component__ keywords__ time__1058183898000000 1058183898000000 changetime__1065031298000000 1065031298000000 version__ owner__ cc__glyph cc__radix cc__itamarst cc__moshez ```
twisted-trac commented 13 years ago
Automation's avatar Automation removed owner
twisted-trac commented 20 years ago
itamarst's avatar @itamarst commented
#!html
<pre>
I'll look when I have some time, later in the week. Don't
commit to core twisted until I do? :)

</pre>
twisted-trac commented 20 years ago
glyph's avatar @glyph commented
#!html
<pre>
radix: try uncommenting that line and watch the traceback. 
the DefaultOpenSSLContextFactory blows up if you create it
with an invalid filename.

</pre>
twisted-trac commented 21 years ago
itamarst's avatar @itamarst commented
#!html
<pre>
The idea is to allow tap plugins to just use this instead of
duplicating the "choose which port and if it's unix socket
or tcp or ssl and what interface optionally" code for each
server. Probably other uses as well.

E.g. "mktap web --listen tcp:80:127.0.0.1" or something.
Format needs to be decided.

The scheme should be pluggable so you can add new
transports. I'd argue this shouldn't be done on reactor
level (why should cReactor need to parse this?) but as a
utility function.

</pre>
twisted-trac commented 20 years ago
glyph's avatar @glyph commented
#!html
<pre>
Just checked in an implementation of this to
sandbox/glyph/just.py (e.g. "just.listen(...)")

Let me know what you think.

</pre>
twisted-trac commented 20 years ago
glyph's avatar @glyph commented
#!html
<pre>
Comment on it, post-haste!

</pre>
twisted-trac commented 20 years ago
radix's avatar @radix commented
#!html
<pre>
well, it looks fine to me. The little example section at the
bottom has the ssl bit commented out with something about
"needs a real server.pem", but it seems, from reading the
code, that it should work fine.. wouldn't you just say

ssl:80:privateKey=server.pem

?

Maybe it would also be cool to have that code that builds a
function call out of strings be moved into something like
twisted.python.util.stringToFunctionCall. Although, I guess
we can wait until we have a real use case for that :-)

</pre>
twisted-trac commented 20 years ago
itamarst's avatar @itamarst commented
#!html
<pre>
I like. 

Just don't add the stringfunction thing to t.p.util, new
module please. Enough crap there, radix.

</pre>
twisted-trac commented 20 years ago
glyph's avatar @glyph commented
#!html
<pre>
This has been sitting open forever.  Since the code exists,
it should get resolved.  I'd like to see this in 1.1,
especially in a more new-application-friendly format.  Where
should it go and what remains to be done?

</pre>
twisted-trac commented 20 years ago
itamarst's avatar @itamarst commented
#!html
<pre>
twisted.application.internet. It should be, of course, a
service :)

</pre>
twisted-trac commented 20 years ago
moshez's avatar @moshez commented
#!html
<pre>
Have a look at sandbox/moshez/ports.py for a different take on the same idea --
 I seperated the listening and parsing aspects, so instead of creating a 
server which chooses stuff at the last moment, the service created is already 
the correct type. I'm not sure where this should go, maybe twisted.application 
[even though it's not necessarily applicationy stuff, but internet is also 
invalid -- though the service() function could go in t.application.internet 
witht he rest of ports hanging in twisted.internet

</pre>
twisted-trac commented 20 years ago
itamarst's avatar @itamarst commented
#!html
<pre>
The nice thing about choosing at the last minute is that you
can edit it with coil. Although I suppose coil ought to have
some of way of "turn this tcp service into ssl service" or
something anyway.

</pre>
twisted-trac commented 20 years ago
itamarst's avatar @itamarst commented
#!html
<pre>
So, moshez has added this. Missing: update taps to use it,
and docstrings so tap users know about this, and a mini-howto.

</pre>
twisted-trac commented 20 years ago
glyph's avatar @glyph commented
#!html
<pre>
strports is awesome.  I think this issue should be closed.  Docstrings for taps
and howto can be separate issues.  I'm resolving this.
</pre>