diff options
author | Vladimir Homutov <vl@nginx.com> | 2020-03-13 14:39:23 +0300 |
---|---|---|
committer | Vladimir Homutov <vl@nginx.com> | 2020-03-13 14:39:23 +0300 |
commit | 05d1464c68a269e2f6ed08b5559edb90dfd3ab1f (patch) | |
tree | d2adf40e5d458f9cd66df8937b9d0628be74eea7 /src/http/ngx_http_request.c | |
parent | 5bc8cd4044fe49d672607c365929459969a338fc (diff) | |
download | nginx-05d1464c68a269e2f6ed08b5559edb90dfd3ab1f.tar.gz nginx-05d1464c68a269e2f6ed08b5559edb90dfd3ab1f.zip |
Stream "connection" read/write methods.
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r-- | src/http/ngx_http_request.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index f463e674e..55af26bf8 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -395,8 +395,39 @@ ngx_http_quic_stream_handler(ngx_connection_t *c) { ngx_quic_stream_t *qs = c->qs; + // STUB for stream read/write + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "quic stream: 0x%uXL", qs->id); + ssize_t n; + ngx_buf_t b; + + u_char buf[512]; + + b.start = buf; + b.end = buf + 512; + b.pos = b.last = b.start; + + n = c->recv(c, b.pos, b.end - b.start); + if (n < 0) { + ngx_log_error(NGX_LOG_INFO, c->log, 0, "stream read failed"); + return; + } + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, + "quic stream: 0x%uXL %ui bytes read", qs->id, n); + + b.last += n; + + n = c->send(c, b.start, n); + + if (n < 0) { + ngx_log_error(NGX_LOG_INFO, c->log, 0, "stream write failed"); + return; + } + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, + "quic stream: 0x%uXL %ui bytes written", qs->id, n); } |