|
|
@@ -7,8 +7,7 @@ |
|
|
|
import httpclient |
|
|
|
import httplib |
|
|
|
import sys |
|
|
|
|
|
|
|
|
|
|
|
import socket |
|
|
|
|
|
|
|
def test(X): |
|
|
|
if not X: |
|
|
@@ -43,8 +42,12 @@ test(session.transmit('/post',post_data = 'test=value')=='ok') |
|
|
|
print "- Testing Content-Length limits" |
|
|
|
|
|
|
|
test(session.transmit('/post',post_data = 'test=' + 'x'*(1024-5)) == 'ok') |
|
|
|
session.transmit('/post',post_data = 'test=' + 'x'*(1024-4)); |
|
|
|
test(session.status==413) |
|
|
|
try: |
|
|
|
session.status = 0 |
|
|
|
session.transmit('/post',post_data = 'test=' + 'x'*(1024-4)); |
|
|
|
test(session.status==413 ) |
|
|
|
except socket.error: |
|
|
|
print "-- got socket.error" |
|
|
|
|
|
|
|
print "- Testing Upload limits" |
|
|
|
|
|
|
@@ -64,18 +67,43 @@ session = httpclient.Session(print_cookies = False) |
|
|
|
|
|
|
|
test(session.transmit('/post',post_data = normal_file_data1,content_type = 'multipart/form-data; boundary=123456') == 'ok') |
|
|
|
test(session.transmit('/post',post_data = normal_file_data2,content_type = 'multipart/form-data; boundary=123456') == 'ok') |
|
|
|
session.transmit('/post',post_data = big_file_data1,content_type = 'multipart/form-data; boundary=123456') |
|
|
|
test(session.status==413) |
|
|
|
session.status = 0 |
|
|
|
session.transmit('/post',post_data = big_file_data2,content_type = 'multipart/form-data; boundary=123456') |
|
|
|
test(session.status==413) |
|
|
|
session.transmit('/post',post_data = normal_file_data1,content_type = 'multipart/form-data; boundary=abcde') |
|
|
|
test(session.status==400) |
|
|
|
session.status = 0 |
|
|
|
session.transmit('/post',post_data = normal_file_data1,content_type = 'multipart/form-data') |
|
|
|
test(session.status==400) |
|
|
|
session.status = 0 |
|
|
|
session.transmit('/post',post_data = bad_file_data1,content_type = 'multipart/form-data; boundary=123456') |
|
|
|
test(session.status==400) |
|
|
|
|
|
|
|
try: |
|
|
|
session.status = 0 |
|
|
|
session.transmit('/post',post_data = big_file_data1,content_type = 'multipart/form-data; boundary=123456') |
|
|
|
test(session.status==413) |
|
|
|
except socket.error: |
|
|
|
print "-- got socket.error" |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
session.status = 0 |
|
|
|
session.transmit('/post',post_data = big_file_data2,content_type = 'multipart/form-data; boundary=123456') |
|
|
|
test(session.status==413) |
|
|
|
except socket.error: |
|
|
|
print "-- got socket.error" |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
session.status = 0 |
|
|
|
session.transmit('/post',post_data = normal_file_data1,content_type = 'multipart/form-data; boundary=abcde') |
|
|
|
test(session.status==400) |
|
|
|
except socket.error: |
|
|
|
print "-- got socket.error" |
|
|
|
|
|
|
|
try: |
|
|
|
session.status = 0 |
|
|
|
session.transmit('/post',post_data = normal_file_data1,content_type = 'multipart/form-data') |
|
|
|
test(session.status==400) |
|
|
|
except socket.error: |
|
|
|
print "-- got socket.error" |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
session.status = 0 |
|
|
|
session.transmit('/post',post_data = bad_file_data1,content_type = 'multipart/form-data; boundary=123456') |
|
|
|
test(session.status==400) |
|
|
|
except socket.error: |
|
|
|
print "-- got socket.error" |
|
|
|
|
|
|
|
|