Commit Graph

105 Commits

Author SHA1 Message Date
Jeff Kaufman 2613c04e01 docs: minor edits 2012-12-19 11:47:03 -05:00
Jeff Kaufman 8f64b36681 base fetch: add Release() and reference counting
When a request is cancelled part way through nginx calls the cleanup
handler. This was set to delete the base fetch, but the proxy fetch was
sometimes not done with it yet.  Both nginx and pagespeed must be finished with
the base fetch before it's safe to delete it.  Pagespeed calls Done(), and this
adds Release() for nginx to call.  Whichever is called second deletes the
base_fetch.  We use a count of references that starts at two and is decremented
atomically with a memory barrier once when Done() is called and once when
Release() is called.

Fixes #103, #104, and #106.
2012-12-19 11:36:58 -05:00
Jeff Kaufman 9ab64ba3df update docs 2012-12-19 11:10:20 -05:00
Jeff Kaufman 814e0c18f2 rewrite driver factory: start a scheduler thread
Because we're a non-blocking server we need to run a scheduler thread or else
alerts we set might not fire.  We need to be careful to start it after we fork.

Better long term would be to use an nginx timer and avoid the extra thread;
tracking this in #111.

Fixes #55
2012-12-19 10:59:04 -05:00
Jeff Kaufman 3e6523d915 Merge pull request #113 from pagespeed/oschaaf-cache-fixup
cache: fixes
2012-12-19 07:56:12 -08:00
Otto van der Schaaf 6977f12e79 cache: fixes
- restores slow worker initialization/termination
- amend an error I apparently made while rebasing to head:
    - do not null the lru cache when using memcached (accidentally
      left in)
    - remove debug fprintf's
    - remove comment about virtual hosts
    - restore a TODO
    - abort when memcached is configure and we fail to connect
      to the memcached interface
2012-12-18 18:10:49 +01:00
Jeff Kaufman eeb006df2a Merge pull request #110 from pagespeed/jefftk-request-context
request context: deal with changes in pagespeed's api
2012-12-17 13:28:55 -08:00
Jeff Kaufman 9cd5f3b19c request context: deal with changes in pagespeed's api
The pagespeed api for handling logs has changed, we need to change with it in
order to build against the latest pagespeed optimization libraries.

Separately, a new test was added to the generic system test that depends on the
property cache (insert_dns_prefetch).  We've not ported the property cache yet,
so this test will fail, and I've added it to the list of failing tests.
2012-12-17 10:57:18 -05:00
Jeff Kaufman 599578f2b5 install docs: make more thorough 2012-12-14 17:10:37 -05:00
Jeff Kaufman ce91fe670f configuration: document content priority workaround 2012-12-14 11:44:07 -05:00
Jeff Kaufman e6d1937e68 process-shutdown
Merge of Otto's pull request #105:

  This wires up and executes cleanup code.

  There is an issue when sending SIGTERM to a worker under high load, I will
  create a separate issue for that. Normal shutdowns and reloads are working.

Fixes #84.

The issue with workers under high load is #109.
2012-12-14 10:25:11 -05:00
Jeff Kaufman 8676bcc335 Merge pull request #101 from yaoweibin/add_deps
added the header file dependences to ngx_pagespeed
2012-12-10 08:31:40 -08:00
Jeff Kaufman 40910e7965 Merge pull request #100 from pagespeed/jefftk-fetch-proxy
fetch: support proxy
2012-12-07 13:08:33 -08:00
Weibin Yao 939d6046d3 added the header file dependences to ngx_pagespeed 2012-12-07 22:42:27 +08:00
Jeff Kaufman 0a21a1d880 fetch: support proxy
Example:
    pagespeed FetchProxy        127.0.0.1:8081;

With a proxy set the fetcher will send all outside requests through the proxy.
Like ModPagespeedFetchProxy, this is intended to be used for load tests.

For now, this must be set in the 'http' block.

Fixes #98, and is needed for #41.
2012-12-06 16:44:02 -05:00
Ben Noordhuis c5f061689a build: fix debug/release library linking 2012-12-04 07:50:44 +01:00
Jeff Kaufman 8198033f89 readme: minor typos 2012-11-30 17:17:40 -05:00
Jeff Kaufman 45fb3c4254 create request context: keep parsed and string urls in sync
ServerContext::GetQueryOptions modifies the url passed to it, removing any
ModPagespeedFoo=Bar query parameters.  CreateNewProxyFetch needs that modified
url but we were giving it the unmodified one.

Fixes #83
2012-11-30 17:17:40 -05:00
Jeff Kaufman 14c7fb1c8d system test: use PAGESPEED_EXPECTED_FAILURES for known bad tests 2012-11-30 17:12:13 -05:00
Jeff Kaufman 8509618cb5 ngx_base_fetch: fix extra chunks and race condition
We were sometimes failing to set last_buf when we should, but being protected
from the consequences by another bug that made us usually send additional extra
buffers with last_buf set.

See discussion in #78, pull request was #94.
2012-11-29 09:39:33 -05:00
Jeff Kaufman 4b59d8badf caching: support memcached
Merge in Otto's #65 porting the apache memcached implementation to nginx.
2012-11-28 15:44:05 -05:00
Jeff Kaufman f0f952d7a6 housekeeping: use prefix ps_ instead of ngx_http_pagespeed_
Within the anonymous namespace in ngx_pagespeed.css we don't really need to be
using the long `ngx_http_pagespeed_` prefix.  Switching to just `ps_` should be
safe.  For symbols that need to be visible outside this file, though, we need to
keep the long prefix.

Fixes #85.
2012-11-28 11:23:17 -05:00
Jeff Kaufman 9e71fb76e2 Merge pull request #88 from pagespeed/jefftk-fix-indent
housekeeping: fix indentation
2012-11-27 15:04:53 -08:00
Jeff Kaufman 23c967f864 readme: project is somewhat more ready than it was 2012-11-27 16:26:31 -05:00
Jeff Kaufman 6491615bc8 configuration: handle multi-layer configuration
Nginx allows configuration at three levels:
 - main
 - server
 - location

Previously we did everything at the server level, which made for a few problems:
 - we didn't support options in location blocks
 - we created an NgxRewriteDriverFactory for every server block, which when
   combined with the Serf fetcher meant we had separate fetch pools for every
   server.  If someone had nginx configured with a lot of server blocks, we
   could attempt far too many simultaneous loopback fetches and DOS ourself.

Now we store things at several levels:
 - main
   - rewrite driver factory
 - server
   - most things
 - location
   - directory specific options
2012-11-27 15:07:04 -05:00
Jeff Kaufman 25901bacd1 housekeeping: fix indentation
Fix indentation on `ngx_http_pagespeed_writer` and
`ngx_http_pagespeed_write_helper`.
2012-11-27 11:21:41 -05:00
Jeff Kaufman 8ec05b79eb ngx_pagespeed.cc: fix double request finalization (issue 79)
When returning NGX_ERROR in the header filter, apperently nginx already
finalizes the http request for us. This fixes #79

It also puts a check in place for a switch label that should be impossible to
reach.

(Merged from oschaaf-issue-79.)
2012-11-27 10:43:10 -05:00
Jeff Kaufman e4f88950f6 Merge branch 'master' of github.com:pagespeed/ngx_pagespeed 2012-11-26 17:41:04 -05:00
Jeff Kaufman 263a6e4feb system test: set a maximum html size to process 2012-11-26 17:40:39 -05:00
Jeff Kaufman d41c90bad7 Merge pull request #31 from pagespeed/bnoordhuis-spinlocks
ngx_base_fetch: implement locking
2012-11-26 14:22:19 -08:00
Jeff Kaufman afb7105351 system test: add caching header 2012-11-26 17:18:17 -05:00
Jeff Kaufman 14342b5452 Merge pull request #77 from pagespeed/jefftk-merge-bug
options: fix merging
2012-11-21 12:57:13 -08:00
Jeff Kaufman daaedd96bb options: fix merging
The merging function was broken, in that it did

    child.Merge(parent)

when the semantics we actually need are

    child = parent.Clone().Merge(child)
2012-11-21 14:19:35 -05:00
Jeff Kaufman d7e07a8ff1 Merge pull request #76 from pagespeed/bnoordhuis-build-debug
build: link against debug libs if NGX_DEBUG=YES
2012-11-21 11:13:30 -08:00
Ben Noordhuis 4aad27ccf9 ngx_base_fetch: implement locking 2012-11-21 20:09:03 +01:00
Ben Noordhuis 51de81b123 build: link against debug libs if NGX_DEBUG=YES
Link against the debug versions of the mod_pagespeed libraries when nginx is
configured with --with-debug.

Requires that said libraries have been pre-built with BUILDTYPE=Debug.
2012-11-21 19:37:04 +01:00
Jeff Kaufman 4f3bf2d495 Merge pull request #71 from yaoweibin/fixed_pagespeed_write_fitler_wrong_output_filter
fixed the wrong next output filter in the pagespeed writer
2012-11-21 06:25:41 -08:00
Jeff Kaufman 06980882f9 Merge pull request #68 from pagespeed/jefftk-404-on-bad-static-urls
static javascript manager: 404 on not found
2012-11-21 06:25:13 -08:00
Weibin Yao 5702b8dd10 fixed the wrong next output filter in the pagespeed writer
This bug could cause only output part of the content with large file.
2012-11-21 17:54:37 +08:00
Jeff Kaufman 3ef24295ef static javascript manager: 404 on not found
If we get an invalid filename in a request for static pagespeed content, we
should return NGX_DECLINED from the handler so that nginx can 404 for us.

Fixes issue #67.
2012-11-20 11:06:51 -05:00
Jeff Kaufman 6071062407 Merge pull request #64 from pagespeed/jefftk-deferjs-system-test
content handler: support static javascript requests
2012-11-20 08:00:46 -08:00
Jeff Kaufman 0680b81028 Merge pull request #66 from pagespeed/oschaaf-fix-apr-includes
apr: include headers in a portable manner
2012-11-20 06:51:20 -08:00
Otto van der Schaaf d12508b12d apr: include headers in a portable manner 2012-11-20 15:21:56 +01:00
Jeff Kaufman 72b1b98bb9 content handler: support static javascript requests
Requests to:

  /ngx_pagespeed_static/...

can be handled synchronously by pagespeed.  They're used for support files for
optimizations, like js_defer.js.

This also includes a couple refactors:

 - I pulled most of NgxBaseFetch::CopyBufferToNginx() out into
   ngx_http_pagespeed_string_piece_to_buffer_chain().

 - ngx_http_pagespeed_create_request_context() now returns a
   CreateRequestContext::Response which gives callers more detailed information
   about the request.

 - I also pulled ngx_http_pagespeed_set_cache_control() out of
   ngx_http_pagespeed_header_filter().

Fixes issue #62.
2012-11-19 16:29:25 -05:00
Jeff Kaufman 318e14fa32 system test: label pre-compressed test data as such
The system test 'gzipped js origin' needs files in the directory
  /mod_pagespeed_test/compressed/
to be served as pre-gzip encoded javascript.
2012-11-19 11:30:09 -05:00
Jeff Kaufman eaef938988 base fetch: call ComputeCaching() on the pagespeed response headers
Merge of Otto's pull request #61
2012-11-19 11:07:22 -05:00
Jeff Kaufman e6bd7b7213 base fetch: populate the response status code
Copy the response status code from nginx to pagespeed.

Merge of Otto's pull request #60
2012-11-19 11:05:07 -05:00
Jeff Kaufman f22401af41 system test: /mod_pagespeed_test/no_cache/ needs to be cc:no-cache 2012-11-16 15:59:49 -05:00
Jeff Kaufman 2ab64cdff5 serf fetcher: minor cleanups 2012-11-15 13:26:40 -05:00
Jeff Kaufman 74831adad8 Merge pull request #54 from pagespeed/jefftk-fix-content-type
headers: content type
2012-11-14 15:03:42 -08:00