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

Function _setHTTPExtraHeaders

lib/core/option.py:1409–1441  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1407 authHandler = HTTPSPKIAuthHandler(_)
1408
1409def _setHTTPExtraHeaders():
1410 if conf.headers:
1411 debugMsg = "setting extra HTTP headers"
1412 logger.debug(debugMsg)
1413
1414 if "\\n" in conf.headers:
1415 conf.headers = conf.headers.replace("\\r\\n", "\\n").split("\\n")
1416 else:
1417 conf.headers = conf.headers.replace("\r\n", "\n").split("\n")
1418
1419 for headerValue in conf.headers:
1420 if not headerValue.strip():
1421 continue
1422
1423 if headerValue.count(':') >= 1:
1424 header, value = (_.lstrip() for _ in headerValue.split(":", 1))
1425
1426 if header and value:
1427 conf.httpHeaders.append((header, value))
1428 elif headerValue.startswith('@'):
1429 checkFile(headerValue[1:])
1430 kb.headersFile = headerValue[1:]
1431 else:
1432 errMsg = "invalid header value: %s. Valid header format is 'name:value'" % repr(headerValue).lstrip('u')
1433 raise SqlmapSyntaxException(errMsg)
1434
1435 elif not conf.requestFile and len(conf.httpHeaders or []) < 2:
1436 if conf.encoding:
1437 conf.httpHeaders.append((HTTP_HEADER.ACCEPT_CHARSET, "%s;q=0.7,*;q=0.1" % conf.encoding))
1438
1439 # Invalidating any caching mechanism in between
1440 # Reference: http://stackoverflow.com/a/1383359
1441 conf.httpHeaders.append((HTTP_HEADER.CACHE_CONTROL, "no-cache"))
1442
1443def _setHTTPUserAgent():
1444 """

Callers 1

initFunction · 0.85

Calls 5

checkFileFunction · 0.90
debugMethod · 0.80
replaceMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…