29 Commits

Author SHA1 Message Date
benoitc
be19f414ae close #294 .
Thanks for the patch
2012-02-20 11:23:58 +01:00
benoitc
7a1c58f236 test number of headers fields and size.
Add --limit-request-fields (limit_request_fields) and
--limit-request-field-size (limit-request-field-size) options.

- limit_request_fields:

    Value is a number from 0 (unlimited) to 32768. This parameter is
    used to limit the number of headers in a request to prevent DDOS
    attack. Used with the `limit_request_field_size` it allows more
    safety.

- limit_request_field_size:

    Value is a number from 0 (unlimited) to 8190. to set the limit
    on the allowed size of an HTTP request header field.
2012-02-20 10:36:13 +01:00
benoitc
b7b0979ad9 check if Request Line is too large.
You can now pass the parameter --limit-request-line or set the
limit_request_line in your configuration file to set the max size of the
request line in bytes.

This parameter is used to limit the allowed size of a client's HTTP
request-line. Since the request-line consists of the HTTP method, URI,
and protocol version, this directive places a restriction on the length
of a request-URI allowed for a request on the server. A server needs
this value to be large enough to hold any of its resource names,
including any information that might be passed in the query part of a
GET request. By default this value is 4094 and can't be larger than
8190.

This parameter can be used to prevent any DDOS attack.
2012-02-20 09:56:06 +01:00
benoitc
9631c2ab5a with_statement. spotted by @jbergstroem on irc 2010-07-05 17:06:17 +02:00
benoitc
c89ce5f5ad debug behavior has changed. 2010-07-01 07:20:36 +02:00
Randall Leeds
4e20f606f1 fix inconsistencies with urlparse lib 2010-07-01 13:15:15 +08:00
Paul J. Davis
2763fe8e9f Added tests for invalid requests.
Need to flesh out more error cases.
2010-06-03 16:11:18 -04:00
Paul J. Davis
5af1273fc2 Added more valid request tests.
Found and fixed a couple read and readline related bugs.
2010-06-03 16:11:18 -04:00
Paul J. Davis
27cc404f1f Imported simplehttp request tests. 2010-06-03 16:11:17 -04:00
benoitc
dd620a5788 add missing license header 2010-05-22 11:59:41 +02:00
Paul J. Davis
6ffbe54734 Added unit tests for new Config code. 2010-05-21 22:54:22 -04:00
benoitc
c785be0780 new parser using StringIO, faster than concatenate strings. Lot of fixes
in TeeInput.
2010-03-06 20:47:39 +01:00
jbergstroem
e5e6b70895 Fix failed tests due to lack of passing config to a Request 2010-03-03 15:44:54 +08:00
benoitc
ea02c5e073 this seems to fix problem with upload. Tested with the django app 2010-02-28 22:46:35 +01:00
benoitc
d92364af71 new read_partial function. We also now use buffer in parser. 2010-02-28 22:46:35 +01:00
benoitc
c557ecc93b the way to get full path is "SCHEME://SERVER_NAME:SERVER_PORT" +
SCRIPT_NAME + PATH_INFO
2010-02-18 11:31:24 +01:00
Benoit Chesneau
87336be46b remove unused import/var and some fixes 2010-02-16 14:24:40 +01:00
Paul J. Davis
47776417d5 Repeated headers request test.
Test the environ produced by a request object for repeated headers.
2010-02-10 11:01:14 -05:00
Paul J. Davis
588b48b2cd Comma separate repeated request headers.
RFC 2616 says that only headers that are allowed to have comma separated
values are acceptable for repetition. Though it doesn't specify an error
condition for that situation. I reckon the cleanest way would be to list
the headers that are acceptable for repetition, and return a 400 Bad
Request.
2010-02-10 10:55:09 -05:00
Paul J. Davis
9e717b8f9c Refactoring the worker loop.
Accidentally got a bit carried away.
2010-01-31 17:45:26 -05:00
Eric Florenzano
036735b456 Used PyFlakes to detect and fix unneeded imports. 2010-01-21 13:23:35 -08:00
Benoit Chesneau
2f959f9251 typo 2010-01-21 01:20:09 +01:00
Benoit Chesneau
ec644bdf90 rename http_parser.py to parser.py we are already in http module 2010-01-21 01:13:12 +01:00
Benoit Chesneau
6da023a7da clean a litle the rep 2010-01-21 00:51:48 +01:00
Benoit Chesneau
b568852465 add request unitests. fix TeeInput & parser 2010-01-21 00:18:42 +01:00
Benoit Chesneau
ba6db08825 add license headers to tests 2010-01-20 22:01:45 +01:00
Benoit Chesneau
db01c210a2 Set blocking to 0 back since we prevented inheritence of the socket the socket. 2010-01-20 18:06:35 +01:00
Benoit Chesneau
bfeb4f9416 fix chunked encoding and add tests 2010-01-20 16:21:20 +01:00
Benoit Chesneau
d4ae13cde0 forgot to commit tests 2010-01-20 15:21:57 +01:00