MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / Request

Class Request

lib/utils/har.py:88–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86 return out
87
88class Request(object):
89 def __init__(self, method, path, httpVersion, headers, postBody=None, raw=None, comment=None):
90 self.method = method
91 self.path = path
92 self.httpVersion = httpVersion
93 self.headers = headers or {}
94 self.postBody = postBody
95 self.comment = comment.strip() if comment else comment
96 self.raw = raw
97
98 @classmethod
99 def parse(cls, raw):
100 request = HTTPRequest(raw)
101 return cls(method=request.command,
102 path=request.path,
103 httpVersion=request.request_version,
104 headers=request.headers,
105 postBody=request.rfile.read(),
106 comment=request.comment,
107 raw=raw)
108
109 @property
110 def url(self):
111 host = self.headers.get("Host", "unknown")
112 return "http://%s%s" % (host, self.path)
113
114 def toDict(self):
115 out = {
116 "httpVersion": self.httpVersion,
117 "method": self.method,
118 "url": self.url,
119 "headers": [dict(name=key.capitalize(), value=value) for key, value in self.headers.items()],
120 "cookies": [],
121 "queryString": [],
122 "headersSize": -1,
123 "bodySize": -1,
124 "comment": getText(self.comment),
125 }
126
127 if self.postBody:
128 contentType = self.headers.get("Content-Type")
129 out["postData"] = {
130 "mimeType": contentType,
131 "text": getText(self.postBody).rstrip("\r\n"),
132 }
133
134 return out
135
136class Response(object):
137 extract_status = re.compile(b'\\((\\d{3}) (.*)\\)')

Callers 2

copyMethod · 0.85
retrieveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…