view src/http/ngx_http_upstream.h @ 28:7ca9bdc82b3f NGINX_0_1_14

nginx 0.1.14 *) Feature: the autoconfiguration directives: --http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and --http-fastcgi-temp-path=PATH *) Change: the directory name for the temporary files with the client request body is specified by directive client_body_temp_path, by default it is <prefix>/client_body_temp. *) Feature: the ngx_http_fastcgi_module and the directives: fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params, fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout, fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers, fastcgi_busy_buffers_size, fastcgi_temp_path, fastcgi_max_temp_file_size, fastcgi_temp_file_write_size, fastcgi_next_upstream, and fastcgi_x_powered_by. *) Bugfix: the "[alert] zero size buf" error; bug appeared in 0.1.3. *) Change: the URI must be specified after the host name in the proxy_pass directive. *) Change: the %3F symbol in the URI was considered as the argument string start. *) Feature: the unix domain sockets support in the ngx_http_proxy_module. *) Feature: the ssl_engine and ssl_ciphers directives. Thanks to Sergey Skvortsov for SSL-accelerator.
author Igor Sysoev <http://sysoev.ru>
date Tue, 18 Jan 2005 00:00:00 +0300
parents
children da8c190bdaba
line wrap: on
line source


/*
 * Copyright (C) Igor Sysoev
 */


#ifndef _NGX_HTTP_UPSTREAM_H_INCLUDED_
#define _NGX_HTTP_UPSTREAM_H_INCLUDED_


#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
#include <ngx_event_connect.h>
#include <ngx_event_pipe.h>
#include <ngx_http.h>


#define NGX_HTTP_UPSTREAM_FT_ERROR           0x02
#define NGX_HTTP_UPSTREAM_FT_TIMEOUT         0x04
#define NGX_HTTP_UPSTREAM_FT_INVALID_HEADER  0x08
#define NGX_HTTP_UPSTREAM_FT_HTTP_500        0x10
#define NGX_HTTP_UPSTREAM_FT_HTTP_404        0x20
#define NGX_HTTP_UPSTREAM_FT_BUSY_LOCK       0x40
#define NGX_HTTP_UPSTREAM_FT_MAX_WAITING     0x80


#define NGX_HTTP_UPSTREAM_INVALID_HEADER     40


typedef struct {
    time_t                      bl_time;
    ngx_uint_t                  bl_state;

    ngx_uint_t                  status;
    time_t                      time;
    
    ngx_str_t                  *peer;
} ngx_http_upstream_state_t;


typedef struct {
    ngx_msec_t                  connect_timeout;
    ngx_msec_t                  send_timeout;
    ngx_msec_t                  read_timeout;

    size_t                      send_lowat;
    size_t                      header_buffer_size;
    size_t                      busy_buffers_size;
    size_t                      max_temp_file_size;
    size_t                      temp_file_write_size;

    ngx_uint_t                  next_upstream;

    ngx_bufs_t                  bufs;

    ngx_flag_t                  x_powered_by;
    ngx_flag_t                  cyclic_temp_file;

    ngx_path_t                 *temp_path;
} ngx_http_upstream_conf_t;


typedef struct ngx_http_upstream_s  ngx_http_upstream_t;

struct ngx_http_upstream_s {
    ngx_http_request_t         *request;

    ngx_peer_connection_t       peer;

    ngx_event_pipe_t            pipe;

    ngx_output_chain_ctx_t      output;
    ngx_chain_writer_ctx_t      writer;

    ngx_http_upstream_conf_t   *conf;

    ngx_buf_t                   header_in;

    ngx_int_t                 (*create_request)(ngx_http_request_t *r);
    ngx_int_t                 (*reinit_request)(ngx_http_request_t *r);
    ngx_int_t                 (*process_header)(ngx_http_request_t *r);
    ngx_int_t                 (*send_header)(ngx_http_request_t *r);
    void                      (*abort_request)(ngx_http_request_t *r);
    void                      (*finalize_request)(ngx_http_request_t *r,
                                                  ngx_int_t rc);
    ngx_uint_t                  method;

    ngx_str_t                   schema;
    ngx_str_t                   uri;
    ngx_str_t                  *location;

    ngx_http_log_ctx_t         *log_ctx;
    ngx_log_handler_pt          log_handler;
    ngx_http_log_ctx_t         *saved_ctx;
    ngx_log_handler_pt          saved_handler;

    /* used to parse an upstream HTTP header */
    ngx_uint_t                  status;
    u_char                     *status_start;
    u_char                     *status_end;
    ngx_uint_t                  status_count;
    ngx_uint_t                  parse_state;

    ngx_http_upstream_state_t  *state;
    ngx_array_t                 states;    /* of ngx_http_upstream_state_t */

    unsigned                    cachable:1;

    unsigned                    request_sent:1;
    unsigned                    header_sent:1;
};


void ngx_http_upstream_init(ngx_http_request_t *r);
u_char *ngx_http_upstream_log_error(void *data, u_char *buf, size_t len);


extern char *ngx_http_upstream_header_errors[];


#endif /* _NGX_HTTP_UPSTREAM_H_INCLUDED_ */