MCPcopy Create free account
hub / github.com/RustPython/RustPython / set_content_length

Method set_content_length

Lib/wsgiref/handlers.py:204–214  ·  view source on GitHub ↗

Compute Content-Length or switch to chunked encoding if possible

(self)

Source from the content-addressed store, hash-verified

202
203
204 def set_content_length(self):
205 """Compute Content-Length or switch to chunked encoding if possible"""
206 try:
207 blocks = len(self.result)
208 except (TypeError,AttributeError,NotImplementedError):
209 pass
210 else:
211 if blocks==1:
212 self.headers['Content-Length'] = str(self.bytes_sent)
213 return
214 # XXX Try for chunked encoding if origin server and client is 1.1
215
216
217 def cleanup_headers(self):

Callers 1

cleanup_headersMethod · 0.95

Calls 2

lenFunction · 0.85
strFunction · 0.85

Tested by

no test coverage detected