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

Function continuity

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

Source from the content-addressed store, hash-verified

517 keepalive_handler.close_all()
518
519def continuity(url):
520 from hashlib import md5
521 format = '%25s: %s'
522
523 # first fetch the file with the normal http handler
524 opener = _urllib.request.build_opener()
525 _urllib.request.install_opener(opener)
526 fo = _urllib.request.urlopen(url)
527 foo = fo.read()
528 fo.close()
529 m = md5(foo)
530 print(format % ('normal urllib', m.hexdigest()))
531
532 # now install the keepalive handler and try again
533 opener = _urllib.request.build_opener(HTTPHandler())
534 _urllib.request.install_opener(opener)
535
536 fo = _urllib.request.urlopen(url)
537 foo = fo.read()
538 fo.close()
539 m = md5(foo)
540 print(format % ('keepalive read', m.hexdigest()))
541
542 fo = _urllib.request.urlopen(url)
543 foo = ''
544 while 1:
545 f = fo.readline()
546 if f: foo = foo + f
547 else: break
548 fo.close()
549 m = md5(foo)
550 print(format % ('keepalive readline', m.hexdigest()))
551
552def comp(N, url):
553 print(' making %i connections to:\n %s' % (N, url))

Callers 1

testFunction · 0.85

Calls 4

HTTPHandlerClass · 0.85
readlineMethod · 0.80
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…