mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-07 13:11:29 +00:00
Important refactoring for web-based functionality
This commit is contained in:
5
thirdparty/multipart/multipartpost.py
vendored
5
thirdparty/multipart/multipartpost.py
vendored
@@ -24,6 +24,7 @@ import mimetools
|
||||
import mimetypes
|
||||
import os
|
||||
import stat
|
||||
import StringIO
|
||||
import sys
|
||||
import urllib
|
||||
import urllib2
|
||||
@@ -52,7 +53,7 @@ class MultipartPostHandler(urllib2.BaseHandler):
|
||||
|
||||
try:
|
||||
for(key, value) in data.items():
|
||||
if type(value) == file or hasattr(value, 'file'):
|
||||
if isinstance(value, file) or hasattr(value, 'file') or isinstance(value, StringIO.StringIO):
|
||||
v_files.append((key, value))
|
||||
else:
|
||||
v_vars.append((key, value))
|
||||
@@ -85,7 +86,7 @@ class MultipartPostHandler(urllib2.BaseHandler):
|
||||
buf += '\r\n\r\n' + value + '\r\n'
|
||||
|
||||
for (key, fd) in files:
|
||||
file_size = os.fstat(fd.fileno())[stat.ST_SIZE]
|
||||
file_size = os.fstat(fd.fileno())[stat.ST_SIZE] if isinstance(fd, file) else fd.len
|
||||
filename = fd.name.split('/')[-1]
|
||||
contenttype = mimetypes.guess_type(filename)[0] or 'application/octet-stream'
|
||||
buf += '--%s\r\n' % boundary
|
||||
|
||||
Reference in New Issue
Block a user