Re: Porting 2.x to 3.3: BaseHTTPServer

2013-04-21 Thread Serhiy Storchaka
21.04.13 16:46, Chris Angelico написав(ла): Also, it's expecting bytes everywhere, and I can't find a simple way to declare an encoding and let self.wfile.write() accept str. Do I have to explicitly encode everything that I write, or is there a cleaner way? io.TextIOWrapper -- http://mail.pyt

Re: Porting 2.x to 3.3: BaseHTTPServer

2013-04-21 Thread Chris Angelico
On Mon, Apr 22, 2013 at 12:01 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> In the current version of the code, I use BaseHTTPServer as the main >> structure of the request handler. 2to3 translated this into >> http.server, which seems to be the

Re: Porting 2.x to 3.3: BaseHTTPServer

2013-04-21 Thread Roy Smith
In article , Chris Angelico wrote: > In the current version of the code, I use BaseHTTPServer as the main > structure of the request handler. 2to3 translated this into > http.server, which seems to be the nearest direct translation. But is > that the best way to go about making a

Porting 2.x to 3.3: BaseHTTPServer

2013-04-21 Thread Chris Angelico
, and it's more of an advice one. In the current version of the code, I use BaseHTTPServer as the main structure of the request handler. 2to3 translated this into http.server, which seems to be the nearest direct translation. But is that the best way to go about making a simple HTTP server?

Re: BaseHTTPServer ThreadMixIn not working

2011-10-04 Thread Gabriel Genellina
En Mon, 03 Oct 2011 12:03:18 -0300, amit escribió: I am really stuck in a very simple problem and wanted to know if you could take some time to check it out - My code is simple. Using BaseHTTPServer and ThreadInMix I want to run a python script (Script1.py) for every request made

BaseHTTPServer ThreadMixIn not working

2011-10-03 Thread amit
Hi everyone, I am really stuck in a very simple problem and wanted to know if you could take some time to check it out - My code is simple. Using BaseHTTPServer and ThreadInMix I want to run a python script (Script1.py) for every request made simultaneously. My code-> from subprocess imp

Re: Handling the log in BaseHTTPServer

2011-05-04 Thread LehH Sdsk8
                           format%args)) > > httpd = HTTPServer(ADDR, MyLoggingHTTPRequestHandler) > httpd.serve_forever() > > Simon > > > > > > > > On Wed, 4 May 2011 03:52:29 -0700 (PDT), LehH Sdsk8 wrote: > > First, i'm sorry for any inglish error! > >

Re: Handling the log in BaseHTTPServer

2011-05-04 Thread Tapi
rever() Simon On Wed, 4 May 2011 03:52:29 -0700 (PDT), LehH Sdsk8 wrote: First, i'm sorry for any inglish error! So, i use the BaseHTTPServer to create a page for monitoring purposes, someone now how to direct the event log to a file? -- http://mail.python.org/mailman/listinfo/python-list

Handling the log in BaseHTTPServer

2011-05-04 Thread LehH Sdsk8
First, i'm sorry for any inglish error! So, i use the BaseHTTPServer to create a page for monitoring purposes, someone now how to direct the event log to a file? -- http://mail.python.org/mailman/listinfo/python-list

Re: BaseHTTPServer get_request not called till first request

2010-01-17 Thread Adam Tauno Williams
On Sat, 2010-01-16 at 18:35 -0800, yousay wrote: > On Jan 13, 1:38 am, Adam Tauno Williams > wrote: > > Looking at <http://code.activestate.com/recipes/425210/> and > > <http://code.activestate.com/recipes/499376/> as examples I've attempted > > to cre

Re: BaseHTTPServer get_request not called till first request

2010-01-16 Thread yousay
On Jan 13, 1:38 am, Adam Tauno Williams wrote: > Looking at <http://code.activestate.com/recipes/425210/> and > <http://code.activestate.com/recipes/499376/> as examples I've attempted > to create a BaseHTTPServer class that times-out accept() ever X seconds > to

BaseHTTPServer get_request not called till first request

2010-01-12 Thread Adam Tauno Williams
Looking at <http://code.activestate.com/recipes/425210/> and <http://code.activestate.com/recipes/499376/> as examples I've attempted to create a BaseHTTPServer class that times-out accept() ever X seconds to check some other work. This seems to work well, but only once the HTTP

Re: BaseHttpServer

2009-02-15 Thread Paul
On Feb 15, 8:46 pm, Steve Holden wrote: > Paul wrote: > > Hi, > > I currently have a webserver using BaseHttpServe that serves images > > like this: > > if self.path.endswith(".jpg"): > >                 print(curdir + sep + self.path) > >                 f = open(curdir + sep + self.path,"b") > >

Re: BaseHttpServer

2009-02-15 Thread Steve Holden
Paul wrote: > Hi, > I currently have a webserver using BaseHttpServe that serves images > like this: > if self.path.endswith(".jpg"): > print(curdir + sep + self.path) > f = open(curdir + sep + self.path,"b") > self.send_response(200) >

Re: BaseHttpServer

2009-02-15 Thread Pierre Quentel
On 15 fév, 18:31, Paul wrote: > Hi, > I currently have a webserver using BaseHttpServe that serves images > like this: > if self.path.endswith(".jpg"): >                 print(curdir + sep + self.path) >                 f = open(curdir + sep + self.path,"b") >                 self.send_response(20

BaseHttpServer

2009-02-15 Thread Paul
Hi, I currently have a webserver using BaseHttpServe that serves images like this: if self.path.endswith(".jpg"): print(curdir + sep + self.path) f = open(curdir + sep + self.path,"b") self.send_response(200) self.send_header('Content-

Re: Accessing POST parameters from BaseHTTPServer

2008-11-06 Thread Steve Holden
James wrote: > Hi all, > I'm writing a super simple little debugging HTTP server which simply > returns the path and parameters it receives requests for. > > E.g. requesting /meth?a=b returns something like: > Command: GET > Path: /meth > Params: {'a': ['b']} > > This is fine for GET, but I can't

Accessing POST parameters from BaseHTTPServer

2008-11-06 Thread James
Hi all, I'm writing a super simple little debugging HTTP server which simply returns the path and parameters it receives requests for. E.g. requesting /meth?a=b returns something like: Command: GET Path: /meth Params: {'a': ['b']} This is fine for GET, but I can't see how I access parameters pass

Re: [BaseHTTPServer/SimpleHTTPServer] Remove "Server:" header

2008-10-03 Thread Gabriel Genellina
#x27;, self.version_string()) in the send_response method of the BaseHTTPRequestHandler class in the BaseHTTPServer module. Long story, short, it's going to be a lot of work to get rid of. One can always write a customized RequestHandler, and just copy the send_response method omiting t

Re: [BaseHTTPServer/SimpleHTTPServer] Remove "Server:" header

2008-10-03 Thread Gary M. Josack
you've got ?self.send_header('Server', self.version_string()) in the send_response method of the BaseHTTPRequestHandler class in the BaseHTTPServer module. Long story, short, it's going to be a lot of work to get rid of. [EMAIL PROTECTED] wrote: Hello. I'm using Si

[BaseHTTPServer/SimpleHTTPServer] Remove "Server:" header

2008-10-03 Thread [EMAIL PROTECTED]
Hello. I'm using SimpleHTTPServer (work well) but it always sends "Server" header in response: "Server: SimpleHTTP/0.6 Python/2.5.1" How can I remove that ? I tried: self.server_version = "" self.sys_version = "" but the header is still sent, empty. I there a way to remove the "Server:" head

Re: BaseHTTPServer and do_POST method

2008-02-27 Thread Gabriel Genellina
En Wed, 27 Feb 2008 10:33:35 -0200, rocksportrocker <[EMAIL PROTECTED]> escribi�: > Hi, > > I am trying to implement a local server for storing and retrieving > numerical data. > So I use BaseHTTPServer as follows: > > -

Re: BaseHTTPServer and do_POST method

2008-02-27 Thread rocksportrocker
If I ommit send_response() in do_POST() I get no errormessage. That is an acceptable solution for me. Greetings, Uwe -- http://mail.python.org/mailman/listinfo/python-list

Re: BaseHTTPServer and do_POST method

2008-02-27 Thread rocksportrocker
On Feb 27, 2:50 pm, 7stud <[EMAIL PROTECTED]> wrote: > ... > I don't get that error. On the server, I get the output: > > POST > localhost - - [27/Feb/2008 06:49:13] "POST / HTTP/1.1" 200 - > > and on the client I get: > > None > In my case the server says: Traceback (most recent call last

Re: BaseHTTPServer and do_POST method

2008-02-27 Thread 7stud
On Feb 27, 5:33 am, rocksportrocker <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to implement a local server for storing and retrieving > numerical data. > So I use BaseHTTPServer as follows: > > ----- >

Re: BaseHTTPServer and do_POST method

2008-02-27 Thread rocksportrocker
On Feb 27, 1:28 pm, rocksportrocker <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to implement a local server for storing and retrieving > numerical data. > So I used BaseHTTPServer as follows: > > from BaseHTTPServer import * > > class Handler(BaseHTTPRequestH

BaseHTTPServer and do_POST method

2008-02-27 Thread rocksportrocker
Hi, I am trying to implement a local server for storing and retrieving numerical data. So I use BaseHTTPServer as follows: - from BaseHTTPServer import * class Handler(BaseHTTPRequestHandler): def do_POST(self

BaseHTTPServer and do_POST method

2008-02-27 Thread rocksportrocker
Hi, I am trying to implement a local server for storing and retrieving numerical data. So I used BaseHTTPServer as follows: from BaseHTTPServer import * class Handler(BaseHTTPRequestHandler): def do_POST(self): print "POST" self.send_response(200) httpd =

BaseHTTPServer issues

2007-11-23 Thread samwyse
I've just now submitted two issues to the issue tracker: 1491BaseHTTPServer incorrectly implements response code 100 RFC 2616 sec 8.2.3 states, "An origin server that sends a 100 (Continue) response MUST ultimately send a final status code, once the request body is received and

Re: BaseHTTPServer and Apache

2007-04-14 Thread Ron Garret
> Does > > > anyone know of a straightforward way to get Apache to "forward" requests > > > to a given path to another HTTP server running on a different port? > > > > Never mind, I think I figured it out. Apparently what I need is the > > ProxyPassRever

Re: BaseHTTPServer and Apache

2007-04-13 Thread Luis M. González
path to another HTTP server running on a different port? > > Never mind, I think I figured it out. Apparently what I need is the > ProxyPassReverse directive. > > I'd still be interested in hearing about people's experience using > BaseHTTPServer for real applications. >

Re: BaseHTTPServer and Apache

2007-04-13 Thread Ron Garret
Apparently what I need is the ProxyPassReverse directive. I'd still be interested in hearing about people's experience using BaseHTTPServer for real applications. Thanks, rg -- http://mail.python.org/mailman/listinfo/python-list

BaseHTTPServer and Apache

2007-04-13 Thread Ron Garret
performance bottleneck (because it is accessed automatically once a second by an XMLHTTPRequest, but that's another story). I have fixed this by re-implementing that page using a BaseHTTPServer. So I can fix my problem by redirecting the XMLHTTPRequest to a URL that is served by

Re: BaseHTTPServer - getting POST parameters

2006-11-14 Thread Fredrik Lundh
Vlad Dogaru wrote: > After experimenting for a while, I am still not able to find where the > POST data is in the BaseHTTPRequestHandler class. I am trying to write > a very simple HTTP server for a project of mine and I need to get the > POST data. Certainly I am missing something, as it is a com

Re: BaseHTTPServer - getting POST parameters

2006-11-14 Thread Paul Boddie
Vlad Dogaru wrote: > > After experimenting for a while, I am still not able to find where the > POST data is in the BaseHTTPRequestHandler class. I am trying to write > a very simple HTTP server for a project of mine and I need to get the > POST data. Certainly I am missing something, as it is a co

BaseHTTPServer - getting POST parameters

2006-11-14 Thread Vlad Dogaru
Hello, After experimenting for a while, I am still not able to find where the POST data is in the BaseHTTPRequestHandler class. I am trying to write a very simple HTTP server for a project of mine and I need to get the POST data. Certainly I am missing something, as it is a comon task. Thanks in

Re: BaseHTTPServer weirdness

2006-09-12 Thread Eddie Corns
Ron Garret <[EMAIL PROTECTED]> writes: >In article <[EMAIL PROTECTED]>, > Steve Holden <[EMAIL PROTECTED]> wrote: >> I wouldn't necessarily say you are wrong here, It's just that the cgi >> module has sort of "just growed", so it isn't conveniently factyored for >> reusability in other contexts

Re: BaseHTTPServer weirdness

2006-09-12 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > I wouldn't necessarily say you are wrong here, It's just that the cgi > module has sort of "just growed", so it isn't conveniently factyored for > reusability in other contexts. Several people (including me) have taken >

Re: BaseHTTPServer weirdness

2006-09-12 Thread Steve Holden
>>Let me get this right. You are aware that CGIHTTPServer module exists. >>>But you don't want to use that. Instead you want to use your own code. >>>So you have ended up duplicating some of the functionality of the cgi >>>library. And it feels like a hack. &

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
you'll need to read the source of cgi.parse_qs (like Steve did) and > see what it needs from os.environ and then provide that (either in > os.environ or in a custom environ dictionary). I ended up just copying and hacking the code. It was only a dozen lines or so. But it stil

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
e that. Instead you want to use your own code. > > So you have ended up duplicating some of the functionality of the cgi > > library. And it feels like a hack. > > > > Have I missed anything? :-) > > Hey, be nice. Wanting to write a request handler that actually handles a >

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > Steve Holden <[EMAIL PROTECTED]> wrote: > > > > > >>But basically, you aren't providing a CGI environment, and that's why > >>cgi.parse() isn't working. > > > >

Re: BaseHTTPServer weirdness

2006-09-11 Thread Steve Holden
Ron Garret wrote: > In article <[EMAIL PROTECTED]>, > Steve Holden <[EMAIL PROTECTED]> wrote: > > >>But basically, you aren't providing a CGI environment, and that's why >>cgi.parse() isn't working. > > > Clearly. So what should I be doing? Surely I'm not the first person to > have this pr

Re: BaseHTTPServer weirdness

2006-09-11 Thread Damjan
>> But basically, you aren't providing a CGI environment, and that's why >> cgi.parse() isn't working. > > Clearly. So what should I be doing? Probably you'll need to read the source of cgi.parse_qs (like Steve did) and see what it needs from os.environ and then provide that (either in os.envir

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > But basically, you aren't providing a CGI environment, and that's why > cgi.parse() isn't working. Clearly. So what should I be doing? Surely I'm not the first person to have this problem? I have managed to work aroun

Re: BaseHTTPServer weirdness

2006-09-11 Thread Steve Holden
as its standard input. > > > Doesn't work. (I even tried sys.stdin=r.rfile; s=cgi.parse()) Don't > forget, this is not a CGI script, it's a handler for a BaseHTTPServer. > > Right. My bad. However there's clearly something screwy going on, because other

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
ried sys.stdin=r.rfile; s=cgi.parse()) Don't forget, this is not a CGI script, it's a handler for a BaseHTTPServer. > > 2. Despite the fact that I'm passing a 1 for the keep_blank_values > > argument to cgi.parse_qs, it doesn't actually keep blank values. Is >

Re: BaseHTTPServer weirdness

2006-09-11 Thread Steve Holden
Ron Garret wrote: > I'm trying to figure out how to use BaseHTTPServer. Here's my little > test app: > > = > > #!/usr/bin/python > > from BaseHTTPServer import * > > import cgi > > class myHandler(BaseHTTP

BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
I'm trying to figure out how to use BaseHTTPServer. Here's my little test app: = #!/usr/bin/python from BaseHTTPServer import * import cgi class myHandler(BaseHTTPRequestHandler): def do_GET(r): s = '' try: s = cgi.parse

Parsing form input in a BaseHTTPServer

2006-09-01 Thread Ron Garret
I'm write a web server using BaseHTTPServer. It can't be a CGI because it has to do some weird server-push stuff as database updates come in. But I still need to process form inputs as if it were a CGI. But the cgi module only works in a CGI environment. Is there somethin

return a default form with BaseHTTPServer

2006-01-09 Thread Jeff Gercken
I want my http server to return a default form, regardless of the GET request, but I'm a bit of a noob and have no idea how. I'm trying to write a platform-independent captured portal for my wireless AP. This is what I have: #!/usr/bin/env python import CGIHTTPServer import BaseHTTPSe

Re: BaseHTTPServer module

2005-12-01 Thread Peter Hansen
amfr wrote: > I looked at the doumentation and is says rfile is: > "Contains an input stream, positioned at the start of the optional > input data." > How do i get the input out of it? As with any "input stream" (file-like object) in Python, you call file methods like .read() or maybe .readline()

Re: BaseHTTPServer module

2005-12-01 Thread amfr
I looked at the doumentation and is says rfile is: "Contains an input stream, positioned at the start of the optional input data." How do i get the input out of it? -- http://mail.python.org/mailman/listinfo/python-list

Re: BaseHTTPServer module

2005-11-21 Thread amfr
Thanks, all I wanted to know where the post data was stored from the request -- http://mail.python.org/mailman/listinfo/python-list

Re: BaseHTTPServer module

2005-11-20 Thread Tim Roberts
"amfr" <[EMAIL PROTECTED]> wrote: > >>From the BaseHTTPServer module, how do i gget the POST or GET data sent >by the client? Is it stired the the file they requested? e.g. >objectname.path Did you check the documentation in the module? You need to derive your own

BaseHTTPServer module

2005-11-20 Thread amfr
>From the BaseHTTPServer module, how do i gget the POST or GET data sent by the client? Is it stired the the file they requested? e.g. objectname.path -- http://mail.python.org/mailman/listinfo/python-list

BaseHTTPServer module

2005-11-20 Thread amfr
>From the BaseHTTPServer module, how do i gget the POST or GET data sent by the client? Is it stired the the file they requested? e.g. objectname.path -- http://mail.python.org/mailman/listinfo/python-list

RE: Multiple (threaded?) connections to BaseHTTPServer

2005-08-23 Thread Robert Brewer
27;t know for sure; > assuming BaseHTTPServer is good enough for my current needs aside from > its lack of threading, does PooledThreadedServer have any advantages > over the method I linked above? The biggest difference (and you can decide whether it's an advantage for your environment

Re: Multiple (threaded?) connections to BaseHTTPServer

2005-08-23 Thread Adam Atlas
Never mind... I've found a workable solution: http://mail.python.org/pipermail/python-list/2001-August/062214.html Robert, thanks, I'll still check that out for any future projects; but for my current purpose, it seems overkill. But I don't know for sure; assuming BaseHTTPServer

RE: Multiple (threaded?) connections to BaseHTTPServer

2005-08-23 Thread Robert Brewer
Adam Atlas wrote: > Is there any built-in way for BaseHTTPServer to handle multiple > connections at once, e.g. with threads? If not, can this existing > module be easily extended to do this, or will I have to do lower-level > socket things (and probably thus have to write my own HTT

Multiple (threaded?) connections to BaseHTTPServer

2005-08-23 Thread Adam Atlas
Is there any built-in way for BaseHTTPServer to handle multiple connections at once, e.g. with threads? If not, can this existing module be easily extended to do this, or will I have to do lower-level socket things (and probably thus have to write my own HTTP code)? Thanks. Adam -- http

Re: BaseHTTPServer and priviledge separation?

2005-06-25 Thread Lee Harr
> to use a port below 1000 on a Unix system one needs root priviledges. > But it's dangerous to execute all of a script under those priviledges. > Therefore I'd like to drop the root priviledges as soon as possible. > (How) is this possible? > Are you sure you don't just want to use twisted? http

BaseHTTPServer and priviledge separation?

2005-06-25 Thread Helmut Jarausch
Hi, to use a port below 1000 on a Unix system one needs root priviledges. But it's dangerous to execute all of a script under those priviledges. Therefore I'd like to drop the root priviledges as soon as possible. (How) is this possible? Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer Nu

Re: BaseHTTPServer threading using SocketServer.ThreadingMixIn

2005-02-20 Thread Tortelini
It's not that, here is definition that I use: class myWebServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): pass code that runs server: server = myWebServer(('', 80), myWebHTTPHandler) LOG("Web Server starting") server.serve_forever() and here is shortened version of myWebHTTPHandl

Re: BaseHTTPServer threading using SocketServer.ThreadingMixIn

2005-02-20 Thread Paul Rubin
"Tortelini" <[EMAIL PROTECTED]> writes: > I am making custom web server using HTTPServer and want to be able to > access it simultaneously from different computers. To achieve > multithreading, I have been experimenting with ThreadingMixIn from > SocketServer, but it doesn't seem to work, One com

BaseHTTPServer threading using SocketServer.ThreadingMixIn

2005-02-20 Thread Tortelini
I am making custom web server using HTTPServer and want to be able to access it simultaneously from different computers. To achieve multithreading, I have been experimenting with ThreadingMixIn from SocketServer, but it doesn't seem to work, when I freeze code in one instance it seems to be frozen

Re: Transparent (redirecting) proxy with BaseHTTPServer

2005-01-28 Thread aurora
It should be very safe to count on the host header. Maybe some really really old browser would not support that. But they probably won't work in today's WWW anyway. Majority of today's web site is likely to be virtually hosted. One Apache maybe hosting for 50 web addresses. If a client strip

Re: Transparent (redirecting) proxy with BaseHTTPServer

2005-01-27 Thread paul koelle
Thanks, aurora ;), aurora wrote: If you actually want the IP, resolve the host header would give you that. I' m only interested in the hostname. The second form of HTTP request without the host part is for compatability of pre-HTTP/1.1 standard. All modern web browser should send the Host heade

Re: Transparent (redirecting) proxy with BaseHTTPServer

2005-01-27 Thread aurora
If you actually want the IP, resolve the host header would give you that. In the redirect case you should get a host header like Host: www.python.org From that you can reconstruct the original URL as http://www.python.org/ftp/python/contrib/. With that you can open it using urllib and proxy the

Transparent (redirecting) proxy with BaseHTTPServer

2005-01-27 Thread paul koelle
Hi list, My ultimate goal is to have a small HTTP proxy which is able to show a message specific to clients name/ip/status then handle the original request normally either by redirecting the client, or acting as a proxy. I started with a modified[1] version of TinyHTTPProxy postet by Suzuki His