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

Method addheader

thirdparty/clientform/clientform.py:382–402  ·  view source on GitHub ↗

prefix is ignored if add_to_http_hdrs is true.

(self, key, value, prefix=0,
                  add_to_http_hdrs=0)

Source from the content-addressed store, hash-verified

380 self._first_part = True
381
382 def addheader(self, key, value, prefix=0,
383 add_to_http_hdrs=0):
384 """
385 prefix is ignored if add_to_http_hdrs is true.
386 """
387 lines = value.split("\r\n")
388 while lines and not lines[-1]: del lines[-1]
389 while lines and not lines[0]: del lines[0]
390 if add_to_http_hdrs:
391 value = "".join(lines)
392 # 2.2 urllib2 doesn't normalize header case
393 self._http_hdrs.append((key.capitalize(), value))
394 else:
395 for i in xrange(1, len(lines)):
396 lines[i] = " " + lines[i].strip()
397 value = "\r\n".join(lines) + "\r\n"
398 line = key.title() + ": " + value
399 if prefix:
400 self._headers.insert(0, line)
401 else:
402 self._headers.append(line)
403
404 def flushheaders(self):
405 self._fp.writelines(self._headers)

Callers 3

startbodyMethod · 0.95
_write_mime_dataMethod · 0.80
_write_mime_dataMethod · 0.80

Calls 5

xrangeClass · 0.85
capitalizeMethod · 0.80
titleMethod · 0.80
appendMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected