Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Diez B. Roggisch
Ron Garret schrieb: On Jan 18, 12:40 pm, "Diez B. Roggisch" wrote: Ron Garret schrieb: On Jan 18, 11:29 am, "Diez B. Roggisch" wrote: Ron Garret schrieb: I'm writing a WSGI application and I would like to check the content- length header before reading the content to make sure that the c

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Ron Garret
On Jan 18, 1:21 pm, Graham Dumpleton wrote: > On Jan 19, 6:01 am, Ron Garret wrote: > > > I'm writing a WSGI application and I would like to check the content- > > length header before reading the content to make sure that the content > > is not too big in order to prevent denial-of-service attac

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Graham Dumpleton
On Jan 19, 6:43 am, Petite Abeille wrote: > On Jan 18, 2009, at 8:01 PM, Ron Garret wrote: > > > def application(environ, start_response): > >    status = "200 OK" > >    headers = [('Content-Type', 'text/html'), ] > >    start_response(status, headers) > >    if int(environ['CONTENT_LENGTH'])>100

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Graham Dumpleton
On Jan 19, 6:01 am, Ron Garret wrote: > I'm writing a WSGI application and I would like to check the content- > length header before reading the content to make sure that the content > is not too big in order to prevent denial-of-service attacks.  So I do > something like this: > > def application

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Ron Garret
On Jan 18, 12:40 pm, "Diez B. Roggisch" wrote: > Ron Garret schrieb: > > > > > On Jan 18, 11:29 am, "Diez B. Roggisch" wrote: > >> Ron Garret schrieb: > > >>> I'm writing a WSGI application and I would like to check the content- > >>> length header before reading the content to make sure that the

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Diez B. Roggisch
Ron Garret schrieb: On Jan 18, 11:29 am, "Diez B. Roggisch" wrote: Ron Garret schrieb: I'm writing a WSGI application and I would like to check the content- length header before reading the content to make sure that the content is not too big in order to prevent denial-of-service attacks.

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Ron Garret
On Jan 18, 11:43 am, Petite Abeille wrote: > On Jan 18, 2009, at 8:01 PM, Ron Garret wrote: > > > def application(environ, start_response): > >    status = "200 OK" > >    headers = [('Content-Type', 'text/html'), ] > >    start_response(status, headers) > >    if int(environ['CONTENT_LENGTH'])>10

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Ron Garret
On Jan 18, 11:29 am, "Diez B. Roggisch" wrote: > Ron Garret schrieb: > > > > > I'm writing a WSGI application and I would like to check the content- > > length header before reading the content to make sure that the content > > is not too big in order to prevent denial-of-service attacks.  So I do

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Petite Abeille
On Jan 18, 2009, at 8:01 PM, Ron Garret wrote: def application(environ, start_response): status = "200 OK" headers = [('Content-Type', 'text/html'), ] start_response(status, headers) if int(environ['CONTENT_LENGTH'])>1000: return 'File too big' How would that work for chunked tran

Re: WSGI question: reading headers before message body has been read

2009-01-18 Thread Diez B. Roggisch
Ron Garret schrieb: I'm writing a WSGI application and I would like to check the content- length header before reading the content to make sure that the content is not too big in order to prevent denial-of-service attacks. So I do something like this: def application(environ, start_response):