예제 #1
0
        raise IOError("unable to send websocket message")
uwsgi.websocket_send = uwsgi_pypy_websocket_send

"""
uwsgi.chunked_read(timeout=0)
"""
def uwsgi_pypy_chunked_read(timeout=0):
    wsgi_req = uwsgi_pypy_current_wsgi_req();
    rlen = ffi.new("size_t*")
    chunk = lib.uwsgi_chunked_read(wsgi_req, rlen, timeout, 0)
    if chunk == ffi.NULL:
        raise IOError("unable to receive chunked part")
    return ffi.string(chunk, rlen[0])
uwsgi.chunked_read = uwsgi_pypy_chunked_read

"""
uwsgi.chunked_read_nb()
"""
def uwsgi_pypy_chunked_read_nb():
    wsgi_req = uwsgi_pypy_current_wsgi_req();
    rlen = ffi.new("size_t*")
    chunk = lib.uwsgi_chunked_read(wsgi_req, rlen, 0, 1)
    if chunk == ffi.NULL:
        if lib.uwsgi_is_again() > 0:
            return None
        raise IOError("unable to receive chunked part")
    
    return ffi.string(chunk, rlen[0])
uwsgi.chunked_read_nb = uwsgi_pypy_chunked_read_nb

"""
예제 #2
0
        raise IOError("unable to send websocket message")
uwsgi.websocket_send = uwsgi_pypy_websocket_send

"""
uwsgi.chunked_read(timeout=0)
"""
def uwsgi_pypy_chunked_read(timeout=0):
    wsgi_req = uwsgi_pypy_current_wsgi_req();
    rlen = ffi.new("size_t*")
    chunk = lib.uwsgi_chunked_read(wsgi_req, rlen, timeout, 0)
    if chunk == ffi.NULL:
        raise IOError("unable to receive chunked part")
    return ffi.string(chunk, rlen[0])
uwsgi.chunked_read = uwsgi_pypy_chunked_read

"""
uwsgi.chunked_read_nb()
"""
def uwsgi_pypy_chunked_read_nb():
    wsgi_req = uwsgi_pypy_current_wsgi_req();
    rlen = ffi.new("size_t*")
    chunk = lib.uwsgi_chunked_read(wsgi_req, rlen, 0, 1)
    if chunk == ffi.NULL:
        if lib.uwsgi_is_again() > 0:
            return None
        raise IOError("unable to receive chunked part")
    
    return ffi.string(chunk, rlen[0])
uwsgi.chunked_read_nb = uwsgi_pypy_chunked_read_nb

"""