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

Function test_timeout

thirdparty/keepalive/keepalive.py:590–621  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

588 return diff
589
590def test_timeout(url):
591 global DEBUG
592 dbbackup = DEBUG
593 class FakeLogger:
594 def debug(self, msg, *args): print(msg % args)
595 info = warning = error = debug
596 DEBUG = FakeLogger()
597 print(" fetching the file to establish a connection")
598 fo = _urllib.request.urlopen(url)
599 data1 = fo.read()
600 fo.close()
601
602 i = 20
603 print(" waiting %i seconds for the server to close the connection" % i)
604 while i > 0:
605 sys.stdout.write('\r %2i' % i)
606 sys.stdout.flush()
607 time.sleep(1)
608 i -= 1
609 sys.stderr.write('\r')
610
611 print(" fetching the file a second time")
612 fo = _urllib.request.urlopen(url)
613 data2 = fo.read()
614 fo.close()
615
616 if data1 == data2:
617 print(' data are identical')
618 else:
619 print(' ERROR: DATA DIFFER')
620
621 DEBUG = dbbackup
622
623
624def test(url, N=10):

Callers 1

testFunction · 0.85

Calls 5

FakeLoggerClass · 0.85
readMethod · 0.45
closeMethod · 0.45
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…