开发者

fix soaplib to support chunked requests

开发者 https://www.devze.com 2023-02-17 11:24 出处:网络
I have soap webservice built with soaplib, but if client sent chunked request it fails on length = req_env.get(\"CONTENT_LENGTH\")

I have soap webservice built with soaplib, but if client sent chunked request it fails on

length = req_env.get("CONTENT_LENGTH")
body = input.read(int(length))
because leng开发者_如何转开发th is '' (empty string), any ideas how to fix soaplib?


a bit ugly, but looks like it works:

            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 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号