mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
Patch for an Issue #997
This commit is contained in:
parent
bd99470a4a
commit
ff0dd8eefe
4
thirdparty/multipart/multipartpost.py
vendored
4
thirdparty/multipart/multipartpost.py
vendored
|
@ -88,7 +88,11 @@ class MultipartPostHandler(urllib2.BaseHandler):
|
||||||
for (key, fd) in files:
|
for (key, fd) in files:
|
||||||
file_size = os.fstat(fd.fileno())[stat.ST_SIZE] if isinstance(fd, file) else fd.len
|
file_size = os.fstat(fd.fileno())[stat.ST_SIZE] if isinstance(fd, file) else fd.len
|
||||||
filename = fd.name.split('/')[-1] if '/' in fd.name else fd.name.split('\\')[-1]
|
filename = fd.name.split('/')[-1] if '/' in fd.name else fd.name.split('\\')[-1]
|
||||||
|
try:
|
||||||
contenttype = mimetypes.guess_type(filename)[0] or 'application/octet-stream'
|
contenttype = mimetypes.guess_type(filename)[0] or 'application/octet-stream'
|
||||||
|
except:
|
||||||
|
# Reference: http://bugs.python.org/issue9291
|
||||||
|
contenttype = 'application/octet-stream'
|
||||||
buf += '--%s\r\n' % boundary
|
buf += '--%s\r\n' % boundary
|
||||||
buf += 'Content-Disposition: form-data; name="%s"; filename="%s"\r\n' % (key, filename)
|
buf += 'Content-Disposition: form-data; name="%s"; filename="%s"\r\n' % (key, filename)
|
||||||
buf += 'Content-Type: %s\r\n' % contenttype
|
buf += 'Content-Type: %s\r\n' % contenttype
|
||||||
|
|
Loading…
Reference in New Issue
Block a user