src/http/ngx_http.h - nginx-1.7.10

Data types defined

Macros defined

Source code


  1. /*
  2. * Copyright (C) Igor Sysoev
  3. * Copyright (C) Nginx, Inc.
  4. */


  5. #ifndef _NGX_HTTP_H_INCLUDED_
  6. #define _NGX_HTTP_H_INCLUDED_


  7. #include <ngx_config.h>
  8. #include <ngx_core.h>


  9. typedef struct ngx_http_request_s     ngx_http_request_t;
  10. typedef struct ngx_http_upstream_s    ngx_http_upstream_t;
  11. typedef struct ngx_http_cache_s       ngx_http_cache_t;
  12. typedef struct ngx_http_file_cache_s  ngx_http_file_cache_t;
  13. typedef struct ngx_http_log_ctx_s     ngx_http_log_ctx_t;
  14. typedef struct ngx_http_chunked_s     ngx_http_chunked_t;

  15. #if (NGX_HTTP_SPDY)
  16. typedef struct ngx_http_spdy_stream_s  ngx_http_spdy_stream_t;
  17. #endif

  18. typedef ngx_int_t (*ngx_http_header_handler_pt)(ngx_http_request_t *r,
  19.     ngx_table_elt_t *h, ngx_uint_t offset);
  20. typedef u_char *(*ngx_http_log_handler_pt)(ngx_http_request_t *r,
  21.     ngx_http_request_t *sr, u_char *buf, size_t len);


  22. #include <ngx_http_variables.h>
  23. #include <ngx_http_config.h>
  24. #include <ngx_http_request.h>
  25. #include <ngx_http_script.h>
  26. #include <ngx_http_upstream.h>
  27. #include <ngx_http_upstream_round_robin.h>
  28. #include <ngx_http_busy_lock.h>
  29. #include <ngx_http_core_module.h>

  30. #if (NGX_HTTP_SPDY)
  31. #include <ngx_http_spdy.h>
  32. #endif
  33. #if (NGX_HTTP_CACHE)
  34. #include <ngx_http_cache.h>
  35. #endif
  36. #if (NGX_HTTP_SSI)
  37. #include <ngx_http_ssi_filter_module.h>
  38. #endif
  39. #if (NGX_HTTP_SSL)
  40. #include <ngx_http_ssl_module.h>
  41. #endif


  42. struct ngx_http_log_ctx_s {
  43.     ngx_connection_t    *connection;
  44.     ngx_http_request_t  *request;
  45.     ngx_http_request_t  *current_request;
  46. };


  47. struct ngx_http_chunked_s {
  48.     ngx_uint_t           state;
  49.     off_t                size;
  50.     off_t                length;
  51. };


  52. typedef struct {
  53.     ngx_uint_t           http_version;
  54.     ngx_uint_t           code;
  55.     ngx_uint_t           count;
  56.     u_char              *start;
  57.     u_char              *end;
  58. } ngx_http_status_t;


  59. #define ngx_http_get_module_ctx(r, module)  (r)->ctx[module.ctx_index]
  60. #define ngx_http_set_ctx(r, c, module)      r->ctx[module.ctx_index] = c;


  61. ngx_int_t ngx_http_add_location(ngx_conf_t *cf, ngx_queue_t **locations,
  62.     ngx_http_core_loc_conf_t *clcf);
  63. ngx_int_t ngx_http_add_listen(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf,
  64.     ngx_http_listen_opt_t *lsopt);


  65. void ngx_http_init_connection(ngx_connection_t *c);
  66. void ngx_http_close_connection(ngx_connection_t *c);

  67. #if (NGX_HTTP_SSL && defined SSL_CTRL_SET_TLSEXT_HOSTNAME)
  68. int ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg);
  69. #endif

  70. ngx_int_t ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b);
  71. ngx_int_t ngx_http_parse_uri(ngx_http_request_t *r);
  72. ngx_int_t ngx_http_parse_complex_uri(ngx_http_request_t *r,
  73.     ngx_uint_t merge_slashes);
  74. ngx_int_t ngx_http_parse_status_line(ngx_http_request_t *r, ngx_buf_t *b,
  75.     ngx_http_status_t *status);
  76. ngx_int_t ngx_http_parse_unsafe_uri(ngx_http_request_t *r, ngx_str_t *uri,
  77.     ngx_str_t *args, ngx_uint_t *flags);
  78. ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b,
  79.     ngx_uint_t allow_underscores);
  80. ngx_int_t ngx_http_parse_multi_header_lines(ngx_array_t *headers,
  81.     ngx_str_t *name, ngx_str_t *value);
  82. ngx_int_t ngx_http_parse_set_cookie_lines(ngx_array_t *headers,
  83.     ngx_str_t *name, ngx_str_t *value);
  84. ngx_int_t ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len,
  85.     ngx_str_t *value);
  86. void ngx_http_split_args(ngx_http_request_t *r, ngx_str_t *uri,
  87.     ngx_str_t *args);
  88. ngx_int_t ngx_http_parse_chunked(ngx_http_request_t *r, ngx_buf_t *b,
  89.     ngx_http_chunked_t *ctx);


  90. ngx_http_request_t *ngx_http_create_request(ngx_connection_t *c);
  91. ngx_int_t ngx_http_process_request_uri(ngx_http_request_t *r);
  92. ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r);
  93. void ngx_http_process_request(ngx_http_request_t *r);
  94. void ngx_http_update_location_config(ngx_http_request_t *r);
  95. void ngx_http_handler(ngx_http_request_t *r);
  96. void ngx_http_run_posted_requests(ngx_connection_t *c);
  97. ngx_int_t ngx_http_post_request(ngx_http_request_t *r,
  98.     ngx_http_posted_request_t *pr);
  99. void ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
  100. void ngx_http_free_request(ngx_http_request_t *r, ngx_int_t rc);

  101. void ngx_http_empty_handler(ngx_event_t *wev);
  102. void ngx_http_request_empty_handler(ngx_http_request_t *r);


  103. #define ngx_http_ephemeral(r)  (void *) (&r->uri_start)


  104. #define NGX_HTTP_LAST   1
  105. #define NGX_HTTP_FLUSH  2

  106. ngx_int_t ngx_http_send_special(ngx_http_request_t *r, ngx_uint_t flags);


  107. ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r,
  108.     ngx_http_client_body_handler_pt post_handler);

  109. ngx_int_t ngx_http_send_header(ngx_http_request_t *r);
  110. ngx_int_t ngx_http_special_response_handler(ngx_http_request_t *r,
  111.     ngx_int_t error);
  112. ngx_int_t ngx_http_filter_finalize_request(ngx_http_request_t *r,
  113.     ngx_module_t *m, ngx_int_t error);
  114. void ngx_http_clean_header(ngx_http_request_t *r);


  115. time_t ngx_http_parse_time(u_char *value, size_t len);
  116. size_t ngx_http_get_time(char *buf, time_t t);



  117. ngx_int_t ngx_http_discard_request_body(ngx_http_request_t *r);
  118. void ngx_http_discarded_request_body_handler(ngx_http_request_t *r);
  119. void ngx_http_block_reading(ngx_http_request_t *r);
  120. void ngx_http_test_reading(ngx_http_request_t *r);


  121. char *ngx_http_types_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
  122. char *ngx_http_merge_types(ngx_conf_t *cf, ngx_array_t **keys,
  123.     ngx_hash_t *types_hash, ngx_array_t **prev_keys,
  124.     ngx_hash_t *prev_types_hash, ngx_str_t *default_types);
  125. ngx_int_t ngx_http_set_default_types(ngx_conf_t *cf, ngx_array_t **types,
  126.     ngx_str_t *default_type);

  127. #if (NGX_HTTP_DEGRADATION)
  128. ngx_uint_t  ngx_http_degraded(ngx_http_request_t *);
  129. #endif


  130. extern ngx_module_t  ngx_http_module;

  131. extern ngx_str_t  ngx_http_html_default_types[];


  132. extern ngx_http_output_header_filter_pt  ngx_http_top_header_filter;
  133. extern ngx_http_output_body_filter_pt    ngx_http_top_body_filter;


  134. #endif /* _NGX_HTTP_H_INCLUDED_ */