MCPcopy
hub / github.com/benoitc/gunicorn / write

Method write

gunicorn/http/wsgi.py:421–442  ·  view source on GitHub ↗
(self, arg)

Source from the content-addressed store, hash-verified

419 self.headers_sent = True
420
421 def write(self, arg):
422 self.send_headers()
423 if not isinstance(arg, bytes):
424 raise TypeError('%r is not a byte' % arg)
425 arglen = len(arg)
426 tosend = arglen
427 if self.response_length is not None:
428 if self.sent >= self.response_length:
429 # Never write more than self.response_length bytes
430 return
431
432 tosend = min(self.response_length - self.sent, tosend)
433 if tosend < arglen:
434 arg = arg[:tosend]
435
436 # Sending an empty chunk signals the end of the
437 # response and prematurely closes the response
438 if self.chunked and tosend == 0:
439 return
440
441 self.sent += tosend
442 util.write(self.sock, arg, self.chunked)
443
444 def can_sendfile(self):
445 return self.cfg.sendfile is not False

Callers 15

write_fileMethod · 0.95
validate_ssl_versionFunction · 0.45
createMethod · 0.45
readMethod · 0.45
parse_trailersMethod · 0.45
parse_chunk_sizeMethod · 0.45
get_dataMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readlineMethod · 0.45
readMethod · 0.45

Calls 1

send_headersMethod · 0.95

Tested by

no test coverage detected