return NGX_ERROR;
}
- if (flags & NGX_SSL_BUFFER) {
- sc->buffer = 1;
-
- sc->buf = ngx_create_temp_buf(c->pool, NGX_SSL_BUFSIZE);
- if (sc->buf == NULL) {
- return NGX_ERROR;
- }
- }
+ sc->buffer = ((flags & NGX_SSL_BUFFER) != 0);
sc->connection = SSL_new(ssl->ctx);
limit = NGX_MAX_UINT32_VALUE - ngx_pagesize;
}
-
buf = c->ssl->buf;
+
+ if (buf == NULL) {
+ buf = ngx_create_temp_buf(c->pool, NGX_SSL_BUFSIZE);
+ if (buf == NULL) {
+ return NGX_CHAIN_ERROR;
+ }
+
+ c->ssl->buf = buf;
+ }
+
+ if (buf->start == NULL) {
+ buf->start = ngx_palloc(c->pool, NGX_SSL_BUFSIZE);
+ if (buf->start == NULL) {
+ return NGX_CHAIN_ERROR;
+ }
+
+ buf->pos = buf->start;
+ buf->last = buf->start;
+ buf->end = buf->start + NGX_SSL_BUFSIZE;
+ }
+
send = 0;
flush = (in == NULL) ? 1 : 0;
}
+void
+ngx_ssl_free_buffer(ngx_connection_t *c)
+{
+ if (ngx_pfree(c->pool, c->ssl->buf->start) == NGX_OK) {
+ c->ssl->buf->start = NULL;
+ }
+}
+
+
ngx_int_t
ngx_ssl_shutdown(ngx_connection_t *c)
{
ssize_t ngx_ssl_recv_chain(ngx_connection_t *c, ngx_chain_t *cl);
ngx_chain_t *ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in,
off_t limit);
+void ngx_ssl_free_buffer(ngx_connection_t *c);
ngx_int_t ngx_ssl_shutdown(ngx_connection_t *c);
void ngx_cdecl ngx_ssl_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
char *fmt, ...);