arreglar soaplib para admitir solicitudes fragmentadas
-
27-10-2019 - |
Pregunta
Tengo un servicio web de jabón creado con soaplib,
pero si el cliente envió una solicitud fragmentada, falla en
length = req_env.get("CONTENT_LENGTH")
body = input.read(int(length))
porque la longitud es '' (cadena vacía), ¿alguna idea de cómo arreglar soaplib?
Solución
un poco feo, pero parece que funciona:
if '' != length: body = input.read(int(length)) elif req_env.get("HTTP_TRANSFER_ENCODING").lower() == 'chunked': chunk_size = int(input.readline(), 16) while chunk_size > 0: chunk_read_size = 0 tmp = input.read(chunk_size) chunk_read_size += len(tmp) body += tmp while chunk_read_size
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow