~simonkberg/ngx-pagespeed/release-1.9.32.3-beta

« back to all changes in this revision

Viewing changes to src/ngx_rewrite_driver_factory.h

  • Committer: Jeffrey Crowell
  • Author(s): Otto van der Schaaf
  • Date: 2014-10-24 20:23:45 UTC
  • Revision ID: git-v1:ab9929e5a5c631353a7eac4c49543aa8756d5e7a
native fetcher: Support http keep-alive

Based on @dinic his work, add keep-alive support for the native fetcher.
Adds a new option, usable at the http{} level in configuration:

pagespeed NativeFetcherMaxKeepaliveRequests 50;

The default value is 100 (aligned to nginx). Setting the value to 1 turns off
keep-alive requests altogether).

Most notable changes:
- Request keep-alive by adding the appropriate request header
- Fixes connections getting reused while they are servicing other requests:
- Remove connection from the pool of available connections for keepalive when applicable
- Disable keepalive in more appropriate situations
- Response parsing fixes
- Remove connections that timeout from the k.a. pool
- Add a few sanity (D)CHECKS
- Emit debug messages for traceability
- Fix for ignoring ipv6 addresses returned from dns queries when ipv6 is enabled.
- Bump the fetch timeout in test configuration to deflake tests that require dns
  lookups (which will be done via 8.8.8.8 currently for the native fetcher)

Conflicts:
        src/ngx_fetch.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
  void set_use_native_fetcher(bool x) {
106
106
    use_native_fetcher_ = x;
107
107
  }
 
108
  int native_fetcher_max_keepalive_requests() {
 
109
    return native_fetcher_max_keepalive_requests_;
 
110
  }
 
111
  void set_native_fetcher_max_keepalive_requests(int x) {
 
112
    native_fetcher_max_keepalive_requests_ = x;
 
113
  }
108
114
  bool process_script_variables() {
109
115
    return process_script_variables_;
110
116
  }
140
146
  ngx_msec_t resolver_timeout_;
141
147
  ngx_resolver_t* resolver_;
142
148
  bool use_native_fetcher_;
 
149
  int native_fetcher_max_keepalive_requests_;
 
150
 
143
151
  typedef std::set<NgxMessageHandler*> NgxMessageHandlerSet;
144
152
  NgxMessageHandlerSet server_context_message_handlers_;
145
153