Author: peter
Date: Tue Jun 18 02:00:50 2013
New Revision: 251877
URL: http://svnweb.freebsd.org/changeset/base/251877

Log:
  Import serf-1.2.1

Added:
  vendor/serf/
  vendor/serf/dist/
  vendor/serf/dist/CHANGES
  vendor/serf/dist/LICENSE
  vendor/serf/dist/Makefile.in   (contents, props changed)
  vendor/serf/dist/NOTICE
  vendor/serf/dist/README
  vendor/serf/dist/auth/
  vendor/serf/dist/auth/auth.c   (contents, props changed)
  vendor/serf/dist/auth/auth.h   (contents, props changed)
  vendor/serf/dist/auth/auth_basic.c   (contents, props changed)
  vendor/serf/dist/auth/auth_digest.c   (contents, props changed)
  vendor/serf/dist/auth/auth_kerb.c   (contents, props changed)
  vendor/serf/dist/auth/auth_kerb.h   (contents, props changed)
  vendor/serf/dist/auth/auth_kerb_gss.c   (contents, props changed)
  vendor/serf/dist/auth/auth_kerb_sspi.c   (contents, props changed)
  vendor/serf/dist/buckets/
  vendor/serf/dist/buckets/aggregate_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/allocator.c   (contents, props changed)
  vendor/serf/dist/buckets/barrier_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/bwtp_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/chunk_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/dechunk_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/deflate_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/file_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/headers_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/iovec_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/limit_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/mmap_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/request_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/response_body_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/response_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/simple_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/socket_buckets.c   (contents, props changed)
  vendor/serf/dist/buckets/ssl_buckets.c   (contents, props changed)
  vendor/serf/dist/build/
  vendor/serf/dist/build/apr_common.m4
  vendor/serf/dist/build/config.guess   (contents, props changed)
  vendor/serf/dist/build/config.sub   (contents, props changed)
  vendor/serf/dist/build/find_apr.m4
  vendor/serf/dist/build/find_apu.m4
  vendor/serf/dist/build/gen_def.py   (contents, props changed)
  vendor/serf/dist/build/get-version.sh   (contents, props changed)
  vendor/serf/dist/build/install.sh   (contents, props changed)
  vendor/serf/dist/build/serf.def
  vendor/serf/dist/buildconf   (contents, props changed)
  vendor/serf/dist/config.layout
  vendor/serf/dist/configure   (contents, props changed)
  vendor/serf/dist/configure.in   (contents, props changed)
  vendor/serf/dist/context.c   (contents, props changed)
  vendor/serf/dist/design-guide.txt   (contents, props changed)
  vendor/serf/dist/incoming.c   (contents, props changed)
  vendor/serf/dist/outgoing.c   (contents, props changed)
  vendor/serf/dist/serf.h   (contents, props changed)
  vendor/serf/dist/serf.mak
  vendor/serf/dist/serf.pc.in   (contents, props changed)
  vendor/serf/dist/serf_bucket_types.h   (contents, props changed)
  vendor/serf/dist/serf_bucket_util.h   (contents, props changed)
  vendor/serf/dist/serf_private.h   (contents, props changed)
  vendor/serf/dist/serfmake   (contents, props changed)
  vendor/serf/dist/ssltunnel.c   (contents, props changed)

Added: vendor/serf/dist/CHANGES
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/serf/dist/CHANGES    Tue Jun 18 02:00:50 2013        (r251877)
@@ -0,0 +1,198 @@
+Serf 1.2.1 [2013-06-03, from /tags/1.2.1]
+  Fix issue 95: add gssapi switches to configure (r1864, r1900)
+  Fix issue 97: skip mmap bucket if APR_HAS_MMAP is undefined (r1877)
+  Fix issue 100: building against an old Windows Platform SDK (r1881)
+  Fix issue 102: digest authentication failures (r1885)
+  Improve error return values in SSPI authentication (r1804)
+  Ensure serf-1.pc is constructed by serfmake (r1865)
+  Optimize SPNego authentication processing (r1868)
+  Reject certs that application does not like (r1794)
+  Fix possible endless loop in serf_linebuf_fetch() (r1816)
+  Windows build: dereference INTDIR in serf.mak (r1882)
+
+
+Serf 1.2.0 [2013-02-22, from /tags/1.2.0, r1726]
+  Fixed issue 94: Serf can enter an infinite loop when server aborts conn.
+  Fixed issue 91: Serf doesn't handle an incoming 408 Timeout Request
+  Fixed issue 80: Serf is not handling Negotiate authentication correctly
+  Fixed issue 77: Endless loop if server doesn't accept Negotiate authn
+  Fixed issue 93: cleanup-after-fork interferes with parent (r1714)
+  Fixed most of issue 89: Support REAL SPNEGO authentication
+  Enable Negotiate/Kerberos support for proxy servers.
+  Return error when C-L, chunked, gzip encoded response bodies where
+    truncated (due to aborted connection) (r1688)
+  Add a logging mechanism that can be enabled at compile-time.
+  Don't lookup server address if a proxy was configured. (r1706)
+  Fix an off-by-one in buffer sizing (r1695)
+  Disable SSL compression by default + API to enable it (r1692)
+  New serf_connection_get_latency() for estimated network latency (r1689)
+  New error code and RFC compliance for the HTTPS tunnel (r1701, r1644)
+  Handle EINTR when a user suspends and then backgrounds the app (r1708)
+  Minor fixes and test suite improvements.
+
+
+Serf 1.1.1 [2012-10-04, from /tags/1.1.1, r1657]
+  Fixed issue 86: ensure requeued requests are correctly handled.
+    This fixes:
+      - infinite loop with multiple connection resets or SIGPIPE errors
+      - "connection" hang where we would not re-queue requests that are
+        held after we re-connect
+  Fixed issue 74: test_all goes in an endless loop
+  Fix memleak when conn. is closed explicitly/due to pool cleanups (r1623)
+  Windows: Fix https connection aborts (r1628..-30,-33,-34,-37)
+  Add new error codes for the SSL bucket
+
+
+Serf 1.1.0 [2012-06-07, from /tags/1.1.0, r1617]
+  New: serf_bucket_request_set_CL() for C-L based, non-chunked requests
+  New: serf_ssl_server_cert_chain_callback_set() for full-chain validation
+
+
+Serf 1.0.3 [2012-03-20, from /tags/1.0.3, r1586]
+  Map more OpenSSL errors into SERF_SSL_CERT_UNKNOWNCA (r1573)
+
+
+Serf 1.0.2
+  Not released.
+
+
+Serf 1.0.1 [2012-02-15, from /tags/1.0.1, r1569]
+  FreeBSD fixes in the test suite (r1560, r1565)
+  Minor build fixes
+
+
+Serf 1.0.0 [2011-07-15, from /tags/1.0.0, r1540]
+  Fixed issue 38: enable builds using non-GNU make
+  Fixed issue 49: support SSL tunnels for HTTPS via a proxy
+  Fixed issue 56: allow Subject Alternative Name, and enable SNI
+  Fixed issue 61: include order dependencies
+  Fixed issue 66: improved error reporting when creating install dirs
+  Fixed issue 71: handle ECONNREFUSED on Windows
+  Fixed issue 79: destroy the APR allocator, if we create one
+  Fixed issue 81: build failed on APR 0.9.x
+  Major performance improvements and bug fixes for SSL buckets/handling (r1462)
+  Add a new "iovec" bucket type (r1434)
+  Minimize network packet writes based on ra_serf analysis (r1467, r1471)
+  Fix out of order issue with multiple priority requests (r1469)
+  Work around broken WSAPoll() impl on Windows introduced in APR 1.4.0 (r1506)
+  Fix 100% CPU usage with many pipelined requests (r1456)
+  Corrected contents of build/serf.def; it now includes bucket types (r1512)
+  Removed "snapshot" feature from buckets (r1503)
+  Various improvements to the test system
+  Various memory leak fixes
+
+
+Serf 0.7.2 [2011-03-12, from /tags/0.7.2, r1452]
+  Actually disable Nagle when creating a connection (r1441)
+  Return error when app asks for HTTPS over proxy connection (r1433)
+
+
+Serf 0.7.1 [2011-01-25, from /tags/0.7.1, r1432]
+  Fix memory leak when using SSL (r1408, r1416)
+  Fix build for blank apr-util directory (r1421)
+
+
+Serf 0.7.0 [2010-08-25, from /tags/0.7.0, r1407]
+  Fix double free abort when destroying request buckets
+  Fix test server in unit test framework to avoid random test failures
+  Allow older Serf programs which don't use the new authn framework to still
+    handle authn without forcing them to switch to the new framework. (r1401)
+  Remove the SERF_DECLARE macros, preferring a .DEF file for Windows
+  Barrier buckets now pass read_iovec to their wrapped bucket
+  Fix HTTP header parsing to allow for empty header values
+
+
+Serf 0.6.1 [2010-05-14, from /tags/0.6.1, r1370]
+  Generally: this release fixes problems with the 0.4.0 packaging
+  Small compilation fix in outgoing.c for Windows builds
+
+
+Serf 0.6.0
+  Not released.
+
+
+Serf 0.5.0
+  Not released.
+
+
+Serf 0.4.0
+  WITHDRAWN: this release misstated itself as 0.5.0; use a later release
+
+  Provide authn framework, supporting Basic, Digest, Kerberos (SSPI, GSS),
+    along with proxy authn using Basic or Digest
+  Added experimental listener framework, along with test_server.c
+  Improvements and fixes to SSL support, including connection setup changes
+  Experimental support for unrequested, arriving ("async") responses
+  Experimental BWTP support using the async arrival feature
+  Headers are combined on read (not write), to ease certian classes of parsing
+  Experimental feature on aggregate buckets for a callback-on-empty
+  Fix the bucket allocator for when APR is using its pool debugging features
+  Proxy support in the serf_get testing utility
+  Fix to include the port number in the Host header
+  serf_get propagates errors from the response, instead of aborting (Issue 52)
+  Added serf_lib_version() for runtime version tests
+
+
+Serf 0.3.1 [2010-02-14, from /tags/0.3.1, r1322]
+  Fix loss of error on request->setup() callback. (Issue 47)
+  Support APR 2.x. (Issue 48)
+  Fixed slowdown in aggregate bucket with millions of child buckets
+  Avoid hang in apr_pollset_poll() by unclosed connections after fork()
+
+
+Serf 0.3.0 [2009-01-26, from /tags/0.3.0, r1217]
+  Support LTFLAGS override as a config-time env. variable (Issue 44)
+  Fix CUTest test harness compilation on Solaris (Issue 43)
+  Fix small race condition in OpenSSL initialization (Issue 39)
+  Handle content streams larger than 4GB on 32-bit OSes (Issue 41)
+  Fix test_ssl.c compilation with mingw+msys
+  Fix conn close segfault by explicitly closing conn when pool is destroyed
+  Expose the depth of the SSL certificate so the validator can use that info
+  Fix socket address family issue when opening a connection to a proxy
+  Provide new API to take snapshots of buckets
+  Implement snapshot API for simple and aggregate buckets
+  Build with bundled apr and apr-util VPATH builds
+  Build with bundled OpenSSL builds
+
+
+Serf 0.2.0 [2008-06-06, from /tags/0.2.0, r1189]
+  Enable use of external event loop: serf_create_context_ex
+  Enable adding new requests at the beginning of the request queue
+  Handle 'Connection:close' headers
+  Enable limiting the number of outstanding requests
+  Add readline function to simple buckets
+  Concatenate repeated headers using comma as separator, as per RFC 2616,
+    section 4.2. (Issue 29)
+  Add proxy server support
+  Add progress feedback support. (Issue 11)
+  Provide new API to simplify use of proxy and progress feedback support
+  Add callback to validate SSL server certificates. (Issue 31)
+  Add new test framework
+  Send current version string in the test programs (Issue 21)
+  Bugfixes:
+     Fix segfault with epoll when removing a NULL socket
+     Reset OpenSSL thread-safety callbacks when apr_terminate() called
+     Do not remove the socket from the pollset on pool cleanup
+     Do not issue double close on skt w/second one being close(-1) (Issue 33)
+
+
+Serf 0.1.2 [2007-06-18, from /tags/0.1.2, r1115]
+  Enable thread-safety with OpenSSL (Issue 19)
+  Teach serfmake to install headers into include/serf-0
+  Be more tolerant when servers close the connection without telling us
+  Do not open the connection until we have requests to deliver
+  Fix serfmake to produce the library that corresponds to the minor version
+  Fix a memory leak with the socket bucket (Issue 14)
+  Fix uninitialized branch in serf_spider (Issue 15)
+
+
+Serf 0.1.1 [2007-05-12, from /tags/0.1.1, r1105]
+  Add SSL client certificate support
+  Implement optimized iovec reads for header buckets
+  Fix up 'make clean' and 'make distclean' (Issues 9, 10)
+  Add SERF_VERSION_AT_LEAST macro
+  Remove abort() calls (Issue 13)
+
+
+Serf 0.1.0 [2006-12-14, from /tags/0.1.0, r1087]
+  Initial packaged release

Added: vendor/serf/dist/LICENSE
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/serf/dist/LICENSE    Tue Jun 18 02:00:50 2013        (r251877)
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

Added: vendor/serf/dist/Makefile.in
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/serf/dist/Makefile.in        Tue Jun 18 02:00:50 2013        
(r251877)
@@ -0,0 +1,171 @@
+#
+# Makefile for Serf
+#
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+SERF_MAJOR_VERSION=@SERF_MAJOR_VERSION@
+SERF_DOTTED_VERSION=@SERF_DOTTED_VERSION@
+
+OBJECTS = buckets/aggregate_buckets.lo buckets/request_buckets.lo context.lo \
+          buckets/buckets.lo buckets/simple_buckets.lo buckets/file_buckets.lo 
\
+          buckets/mmap_buckets.lo buckets/socket_buckets.lo \
+          buckets/response_body_buckets.lo buckets/response_buckets.lo \
+          buckets/headers_buckets.lo \
+          buckets/allocator.lo buckets/dechunk_buckets.lo \
+          buckets/deflate_buckets.lo buckets/limit_buckets.lo \
+          buckets/ssl_buckets.lo buckets/barrier_buckets.lo \
+          buckets/chunk_buckets.lo buckets/bwtp_buckets.lo \
+         buckets/iovec_buckets.lo \
+          incoming.lo outgoing.lo ssltunnel.lo \
+          auth/auth.lo auth/auth_basic.lo auth/auth_digest.lo \
+          auth/auth_kerb.lo auth/auth_kerb_gss.lo
+
+TARGET_LIB=libserf-$(SERF_MAJOR_VERSION).la
+
+TEST_OBJECTS = test/serf_get.lo test/serf_response.lo test/serf_request.lo \
+               test/serf_spider.lo test/serf_server.lo test/serf_bwtp.lo
+
+TEST_SUITE_OBJECTS = test/CuTest.lo test/test_all.lo test/test_util.lo \
+                     test/test_buckets.lo test/test_context.lo \
+                     test/test_ssl.lo test/server/test_server.lo \
+                     test/server/test_sslserver.lo
+
+PROGRAMS = $(TEST_OBJECTS:.lo=) test/test_all
+
+TESTCASES = test/testcases/simple.response \
+  test/testcases/chunked-empty.response test/testcases/chunked.response \
+  test/testcases/chunked-trailers.response \
+  test/testcases/deflate.response
+
+HEADERS = serf.h serf_bucket_types.h serf_bucket_util.h
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+pkgconfigdir=$(libdir)/pkgconfig
+
+LIBTOOL = @APR_LIBTOOL@
+LTFLAGS = @LTFLAGS@ --tag=CC
+CC = @CC@
+CFLAGS =  @EXTRA_CFLAGS@ @CFLAGS@
+CPPFLAGS = @EXTRA_CPPFLAGS@ @CPPFLAGS@
+INCLUDES = -I$(srcdir) @APR_INCLUDES@ @APU_INCLUDES@ @EXTRA_INCLUDES@
+MKDIR = @mkdir_p@
+INSTALL = @INSTALL@
+
+LDFLAGS = @EXTRA_LDFLAGS@ @LDFLAGS@
+LIBS = @EXTRA_LIBS@  @SERF_LIBS@ -lz -lssl -lcrypto
+
+all: $(TARGET_LIB) $(PROGRAMS)
+
+context.lo: context.c $(HEADERS)
+incoming.lo: incoming.c $(HEADERS)
+outgoing.lo: outgoing.c $(HEADERS)
+ssltunnel.lo: ssltunnel.c $(HEADERS)
+buckets/aggregate_buckets.lo: buckets/aggregate_buckets.c $(HEADERS)
+buckets/request_buckets.lo: buckets/request_buckets.c $(HEADERS)
+buckets/buckets.lo: buckets/buckets.c $(HEADERS)
+buckets/simple_buckets.lo: buckets/simple_buckets.c $(HEADERS)
+buckets/file_buckets.lo: buckets/file_buckets.c $(HEADERS)
+buckets/mmap_buckets.lo: buckets/mmap_buckets.c $(HEADERS)
+buckets/socket_buckets.lo: buckets/socket_buckets.c $(HEADERS)
+buckets/response_body_buckets.lo: buckets/response_body_buckets.c $(HEADERS)
+buckets/response_buckets.lo: buckets/response_buckets.c $(HEADERS)
+buckets/headers_buckets.lo: buckets/headers_buckets.c $(HEADERS)
+buckets/allocator.lo: buckets/allocator.c $(HEADERS)
+buckets/dechunk_buckets.lo: buckets/dechunk_buckets.c $(HEADERS)
+buckets/deflate_buckets.lo: buckets/deflate_buckets.c $(HEADERS)
+buckets/limit_buckets.lo: buckets/limit_buckets.c $(HEADERS)
+buckets/ssl_buckets.lo: buckets/ssl_buckets.c $(HEADERS)
+buckets/barrier_buckets.lo: buckets/barrier_buckets.c $(HEADERS)
+buckets/chunk_buckets.lo: buckets/chunk_buckets.c $(HEADERS)
+buckets/bwtp_buckets.lo: buckets/bwtp_buckets.c $(HEADERS)
+buckets/iovec_buckets.lo: buckets/iovec_buckets.c $(HEADERS)
+
+test/serf_get.lo: test/serf_get.c $(HEADERS)
+test/serf_response.lo: test/serf_response.c $(HEADERS)
+test/serf_request.lo: test/serf_request.c $(HEADERS)
+test/serf_server.lo: test/serf_server.c $(HEADERS)
+test/serf_spider.lo: test/serf_spider.c $(HEADERS)
+test/serf_bwtp.lo: test/serf_bwtp.c $(HEADERS)
+
+test/CuTest.lo: test/CuTest.c $(HEADERS)
+test/test_all.lo: test/test_all.c $(HEADERS)
+test/test_util.lo: test/test_util.c $(HEADERS)
+test/test_buckets.lo: test/test_buckets.c $(HEADERS)
+test/test_context.lo: test/test_context.c $(HEADERS)
+test/test_ssl.lo: test/test_ssl.c $(HEADERS)
+
+$(TARGET_LIB): $(OBJECTS)
+       $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LDFLAGS) -rpath $(libdir) -o 
$@ $(OBJECTS) $(LIBS)
+
+test/serf_get: $(TARGET_LIB) test/serf_get.lo
+       $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LDFLAGS) -static -o $@ 
$(TARGET_LIB) test/serf_get.lo $(LIBS)
+
+test/serf_response: $(TARGET_LIB) test/serf_response.lo
+       $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LDFLAGS) -static -o $@ 
$(TARGET_LIB) test/serf_response.lo $(LIBS)
+
+test/serf_request: $(TARGET_LIB) test/serf_request.lo
+       $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LDFLAGS) -static -o $@ 
$(TARGET_LIB) test/serf_request.lo $(LIBS)
+
+test/serf_server: $(TARGET_LIB) test/serf_server.lo
+       $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LDFLAGS) -static -o $@ 
$(TARGET_LIB) test/serf_server.lo $(LIBS)
+
+test/serf_spider: $(TARGET_LIB) test/serf_spider.lo
+       $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LDFLAGS) -static -o $@ 
$(TARGET_LIB) test/serf_spider.lo $(LIBS)
+
+test/serf_bwtp: $(TARGET_LIB) test/serf_bwtp.lo
+       $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LDFLAGS) -static -o $@ 
$(TARGET_LIB) test/serf_bwtp.lo $(LIBS)
+
+test/test_all: $(TARGET_LIB) $(TEST_SUITE_OBJECTS)
+       $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LDFLAGS) -static -o $@ 
$(TARGET_LIB) $(TEST_SUITE_OBJECTS) $(LIBS)
+
+check: test/serf_response test/test_all
+       @for i in $(TESTCASES); \
+                do echo "== Testing $$i =="; \
+                ./test/serf_response $(srcdir)/$$i; \
+       done;
+       @echo "== Running test_all ==";
+       @./test/test_all
+
+install: $(TARGET_LIB)
+       $(MKDIR) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) 
$(DESTDIR)$(pkgconfigdir)
+       $(LIBTOOL) $(LTFLAGS) --mode=install $(INSTALL) -m 644 $(TARGET_LIB) 
$(DESTDIR)$(libdir)
+       for i in $(HEADERS); do \
+               $(INSTALL) -m 644 $(srcdir)/$$i $(DESTDIR)$(includedir); \
+       done
+       $(INSTALL) -m 644 serf.pc 
$(DESTDIR)$(pkgconfigdir)/serf-$(SERF_MAJOR_VERSION).pc
+
+clean:
+       rm -f $(TARGET_LIB) $(OBJECTS) $(OBJECTS:.lo=.o) $(PROGRAMS) 
$(TEST_OBJECTS) $(TEST_OBJECTS:.lo=.o) $(TEST_SUITE_OBJECTS) 
$(TEST_SUITE_OBJECTS:.lo=.o)
+       for subdir in . buckets test; do \
+               (cd $$subdir && rm -rf .libs) ; \
+       done
+
+distclean: clean
+       rm -f Makefile serf.pc config.log config.status
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o
+
+mkdir-vpath:
+       @if [ ! -d auth ]; then \
+               $(MKDIR) auth; \
+       fi;
+       @if [ ! -d buckets ]; then \
+               $(MKDIR) buckets; \
+       fi;
+       @if [ ! -d test ]; then \
+               $(MKDIR) test; \
+       fi;
+       @if [ ! -d test/server ]; then \
+               $(MKDIR) test/server; \
+       fi;
+       @if [ ! -r test/serftestca.pem ]; then \
+               cp -f $(srcdir)/test/serftestca.pem test/; \
+       fi;
+
+.c.lo:
+       $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(INCLUDES) $(CFLAGS) 
$(CPPFLAGS) -c -o $@ $< && touch $@

Added: vendor/serf/dist/NOTICE
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/serf/dist/NOTICE     Tue Jun 18 02:00:50 2013        (r251877)
@@ -0,0 +1,2 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).

Added: vendor/serf/dist/README
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/serf/dist/README     Tue Jun 18 02:00:50 2013        (r251877)
@@ -0,0 +1,38 @@
+Welcome to serf, a high-performance asynchronous HTTP client library.
+
+The serf library is a C-based HTTP client library built upon the Apache
+Portable Runtime (APR) library. It multiplexes connections, running the
+read/write communication asynchronously. Memory copies and transformations are
+kept to a minimum to provide high performance operation.
+
+  * Status: http://code.google.com/p/serf/wiki/
+  * Site: http://code.google.com/p/serf/
+  * Code: http://serf.googlecode.com/svn/
+  * Issues: http://code.google.com/p/serf/issues/list
+  * Mail: serf-...@googlegroups.com
+  * People: Justin Erenkrantz, Greg Stein 
+
+----
+
+Quick guide for the impatient
+
+  (Unix)
+  % ./configure
+  % make
+  % make install
+
+----
+
+Building serf from a Subversion checkout (non-packaged releases)
+
+We suggest that you try out 'serfmake'.
+
+ % ./serfmake --prefix=/usr/local/serf --with-apr=/usr/local/apr install
+
+If you want to use the autoconf build system and are using a Subversion
+checkout, you need to run buildconf and have APR and APR-util sources handy.
+
+ % ./buildconf --with-apr=/path/to/apr --with-apr-util=/path/to/apr-util
+ (By default, buildconf will look in . and ../ for apr and apr-util.)
+
+Then, you can use ./configure, make, etc.

Added: vendor/serf/dist/auth/auth.c
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/serf/dist/auth/auth.c        Tue Jun 18 02:00:50 2013        
(r251877)
@@ -0,0 +1,421 @@
+/* Copyright 2009 Justin Erenkrantz and Greg Stein
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "serf.h"
+#include "serf_private.h"
+#include "auth.h"
+
+#include <apr.h>
+#include <apr_base64.h>
+#include <apr_strings.h>
+
+static apr_status_t
+default_auth_response_handler(peer_t peer,
+                              int code,
+                              serf_connection_t *conn,
+                              serf_request_t *request,
+                              serf_bucket_t *response,
+                              apr_pool_t *pool)
+{
+    return APR_SUCCESS;
+}
+
+static const serf__authn_scheme_t serf_authn_schemes[] = {
+    {
+        401,
+        "Basic",
+        SERF_AUTHN_BASIC,
+        serf__init_basic,
+        serf__init_basic_connection,
+        serf__handle_basic_auth,
+        serf__setup_request_basic_auth,
+        default_auth_response_handler,
+    },
+    {
+          407,
+          "Basic",
+          SERF_AUTHN_BASIC,
+          serf__init_basic,
+          serf__init_basic_connection,
+          serf__handle_basic_auth,
+          serf__setup_request_basic_auth,
+          default_auth_response_handler,
+    },
+    {
+        401,
+        "Digest",
+        SERF_AUTHN_DIGEST,
+        serf__init_digest,
+        serf__init_digest_connection,
+        serf__handle_digest_auth,
+        serf__setup_request_digest_auth,
+        serf__validate_response_digest_auth,
+    },
+    {
+        407,
+        "Digest",
+        SERF_AUTHN_DIGEST,
+        serf__init_digest,
+        serf__init_digest_connection,
+        serf__handle_digest_auth,
+        serf__setup_request_digest_auth,
+        serf__validate_response_digest_auth,
+    },
+#ifdef SERF_HAVE_KERB
+    {
+        401,
+        "Negotiate",
+        SERF_AUTHN_NEGOTIATE,
+        serf__init_kerb,
+        serf__init_kerb_connection,
+        serf__handle_kerb_auth,
+        serf__setup_request_kerb_auth,
+        serf__validate_response_kerb_auth,
+    },
+    {
+        407,
+        "Negotiate",
+        SERF_AUTHN_NEGOTIATE,
+        serf__init_kerb,
+        serf__init_kerb_connection,
+        serf__handle_kerb_auth,
+        serf__setup_request_kerb_auth,
+        serf__validate_response_kerb_auth,
+    },
+#endif
+    /* ADD NEW AUTHENTICATION IMPLEMENTATIONS HERE (as they're written) */
+
+    /* sentinel */
+    { 0 }
+};
+
+
+/**
+ * Baton passed to the response header callback function
+ */
+typedef struct {
+    int code;
+    apr_status_t status;
+    const char *header;
+    serf_request_t *request;
+    serf_bucket_t *response;
+    void *baton;
+    apr_pool_t *pool;
+    const serf__authn_scheme_t *scheme;
+    const char *last_scheme_name;
+} auth_baton_t;
+
+/* Reads and discards all bytes in the response body. */
+static apr_status_t discard_body(serf_bucket_t *response)
+{
+    apr_status_t status;
+    const char *data;
+    apr_size_t len;
+
+    while (1) {
+        status = serf_bucket_read(response, SERF_READ_ALL_AVAIL, &data, &len);
+
+        if (status) {
+            return status;
+        }
+
+        /* feed me */
+    }
+}
+
+/**
+ * handle_auth_header is called for each header in the response. It filters
+ * out the Authenticate headers (WWW or Proxy depending on what's needed) and
+ * tries to find a matching scheme handler.
+ *
+ * Returns a non-0 value of a matching handler was found.
+ */
+static int handle_auth_header(void *baton,
+                              const char *key,
+                              const char *header)
+{
+    auth_baton_t *ab = baton;
+    int scheme_found = FALSE;
+    const char *auth_name;
+    const char *auth_attr;
+    const serf__authn_scheme_t *scheme = NULL;
+    serf_connection_t *conn = ab->request->conn;
+    serf_context_t *ctx = conn->ctx;
+
+    /* We're only interested in xxxx-Authenticate headers. */
+    if (strcmp(key, ab->header) != 0)
+        return 0;
+
+    /* Extract the authentication scheme name, and prepare for reading
+       the attributes.  */
+    auth_attr = strchr(header, ' ');
+    if (auth_attr) {
+        auth_name = apr_pstrmemdup(ab->pool, header, auth_attr - header);
+        ++auth_attr;
+    }
+    else
+        auth_name = header;
+
+    ab->last_scheme_name = auth_name;
+
+    /* Find the matching authentication handler.
+       Note that we don't reuse the auth scheme stored in the context,
+       as that may have changed. (ex. fallback from ntlm to basic.) */
+    for (scheme = serf_authn_schemes; scheme->code != 0; ++scheme) {
+        if (! (ab->code == scheme->code &&
+               ctx->authn_types & scheme->type))
+            continue;
+
+        serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
+                      "Client supports: %s\n", scheme->name);
+        if (strcmp(auth_name, scheme->name) == 0) {
+            serf__auth_handler_func_t handler = scheme->handle_func;
+            apr_status_t status = 0;
+
+            serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
+                          "... matched: %s\n", scheme->name);
+            /* If this is the first time we use this scheme on this connection,
+               make sure to initialize the authentication handler first. */
+            if (ab->code == 401 && ctx->authn_info.scheme != scheme) {
+                status = scheme->init_ctx_func(ab->code, ctx, ctx->pool);
+                if (!status) {
+                    status = scheme->init_conn_func(ab->code, conn, 
conn->pool);
+
+                    if (!status)
+                        ctx->authn_info.scheme = scheme;
+                    else
+                        ctx->authn_info.scheme = NULL;
+                }
+            }
+            else if (ab->code == 407 && ctx->proxy_authn_info.scheme != 
scheme) {
+                status = scheme->init_ctx_func(ab->code, ctx, ctx->pool);
+                if (!status) {
+                    status = scheme->init_conn_func(ab->code, conn, 
conn->pool);
+
+                    if (!status)
+                        ctx->proxy_authn_info.scheme = scheme;
+                    else
+                        ctx->proxy_authn_info.scheme = NULL;
+                }
+            }
+
+            if (!status) {
+                scheme_found = TRUE;
+                ab->scheme = scheme;
+                status = handler(ab->code, ab->request, ab->response,
+                                 header, auth_attr, ab->baton, ctx->pool);
+            }
+
+            /* If the authentication fails, cache the error for now. Try the
+               next available scheme. If there's none raise the error. */
+            if (status) {
+                scheme_found = FALSE;
+                scheme = NULL;
+            }
+            /* Let the caller now if the authentication setup was succesful
+               or not. */
+            ab->status = status;
+
+            break;
+        }
+    }
+
+    /* If a matching scheme handler was found, we can stop iterating
+       over the response headers - so return a non-0 value. */
+    return scheme_found;
+}
+
+/* Dispatch authentication handling. This function matches the possible
+   authentication mechanisms with those available. Server and proxy
+   authentication are evaluated separately. */
+static apr_status_t dispatch_auth(int code,
+                                  serf_request_t *request,
+                                  serf_bucket_t *response,
+                                  void *baton,
+                                  apr_pool_t *pool)
+{
+    serf_bucket_t *hdrs;
+
+    if (code == 401 || code == 407) {
+        auth_baton_t ab = { 0 };
+        const char *auth_hdr;
+
+        ab.code = code;
+        ab.status = APR_SUCCESS;
+        ab.request = request;
+        ab.response = response;
+        ab.baton = baton;
+        ab.pool = pool;
+
+        /* Before iterating over all authn headers, check if there are any. */
+        if (code == 401)
+            ab.header = "WWW-Authenticate";
+        else
+            ab.header = "Proxy-Authenticate";
+
+        hdrs = serf_bucket_response_get_headers(response);
+        auth_hdr = serf_bucket_headers_get(hdrs, ab.header);
+
+        if (!auth_hdr) {
+            return SERF_ERROR_AUTHN_FAILED;
+        }
+        serf__log_skt(AUTH_VERBOSE, __FILE__, request->conn->skt,
+                      "%s authz required. Response header(s): %s\n",
+                      code == 401 ? "Server" : "Proxy", auth_hdr);
+
+        /* Iterate over all headers. Try to find a matching authentication 
scheme
+           handler.
+
+           Note: it is possible to have multiple Authentication: headers. We do
+           not want to combine them (per normal header combination rules) as 
that
+           would make it hard to parse. Instead, we want to individually parse
+           and handle each header in the response, looking for one that we can
+           work with.
+        */
+        serf_bucket_headers_do(hdrs,
+                               handle_auth_header,
+                               &ab);
+        if (ab.status != APR_SUCCESS)
+            return ab.status;
+
+        if (!ab.scheme || ab.scheme->name == NULL) {
+            /* No matching authentication found. */
+            return SERF_ERROR_AUTHN_NOT_SUPPORTED;
+        }
+    }
+
+    return APR_SUCCESS;
+}
+
+/* Read the headers of the response and try the available
+   handlers if authentication or validation is needed. */
+apr_status_t serf__handle_auth_response(int *consumed_response,
+                                        serf_request_t *request,
+                                        serf_bucket_t *response,
+                                        void *baton,
+                                        apr_pool_t *pool)
+{
+    apr_status_t status;
+    serf_status_line sl;
+
+    *consumed_response = 0;
+
+    /* TODO: the response bucket was created by the application, not at all
+       guaranteed that this is of type response_bucket!! */
+    status = serf_bucket_response_status(response, &sl);
+    if (SERF_BUCKET_READ_ERROR(status)) {
+        return status;
+    }
+    if (!sl.version && (APR_STATUS_IS_EOF(status) ||
+                        APR_STATUS_IS_EAGAIN(status))) {
+        return status;
+    }
+
+    status = serf_bucket_response_wait_for_headers(response);
+    if (status) {
+        if (!APR_STATUS_IS_EOF(status)) {
+            return status;
+        }
+
+        /* If status is APR_EOF, there were no headers to read.
+           This can be ok in some situations, and it definitely
+           means there's no authentication requested now. */
+        return APR_SUCCESS;
+    }
+
+    if (sl.code == 401 || sl.code == 407) {
+        /* Authentication requested. */
+
+        /* Don't bother handling the authentication request if the response
+           wasn't received completely yet. Serf will call 
serf__handle_auth_response
+           again when more data is received. */
+        status = discard_body(response);
+        *consumed_response = 1;
+        
+        /* Discard all response body before processing authentication. */
+        if (!APR_STATUS_IS_EOF(status)) {
+            return status;
+        }
+
+        status = dispatch_auth(sl.code, request, response, baton, pool);
+        if (status != APR_SUCCESS) {
+            return status;
+        }
+
+        /* Requeue the request with the necessary auth headers. */
+        /* ### Application doesn't know about this request! */
+        serf_connection_priority_request_create(request->conn,
+                                                request->setup,
+                                                request->setup_baton);
+
+        return APR_EOF;
+    } else {
+        /* Validate the response authn headers if needed. */
+        serf__validate_response_func_t validate_resp;
+        serf_connection_t *conn = request->conn;
+        serf_context_t *ctx = conn->ctx;
+        apr_status_t resp_status = APR_SUCCESS;
+        
+        if (ctx->authn_info.scheme) {
+            validate_resp = ctx->authn_info.scheme->validate_response_func;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to