MCPcopy Index your code
hub / github.com/secdev/scapy / answer

Method answer

scapy/layers/http.py:1275–1290  ·  view source on GitHub ↗

HTTP_server answer function. :param pkt: a HTTPRequest packet :returns: a HTTPResponse packet

(self, pkt)

Source from the content-addressed store, hash-verified

1273 # DEV: overwrite this function
1274
1275 def answer(self, pkt):
1276 """
1277 HTTP_server answer function.
1278
1279 :param pkt: a HTTPRequest packet
1280 :returns: a HTTPResponse packet
1281 """
1282 if pkt.Path == b"/":
1283 return HTTPResponse() / (
1284 "<!doctype html><html><body><h1>OK</h1></body></html>"
1285 )
1286 else:
1287 return HTTPResponse(
1288 Status_Code=b"404",
1289 Reason_Phrase=b"Not Found",
1290 ) / ("<!doctype html><html><body><h1>404 - Not Found</h1></body></html>")
1291
1292
1293class HTTPS_Server(HTTP_Server):

Callers 1

SERVEMethod · 0.95

Calls 1

HTTPResponseClass · 0.85

Tested by

no test coverage detected