equal
deleted
inserted
replaced
497 self.cookiejar.add_cookie_header(request) |
497 self.cookiejar.add_cookie_header(request) |
498 |
498 |
499 return request |
499 return request |
500 |
500 |
501 |
501 |
|
502 class readlinehandler(urlreq.basehandler): |
|
503 def http_response(self, request, response): |
|
504 class readlineresponse(response.__class__): |
|
505 def readlines(self, sizehint=0): |
|
506 total = 0 |
|
507 list = [] |
|
508 while True: |
|
509 line = self.readline() |
|
510 if not line: |
|
511 break |
|
512 list.append(line) |
|
513 total += len(line) |
|
514 if sizehint and total >= sizehint: |
|
515 break |
|
516 return list |
|
517 |
|
518 response.__class__ = readlineresponse |
|
519 return response |
|
520 |
|
521 https_response = http_response |
|
522 |
|
523 |
502 handlerfuncs = [] |
524 handlerfuncs = [] |
503 |
525 |
504 |
526 |
505 def opener( |
527 def opener( |
506 ui, |
528 ui, |
562 handlers.extend( |
584 handlers.extend( |
563 (httpbasicauthhandler(passmgr), httpdigestauthhandler(passmgr)) |
585 (httpbasicauthhandler(passmgr), httpdigestauthhandler(passmgr)) |
564 ) |
586 ) |
565 handlers.extend([h(ui, passmgr) for h in handlerfuncs]) |
587 handlers.extend([h(ui, passmgr) for h in handlerfuncs]) |
566 handlers.append(cookiehandler(ui)) |
588 handlers.append(cookiehandler(ui)) |
|
589 handlers.append(readlinehandler()) |
567 opener = urlreq.buildopener(*handlers) |
590 opener = urlreq.buildopener(*handlers) |
568 |
591 |
569 # keepalive.py's handlers will populate these attributes if they exist. |
592 # keepalive.py's handlers will populate these attributes if they exist. |
570 opener.requestscount = 0 |
593 opener.requestscount = 0 |
571 opener.sentbytescount = 0 |
594 opener.sentbytescount = 0 |