2019-05-08 12:47:52 +02:00
|
|
|
#!/usr/bin/env python
|
2010-09-15 12:45:41 +00:00
|
|
|
|
|
|
|
|
"""
|
2025-05-08 23:54:39 +02:00
|
|
|
Copyright (c) 2006-2025 sqlmap developers (https://sqlmap.org)
|
2017-10-11 14:50:46 +02:00
|
|
|
See the file 'LICENSE' for copying permission
|
2010-09-15 12:45:41 +00:00
|
|
|
"""
|
|
|
|
|
|
2019-11-13 11:29:42 +01:00
|
|
|
from lib.core.convert import getText
|
2019-03-27 13:33:46 +01:00
|
|
|
from thirdparty.six.moves import urllib as _urllib
|
2010-09-15 12:45:41 +00:00
|
|
|
|
2019-03-27 13:33:46 +01:00
|
|
|
class MethodRequest(_urllib.request.Request):
|
2015-01-14 16:11:55 +01:00
|
|
|
"""
|
2019-03-27 13:33:46 +01:00
|
|
|
Used to create HEAD/PUT/DELETE/... requests with urllib
|
2015-01-14 16:11:55 +01:00
|
|
|
"""
|
2010-10-15 10:28:34 +00:00
|
|
|
|
2010-09-15 12:45:41 +00:00
|
|
|
def set_method(self, method):
|
2019-11-13 11:29:42 +01:00
|
|
|
self.method = getText(method.upper()) # Dirty hack for Python3 (may it rot in hell!)
|
2010-10-15 10:28:34 +00:00
|
|
|
|
2010-09-15 12:45:41 +00:00
|
|
|
def get_method(self):
|
2019-03-27 13:33:46 +01:00
|
|
|
return getattr(self, 'method', _urllib.request.Request.get_method(self))
|