Pastebin
Paste #444: log
< previous paste - next paste>
Pasted by Morten
13:07] <Yhg1s> bonaldo2000: it makes whatever self.rfile is the stdin of the process. It's so it can spawn another process and have that process take input from the socket.
[13:07] <Shaffox> name = 'Shaffox'
[13:07] <Shaffox> print "my name is", name
[13:08] <Shaffox> this should work, right?
[13:08] <HanzZ> Shaffox, just test it......
[13:08] <Yhg1s> Shaffox: correct. Try it in the interactive interpreter.
[13:08] <-- ignatios has left this channel.
[13:08] <Shaffox> idle is fine?
[13:08] <bonaldo2000> Yhg1s: ok thank you. I dont know if you saw my post earlier, but I am having problems with pyopenssl and CGIHTTPServer.py. I rad somewhere that that the pyopelssl objects doesnt support the dub call. Can you maybe elaborqate on what that means?
[13:09] <bonaldo2000> rad = read
[13:09] <Yhg1s> bonaldo2000: it means you can't connect the SSL object to the CGI process that way.
[13:09] <Yhg1s> bonaldo2000: because it's not a filedescriptor, it's a library producing data. It can't be transparently used as a file at the OS level.
[13:10] <bonaldo2000> Yhg1s: hm ok. Do you have any idea how I might do it then?
[13:10] <Yhg1s> bonaldo2000: you have to open a pipe to the CGI process, and manually transfer data back and forth to the socket. It's not easy.
[13:11] <HanzZ> is here some QThread example code in python ?
[13:11] <sorl_> is it possible to put values into a string from a dict and a varaible? "s(name)%, %s" % (dict, variable)
[13:11] <-- thegoldenaura has left this server.
[13:11] <bonaldo2000> Yhg1s: ahh...doesnt sound easy! Can you direct me to some reading that might help me do that? I really NEED to do it...unless there is some other way to make CGI run SSL (using pyopenssl or a similar extension)
[13:11] --> Cowmoo has joined this channel (n=Cowmoo@85.154.19.215).
[13:12] <bonaldo2000> or...an SSL server run CGI
[13:12] <bonaldo2000> not CGI run SSL
[13:12] <Yhg1s> bonaldo2000: the subprocess docs, but no, it isn't easy at all. I suggest just using an existing solution, like Apache.
[13:12] <Yhg1s> sorl_: nope.
[13:13] <sorl_> Yhg1s, best option is to put it all in the dict?
[13:13] <Yhg1s> sorl_: yes.
[13:13] <sorl_> Yhg1s, thank you
[13:13] <bonaldo2000> Yhg1s: The thing is that this is for a project in my university and we have to make a python webserver. And it has to be able to run CGi! :-|
[13:14] <-- Mirrakor has left this server ("Konversation terminated!").
[13:14] <-- flosch has left this server (Connection timed out).
[13:14] <-- jburd has left this server ("Leaving").
[13:15] --> jburd has joined this channel (n=jburd@59.184.52.250).
[13:15] <aimaz> bonaldo2000, have you seen twisted?
[13:16] <bonaldo2000> aimaz: yes, we have had a look at it. We have kind of concluded that it does "too much" of the work. That creating an SSL server is VERY simple and so too easy for our project. But I dont knwo if that is a coorect conclusion?
[13:17] <aimaz> well it depends what the point of your project is i suppose
[13:17] --> felixhummel has joined this channel (n=dfm21@p5496CF7A.dip.t-dialin.net).
[13:18] <-- scorphus has left this server ("the more we think we know about, the greater the unknown").
[13:18] --> grimboy has joined this channel (n=grimboy@85-210-224-9.dsl.pipex.com).
[13:18] <-- Fubar^ has left this server ("Quit").
[13:18] <bonaldo2000> aimaz: It is a bachelor project (dont know if you know that term. I dont know if its only a danish term) so its a relative advanced project. The point of the project is to create a python SSL server and prove that it is secure. But wouldnt most of the work be done for us if we used twisted?
[13:19] <Yhg1s> bonaldo2000: all of it, yes.
[13:19] <aimaz> I've never made an SSL server with it, but making a http server is about 4 lines
[13:19] <Yhg1s> bonaldo2000: but if the purpose is to learn how to make secure CGI, well, asking us for help isn't exactly honest either, now is it? :)
[13:19] <Yhg1s> bonaldo2000: you need to read up on pipes and how low-level I/O on UNIX systems work.
[13:20] --> pianoboy3333 has joined this channel (n=alex@ool-43567d61.dyn.optonline.net).
[13:20] <-- waa has left this server (Read error: 110 (Connection timed out)).
[13:21] <bonaldo2000> Yhg1s: no the purpose is to make a secure SSL server. CGI is just a part of it. I dont think anyone minds you giving us pointers! :-) Infact I might send the log to our tutor as proof that the job is too hard ! :-)
[13:21] <Yhg1s> oh, it's not really hard.
[13:21] <Yhg1s> it's just terribly tedous.
[13:21] <Yhg1s> eh, tedious.
[13:21] --> epifanio has joined this channel (n=chatzill@host228-82.pool8251.interbusiness.it).
[13:21] <Yhg1s> and you need to learn about how low-level I/O works on UNIX systems, which I don't have a ready tutorial for :)
[13:21] --> asger has joined this channel (n=alp@0x535f725e.boanxx8.adsl-dhcp.tele.dk).
[13:21] <Yhg1s> basically, you need to spawn the new process and funnel data back and forth from the socket to the pipe.
[13:22] <Yhg1s> but you need to do it with care, or you will end up in a deadlock.
[13:22] <-- DavidHKMrPowers has left this server.
[13:22] <-- dhaumann has left this channel ("Konversation terminated!").
[13:22] <-- josepharmbruster has left this server.
[13:22] <bonaldo2000> Yhg1s: ok. I am amazed that it is so complex! I can't really understand why CGI-scripts are so much different from just transfering a HTML-document!
[13:22] --> azi` has joined this channel (n=azi@89-212-41-93.static.dsl.t-2.net).
[13:23] <bonaldo2000> Yhg1s: why cant the server just execute the script and send the result...
[13:24] --> welp has joined this channel (n=welp@gentoo/developer/welp).
[13:24] <azi`> hm.. i have a nested loop in which i print some stuff but, that stuff doesn't get printed.. if i add an exit after the print, the first value gets printed and the script obviously terminates.. that makes me wondering, is there any output buffer working behind the scenes of python?
[13:24] <Yhg1s> bonaldo2000: because the CGI script may want input from the HTTP client.
[13:24] <Yhg1s> bonaldo2000: and the CGI script may indeed want to converse with the HTTP client, sending more than one request back and forth.
[13:25] <azi`> s/doesn't get printed/the loop is crunching with no value yet printed
[13:25] <Yhg1s> azi`: not specifically Python, but your OS, yes.
[13:25] <azi`> Yhg1s: ok
[13:25] <Yhg1s> azi`: add a sys.stdout.flush() to flush stdout.
[13:25] <azi`> Yhg1s: but, print adds a newline char
[13:25] <Yhg1s> (or stderr if you're writing there.)
[13:25] <Yhg1s> azi`: that only matters in some cases.
[13:25] <azi`> Yhg1s: and my system terminal is line buffered
[13:25] <bonaldo2000> Yhg1s: hmm ok. What if I knew that the script wouldnt need to comunicate with the HTTP client. (not that I am sure that it wouldnt need to in our case). Could it then be made simpler?
[13:26] <Yhg1s> bonaldo2000: sure. then you wouldn't have to connect stdin of the CGI script with output from the socket. you could just start the script, capture all the output and send that to the HTTP client manually.
[13:26] <Yhg1s> bonaldo2000: but you won't be able to handle anything other than GET requests.
[13:26] <Yhg1s> azi`: you can still get buffering if you send output through a pipe, like 'tee'. See if the flush matters.
[13:27] <tdn> Yhg1s, if the CGI script wants to communicate with the HTTP client, why can't it just do so? I mean SSL is on the transport layer and HTTP is on the application layer. SSL should work transperantly from the script's point of view. Right?
[13:27] <Yhg1s> tdn: you're missing the point.
[13:27] <tdn> Yhg1s, then please enlighten me :)
[13:27] <bonaldo2000> Yhg1s: ok. What we need is a script that redirects people to a folder based on their certificate. This doesnt need to communicate with the HTTP client when it has received the certificate, am I right?
[13:27] <Yhg1s> tdn: bonaldo2000 isn't writing the script. he's writing the webserver. he's looking at code that connects a socket's fd with a to-be-started script's stdin. That works for normal sockets, but can't work for SSL sockets (at least, not with a bunch of extra magic.)
[13:28] <Yhg1s> bonaldo2000: it's pretty easy: if you need POST, you need two-way communication. if you don't, then not.
[13:28] <Yhg1s> tdn: eh, not with*out* a bunch of extra magic.
[13:29] <azi`> Yhg1s: yes, that makes it work, weird though :)
[13:29] <azi`> Yhg1s: and, thanks ;)
[13:29] <bonaldo2000> Yhg1s: ok. Maybe we can get off cheap then. I *think* that we do not need post.
[13:31] <tdn> Yhg1s, why is post different thatn GET in this problem? And could you please shed som light on "magic"?
[13:31] --> xijiao has joined this channel (n=xijiao@59.77.243.109).
[13:32] <-- dooooomi has left this server.
New Paste
Go to most recent paste.