diff options
author | Max Romanov <max.romanov@nginx.com> | 2021-12-27 16:37:35 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2021-12-27 16:37:35 +0300 |
commit | f8452838207d56892fb80b5976b37aab1efcaa1e (patch) | |
tree | 34ae7e0ab5df034c01377de108f9fc964e9d11d1 /src/perl/nxt_perl_psgi_layer.h | |
parent | 650784928293bb07b5b4acf4b14d3845b011556d (diff) | |
download | unit-f8452838207d56892fb80b5976b37aab1efcaa1e.tar.gz unit-f8452838207d56892fb80b5976b37aab1efcaa1e.tar.bz2 |
Perl: creating input and error streams if closed.
Application handler can do anything with a stream object (including close it).
Once the stream is closed, Unit creates a new stream.
This closes #616 issue on GitHub.
Diffstat (limited to 'src/perl/nxt_perl_psgi_layer.h')
-rw-r--r-- | src/perl/nxt_perl_psgi_layer.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/perl/nxt_perl_psgi_layer.h b/src/perl/nxt_perl_psgi_layer.h index af18ad0d..0972d66f 100644 --- a/src/perl/nxt_perl_psgi_layer.h +++ b/src/perl/nxt_perl_psgi_layer.h @@ -14,35 +14,35 @@ #include <perliol.h> +typedef struct nxt_perl_psgi_io_tab_s nxt_perl_psgi_io_tab_t; typedef struct nxt_perl_psgi_io_arg_s nxt_perl_psgi_io_arg_t; -typedef long (*nxt_perl_psgi_io_read_f)(PerlInterpreter *my_perl, - nxt_perl_psgi_io_arg_t *arg, void *vbuf, size_t length); -typedef long (*nxt_perl_psgi_io_write_f)(PerlInterpreter *my_perl, - nxt_perl_psgi_io_arg_t *arg, const void *vbuf, size_t length); -typedef long (*nxt_perl_psgi_io_arg_f)(PerlInterpreter *my_perl, - nxt_perl_psgi_io_arg_t *arg); + +struct nxt_perl_psgi_io_tab_s { + SSize_t (*read)(PerlInterpreter *my_perl, + nxt_perl_psgi_io_arg_t *arg, void *vbuf, size_t length); + SSize_t (*write)(PerlInterpreter *my_perl, + nxt_perl_psgi_io_arg_t *arg, const void *vbuf, size_t length); +}; struct nxt_perl_psgi_io_arg_s { - SV *io; - PerlIO *fp; + SV *rv; + SV *io; + PerlIO *fp; - nxt_perl_psgi_io_arg_f flush; - nxt_perl_psgi_io_read_f read; - nxt_perl_psgi_io_write_f write; + const nxt_perl_psgi_io_tab_t *io_tab; - void *pctx; + void *req; }; void nxt_perl_psgi_layer_stream_init(pTHX); -PerlIO *nxt_perl_psgi_layer_stream_fp_create(pTHX_ nxt_perl_psgi_io_arg_t *arg, +PerlIO *nxt_perl_psgi_layer_stream_fp_create(pTHX_ SV *arg_rv, const char *mode); void nxt_perl_psgi_layer_stream_fp_destroy(pTHX_ PerlIO *io); SV *nxt_perl_psgi_layer_stream_io_create(pTHX_ PerlIO *fp); -void nxt_perl_psgi_layer_stream_io_destroy(pTHX_ SV *rvio); #endif /* _NXT_PERL_PSGI_LAYER_H_INCLUDED_ */ |