comparison src/stream/ngx_stream.h @ 6694:ea9dfe2f62e7

Stream: preread phase. In this phase, head of a stream is read and analysed before proceeding to the content phase. Amount of data read is controlled by the module implementing the phase, but not more than defined by the "preread_buffer_size" directive. The time spent on processing preread is controlled by the "preread_timeout" directive. The typical preread phase module will parse the beginning of a stream and set variable that may be used by the content phase, for example to make routing decision.
author Vladimir Homutov <vl@nginx.com>
date Thu, 15 Sep 2016 14:56:02 +0300
parents 3908156a51fa
children 3ab8736958cb
comparison
equal deleted inserted replaced
6693:3908156a51fa 6694:ea9dfe2f62e7
120 NGX_STREAM_PREACCESS_PHASE, 120 NGX_STREAM_PREACCESS_PHASE,
121 NGX_STREAM_ACCESS_PHASE, 121 NGX_STREAM_ACCESS_PHASE,
122 #if (NGX_STREAM_SSL) 122 #if (NGX_STREAM_SSL)
123 NGX_STREAM_SSL_PHASE, 123 NGX_STREAM_SSL_PHASE,
124 #endif 124 #endif
125 NGX_STREAM_PREREAD_PHASE,
125 NGX_STREAM_CONTENT_PHASE, 126 NGX_STREAM_CONTENT_PHASE,
126 NGX_STREAM_LOG_PHASE 127 NGX_STREAM_LOG_PHASE
127 } ngx_stream_phases; 128 } ngx_stream_phases;
128 129
129 130
179 180
180 u_char *file_name; 181 u_char *file_name;
181 ngx_uint_t line; 182 ngx_uint_t line;
182 183
183 ngx_flag_t tcp_nodelay; 184 ngx_flag_t tcp_nodelay;
185 size_t preread_buffer_size;
186 ngx_msec_t preread_timeout;
184 187
185 ngx_log_t *error_log; 188 ngx_log_t *error_log;
186 189
187 ngx_msec_t resolver_timeout; 190 ngx_msec_t resolver_timeout;
188 ngx_resolver_t *resolver; 191 ngx_resolver_t *resolver;
278 281
279 282
280 void ngx_stream_core_run_phases(ngx_stream_session_t *s); 283 void ngx_stream_core_run_phases(ngx_stream_session_t *s);
281 ngx_int_t ngx_stream_core_generic_phase(ngx_stream_session_t *s, 284 ngx_int_t ngx_stream_core_generic_phase(ngx_stream_session_t *s,
282 ngx_stream_phase_handler_t *ph); 285 ngx_stream_phase_handler_t *ph);
286 ngx_int_t ngx_stream_core_preread_phase(ngx_stream_session_t *s,
287 ngx_stream_phase_handler_t *ph);
283 ngx_int_t ngx_stream_core_content_phase(ngx_stream_session_t *s, 288 ngx_int_t ngx_stream_core_content_phase(ngx_stream_session_t *s,
284 ngx_stream_phase_handler_t *ph); 289 ngx_stream_phase_handler_t *ph);
285 290
286 291
287 void ngx_stream_init_connection(ngx_connection_t *c); 292 void ngx_stream_init_connection(ngx_connection_t *c);