summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2018-10-08 08:12:28 +0000
committerPeter Wemm <peter@FreeBSD.org>2018-10-08 08:12:28 +0000
commit110aebf74b4205a3ac01c7b59c1fb4145a1698a5 (patch)
tree61f50de69fb3a4a952c5b5a43085d688e38207da
parente52054a87e280687f7c530f9ecdcb93297ff4c71 (diff)
Notes
-rw-r--r--CHANGES27
-rw-r--r--NOTICE9
-rw-r--r--README21
-rw-r--r--SConstruct126
-rw-r--r--STATUS19
-rw-r--r--auth/auth.c27
-rw-r--r--auth/auth.h27
-rw-r--r--auth/auth_basic.c27
-rw-r--r--auth/auth_digest.c27
-rw-r--r--auth/auth_spnego.c28
-rw-r--r--auth/auth_spnego.h27
-rw-r--r--auth/auth_spnego_gss.c27
-rw-r--r--auth/auth_spnego_sspi.c31
-rw-r--r--buckets/aggregate_buckets.c27
-rw-r--r--buckets/allocator.c27
-rw-r--r--buckets/barrier_buckets.c27
-rw-r--r--buckets/buckets.c27
-rw-r--r--buckets/bwtp_buckets.c27
-rw-r--r--buckets/chunk_buckets.c27
-rw-r--r--buckets/dechunk_buckets.c27
-rw-r--r--buckets/deflate_buckets.c27
-rw-r--r--buckets/file_buckets.c27
-rw-r--r--buckets/headers_buckets.c27
-rw-r--r--buckets/iovec_buckets.c27
-rw-r--r--buckets/limit_buckets.c27
-rw-r--r--buckets/mmap_buckets.c27
-rw-r--r--buckets/request_buckets.c43
-rw-r--r--buckets/response_body_buckets.c27
-rw-r--r--buckets/response_buckets.c39
-rw-r--r--buckets/simple_buckets.c27
-rw-r--r--buckets/socket_buckets.c27
-rw-r--r--buckets/ssl_buckets.c173
-rwxr-xr-xbuild/check.py41
-rwxr-xr-xbuild/gen_def.py34
-rw-r--r--context.c35
-rw-r--r--incoming.c27
-rw-r--r--outgoing.c36
-rw-r--r--serf.h33
-rw-r--r--serf_bucket_types.h27
-rw-r--r--serf_bucket_util.h27
-rw-r--r--serf_private.h27
-rw-r--r--ssltunnel.c27
42 files changed, 899 insertions, 525 deletions
diff --git a/CHANGES b/CHANGES
index fcab2d629247f..b7ee76d01209f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,26 @@
-Serf 1.3.8 [2014-10-20, from /tags/1.3.8, rxxxx]
-Fix issue #152: CRC calculation error for gzipped http reponses > 4GB.
-Fix issue #153: SSPI CredHandle not freed when APR pool is destroyed.
-Fix issue #154: Disable SSLv2 and SSLv3 as both or broken.
+Apache Serf 1.3.9 [2016-09-01, from tags/1.3.9, rxxxx]
+ serf is now Apache Serf; apply header changes (r1700062)
+ Fix issue #151: SCons build broken when only one library in ENVPATH
+ Fix issue #153: avoid SSPI handle leak
+ Fix issue #167: Explicitly use the ANSI version of SSPI
+ Fix issue #170: Allow building with Microsoft Visual Studio 2015
+ Fix build of 'check' target when using VPATH-style builds (r1699858, ...)
+ (builddir != srcdir).
+ Resolve a bucket (aka "memory") leak when a request bucket is
+ destroyed before it is morphed into an aggregate bucket (r1699791)
+ Reset state variables when resetting connection (r1708849)
+ Fix types of passed, but unused batons (r1699986, r1699987)
+ Fix some usages of the openssl BIO api (r1699852)
+ Improve handling of bad data in the response state line. (r1699985)
+ Resolve several compiler issues with less common compilers
+ Support more overrides via SCons arguments (r1701836, ...)
+ Adapt to OpenSSL 1.1.x api (r1750819)
+
+
+Serf 1.3.8 [2014-10-20, from /tags/1.3.8, r2441]
+ Fix issue #152: CRC calculation error for gzipped http reponses > 4GB.
+ Fix issue #153: SSPI CredHandle not freed when APR pool is destroyed.
+ Fix issue #154: Disable SSLv2 and SSLv3 as both or broken.
Serf 1.3.7 [2014-08-11, from /tags/1.3.7, r2411]
diff --git a/NOTICE b/NOTICE
index 3f59805ce4385..6cc875ed93a21 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,2 +1,7 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
+Apache Serf
+Copyright 2015 The Apache Software Foundation
+
+This product includes software developed by many people, and distributed
+under Contributor License Agreements to The Apache Software Foundation
+(http://www.apache.org/). See the revision logs for an exact contribution
+history.
diff --git a/README b/README
index ead07b184e652..5e972ea801d67 100644
--- a/README
+++ b/README
@@ -1,15 +1,14 @@
-Welcome to serf, a high-performance asynchronous HTTP client library.
+Welcome to Apache Serf, a high-performance asynchronous HTTP client library.
-The serf library is a C-based HTTP client library built upon the Apache
+The Apache 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-dev@googlegroups.com
+ * Site: http://serf.apache.org//
+ * Code: http://svn.apache.org/repos/asf/serf/
+ * Issues: https://issues.apache.org/jira/browse/SERF
+ * Mail: dev@serf.apache.org
* People: Justin Erenkrantz, Greg Stein
----
@@ -18,8 +17,8 @@ kept to a minimum to provide high performance operation.
1.1. SCons build system
-serf uses SCons 2.3 for its build system. If it is not installed on
-your system, then you can install it onto your system. If you do not
+Apache Serf uses SCons 2.3 for its build system. If it is not installed
+on your system, then you can install it onto your system. If you do not
have permissions, then you can download and install the "local"
version into your home directory. When installed privately, simply
create a symlink for 'scons' in your PATH to /path/to/scons/scons.py.
@@ -28,7 +27,7 @@ Fetch the scons-local package:
http://prdownloads.sourceforge.net/scons/scons-local-2.3.0.tar.gz
-1.2 Building serf
+1.2 Building Apache Serf
To build serf:
@@ -70,7 +69,7 @@ $ scons --help
$ scons check
-1.4 Installing serf
+1.4 Installing Apache Serf
$ scons install
diff --git a/SConstruct b/SConstruct
index 0e4f98891f6bc..4358a2374584c 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,18 +1,23 @@
# -*- python -*-
#
-# Copyright 2011-2012 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.
+# ====================================================================
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+# ====================================================================
#
import sys
@@ -135,7 +140,8 @@ if sys.platform == 'win32':
EnumVariable('MSVC_VERSION',
"Visual C++ to use for building (E.g. 11.0, 9.0)",
None,
- allowed_values=('12.0', '11.0', '10.0', '9.0', '8.0', '6.0')
+ allowed_values=('14.0', '12.0',
+ '11.0', '10.0', '9.0', '8.0', '6.0')
),
# We always documented that we handle an install layout, but in fact we
@@ -177,8 +183,7 @@ CALLOUT_OKAY = not (env.GetOption('clean') or env.GetOption('help'))
unknown = opts.UnknownVariables()
if unknown:
- print 'Unknown variables:', ', '.join(unknown.keys())
- Exit(1)
+ print 'Warning: Used unknown variables:', ', '.join(unknown.keys())
apr = str(env['APR'])
apu = str(env['APU'])
@@ -210,7 +215,8 @@ incdir = '$PREFIX/include/serf-$MAJOR'
# Unfortunately we can't set the .dylib compatibility_version option separately
# from current_version, so don't use the PATCH level to avoid that build and
# runtime patch levels have to be identical.
-env['SHLIBVERSION'] = '%d.%d.%d' % (MAJOR, MINOR, 0)
+if sys.platform != 'sunos5':
+ env['SHLIBVERSION'] = '%d.%d.%d' % (MAJOR, MINOR, 0)
LIBNAME = 'libserf-%d' % (MAJOR,)
if sys.platform != 'win32':
@@ -223,31 +229,43 @@ env.Append(RPATH=libdir,
if sys.platform == 'darwin':
# linkflags.append('-Wl,-install_name,@executable_path/%s.dylib' % (LIBNAME,))
- env.Append(LINKFLAGS='-Wl,-install_name,%s/%s.dylib' % (thisdir, LIBNAME,))
+ env.Append(LINKFLAGS=['-Wl,-install_name,%s/%s.dylib' % (thisdir, LIBNAME,)])
if sys.platform != 'win32':
- ### gcc only. figure out appropriate test / better way to check these
- ### flags, and check for gcc.
- env.Append(CFLAGS='-std=c89')
+ def CheckGnuCC(context):
+ src = '''
+ #ifndef __GNUC__
+ oh noes!
+ #endif
+ '''
+ context.Message('Checking for GNU-compatible C compiler...')
+ result = context.TryCompile(src, '.c')
+ context.Result(result)
+ return result
+
+ conf = Configure(env, custom_tests = dict(CheckGnuCC=CheckGnuCC))
+ have_gcc = conf.CheckGnuCC()
+ env = conf.Finish()
- ### These warnings are not available on Solaris
- if sys.platform != 'sunos5':
+ if have_gcc:
+ env.Append(CFLAGS=['-std=c89'])
env.Append(CCFLAGS=['-Wdeclaration-after-statement',
'-Wmissing-prototypes',
'-Wall'])
if debug:
- env.Append(CCFLAGS='-g')
+ env.Append(CCFLAGS=['-g'])
env.Append(CPPDEFINES=['DEBUG', '_DEBUG'])
else:
- env.Append(CCFLAGS='-O2')
- env.Append(CPPDEFINES='NDEBUG')
+ env.Append(CCFLAGS=['-O2'])
+ env.Append(CPPDEFINES=['NDEBUG'])
### works for Mac OS. probably needs to change
env.Append(LIBS=['ssl', 'crypto', 'z', ])
if sys.platform == 'sunos5':
- env.Append(LIBS='m')
+ env.Append(LIBS=['m'])
+ env.Append(PLATFORM='posix')
else:
# Warning level 4, no unused argument warnings
env.Append(CCFLAGS=['/W4', '/wd4100'])
@@ -260,8 +278,8 @@ else:
else:
# Optimize for speed, use DLL runtime
env.Append(CCFLAGS=['/O2', '/MD'])
- env.Append(CPPDEFINES='NDEBUG')
- env.Append(LINKFLAGS='/RELEASE')
+ env.Append(CPPDEFINES=['NDEBUG'])
+ env.Append(LINKFLAGS=['/RELEASE'])
# PLAN THE BUILD
SHARED_SOURCES = []
@@ -291,6 +309,7 @@ if sys.platform == 'win32':
if aprstatic:
apr_libs='apr-1.lib'
apu_libs='aprutil-1.lib'
+ env.Append(LIBS=['shell32.lib', 'xml.lib'])
else:
apr_libs='libapr-1.lib'
apu_libs='libaprutil-1.lib'
@@ -307,25 +326,25 @@ if sys.platform == 'win32':
CPPPATH=['$APR/include', '$APU/include'])
# zlib
- env.Append(LIBS='zlib.lib')
+ env.Append(LIBS=['zlib.lib'])
if not env.get('SOURCE_LAYOUT', None):
- env.Append(CPPPATH='$ZLIB/include',
- LIBPATH='$ZLIB/lib')
+ env.Append(CPPPATH=['$ZLIB/include'],
+ LIBPATH=['$ZLIB/lib'])
else:
- env.Append(CPPPATH='$ZLIB',
- LIBPATH='$ZLIB')
+ env.Append(CPPPATH=['$ZLIB'],
+ LIBPATH=['$ZLIB'])
# openssl
env.Append(LIBS=['libeay32.lib', 'ssleay32.lib'])
if not env.get('SOURCE_LAYOUT', None):
- env.Append(CPPPATH='$OPENSSL/include/openssl',
- LIBPATH='$OPENSSL/lib')
+ env.Append(CPPPATH=['$OPENSSL/include/openssl'],
+ LIBPATH=['$OPENSSL/lib'])
elif 0: # opensslstatic:
- env.Append(CPPPATH='$OPENSSL/inc32',
- LIBPATH='$OPENSSL/out32')
+ env.Append(CPPPATH=['$OPENSSL/inc32'],
+ LIBPATH=['$OPENSSL/out32'])
else:
- env.Append(CPPPATH='$OPENSSL/inc32',
- LIBPATH='$OPENSSL/out32dll')
+ env.Append(CPPPATH=['$OPENSSL/inc32'],
+ LIBPATH=['$OPENSSL/out32dll'])
else:
if os.path.isdir(apr):
apr = os.path.join(apr, 'bin', 'apr-1-config')
@@ -351,8 +370,8 @@ else:
apr_libs = ''
apu_libs = ''
- env.Append(CPPPATH='$OPENSSL/include')
- env.Append(LIBPATH='$OPENSSL/lib')
+ env.Append(CPPPATH=['$OPENSSL/include'])
+ env.Append(LIBPATH=['$OPENSSL/lib'])
# If build with gssapi, get its information and define SERF_HAVE_GSSAPI
@@ -362,7 +381,7 @@ if gssapi and CALLOUT_OKAY:
env['GSSAPI_LIBS'] = cmd.strip()
return env.MergeFlags(cmd, unique)
env.ParseConfig('$GSSAPI --libs gssapi', parse_libs)
- env.Append(CPPDEFINES='SERF_HAVE_GSSAPI')
+ env.Append(CPPDEFINES=['SERF_HAVE_GSSAPI'])
if sys.platform == 'win32':
env.Append(CPPDEFINES=['SERF_HAVE_SSPI'])
@@ -428,6 +447,12 @@ env.Alias('install', ['install-lib', 'install-inc', 'install-pc', ])
tenv = env.Clone()
+# MockHTTP requires C99 standard, so use it for the test suite.
+cflags = tenv['CFLAGS']
+tenv.Replace(CFLAGS = [f.replace('-std=c89', '-std=c99') for f in cflags])
+
+tenv.Append(CPPDEFINES=['MOCKHTTP_OPENSSL'])
+
TEST_PROGRAMS = [ 'serf_get', 'serf_response', 'serf_request', 'serf_spider',
'test_all', 'serf_bwtp' ]
if sys.platform == 'win32':
@@ -435,14 +460,23 @@ if sys.platform == 'win32':
else:
TEST_EXES = [ os.path.join('test', '%s' % (prog)) for prog in TEST_PROGRAMS ]
-env.AlwaysBuild(env.Alias('check', TEST_EXES, sys.executable + ' build/check.py',
- ENV={'PATH' : os.environ['PATH']}))
-
# Find the (dynamic) library in this directory
tenv.Replace(RPATH=thisdir)
tenv.Prepend(LIBS=[LIBNAMESTATIC, ],
LIBPATH=[thisdir, ])
+check_script = env.File('build/check.py').rstr()
+test_dir = env.File('test/test_all.c').rfile().get_dir()
+src_dir = env.File('serf.h').rfile().get_dir()
+test_app = ("%s %s %s %s") % (sys.executable, check_script, test_dir, 'test')
+
+# Set the library search path for the test programs
+test_env = {'PATH' : os.environ['PATH'],
+ 'srcdir' : src_dir}
+if sys.platform != 'win32':
+ test_env['LD_LIBRARY_PATH'] = ':'.join(tenv.get('LIBPATH', []))
+env.AlwaysBuild(env.Alias('check', TEST_EXES, test_app, ENV=test_env))
+
testall_files = [
'test/test_all.c',
'test/CuTest.c',
diff --git a/STATUS b/STATUS
new file mode 100644
index 0000000000000..d4737201793e4
--- /dev/null
+++ b/STATUS
@@ -0,0 +1,19 @@
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * *
+ * THIS RELEASE STREAM IS OPEN TO BUG FIXES. *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+This file tracks the status of releases in the 1.3.x line.
+
+Status of 1.3.9:
+
+Candidate changes:
+==================
+
+Veto-blocked changes:
+=====================
+
+Approved changes:
+=================
+
diff --git a/auth/auth.c b/auth/auth.c
index 6ba3ba5ab59e6..420899947c0d4 100644
--- a/auth/auth.c
+++ b/auth/auth.c
@@ -1,16 +1,21 @@
-/* Copyright 2009 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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"
diff --git a/auth/auth.h b/auth/auth.h
index 7d043757adee0..b0a8c743c0a40 100644
--- a/auth/auth.h
+++ b/auth/auth.h
@@ -1,16 +1,21 @@
-/* Copyright 2009 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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.
+ * ====================================================================
*/
#ifndef AUTH_H
diff --git a/auth/auth_basic.c b/auth/auth_basic.c
index dcee4a4ebb248..fc056d4b60024 100644
--- a/auth/auth_basic.c
+++ b/auth/auth_basic.c
@@ -1,16 +1,21 @@
-/* Copyright 2009 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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.
+ * ====================================================================
*/
/*** Basic authentication ***/
diff --git a/auth/auth_digest.c b/auth/auth_digest.c
index b2c7dec0100c0..867d8e328cde1 100644
--- a/auth/auth_digest.c
+++ b/auth/auth_digest.c
@@ -1,16 +1,21 @@
-/* Copyright 2009 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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.
+ * ====================================================================
*/
/*** Digest authentication ***/
diff --git a/auth/auth_spnego.c b/auth/auth_spnego.c
index e55fad2ae938b..e7984dab19ac7 100644
--- a/auth/auth_spnego.c
+++ b/auth/auth_spnego.c
@@ -1,18 +1,24 @@
-/* Copyright 2009 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 "auth_spnego.h"
#ifdef SERF_HAVE_SPNEGO
diff --git a/auth/auth_spnego.h b/auth/auth_spnego.h
index 86356295c8823..0ebf1f773f771 100644
--- a/auth/auth_spnego.h
+++ b/auth/auth_spnego.h
@@ -1,16 +1,21 @@
-/* Copyright 2010 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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.
+ * ====================================================================
*/
#ifndef AUTH_SPNEGO_H
diff --git a/auth/auth_spnego_gss.c b/auth/auth_spnego_gss.c
index 0f33385fe6a64..675bdb5eb768e 100644
--- a/auth/auth_spnego_gss.c
+++ b/auth/auth_spnego_gss.c
@@ -1,16 +1,21 @@
-/* Copyright 2009 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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"
diff --git a/auth/auth_spnego_sspi.c b/auth/auth_spnego_sspi.c
index 32b719ee556a2..0882209037bd2 100644
--- a/auth/auth_spnego_sspi.c
+++ b/auth/auth_spnego_sspi.c
@@ -1,16 +1,21 @@
-/* Copyright 2010 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 "auth_spnego.h"
@@ -138,7 +143,7 @@ serf__spnego_create_sec_context(serf__spnego_context_t **ctx_p,
else
sspi_package = "NTLM";
- sspi_status = AcquireCredentialsHandle(
+ sspi_status = AcquireCredentialsHandleA(
NULL, sspi_package, SECPKG_CRED_OUTBOUND,
NULL, NULL, NULL, NULL,
&ctx->sspi_credentials, NULL);
@@ -247,7 +252,7 @@ serf__spnego_init_sec_context(serf_connection_t *conn,
sspi_out_buffer_desc.pBuffers = &sspi_out_buffer;
sspi_out_buffer_desc.ulVersion = SECBUFFER_VERSION;
- status = InitializeSecurityContext(
+ status = InitializeSecurityContextA(
&ctx->sspi_credentials,
ctx->initalized ? &ctx->sspi_context : NULL,
ctx->target_name,
diff --git a/buckets/aggregate_buckets.c b/buckets/aggregate_buckets.c
index 2ae3fd538b96f..952c7d41d805e 100644
--- a/buckets/aggregate_buckets.c
+++ b/buckets/aggregate_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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"
diff --git a/buckets/allocator.c b/buckets/allocator.c
index 108167e016caf..bb02f45adef0e 100644
--- a/buckets/allocator.c
+++ b/buckets/allocator.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <stdlib.h>
diff --git a/buckets/barrier_buckets.c b/buckets/barrier_buckets.c
index eb410eea3591f..86b89840d17d4 100644
--- a/buckets/barrier_buckets.c
+++ b/buckets/barrier_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/buckets/buckets.c b/buckets/buckets.c
index 88e256b8c7fdd..c8b597ad41021 100644
--- a/buckets/buckets.c
+++ b/buckets/buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/buckets/bwtp_buckets.c b/buckets/bwtp_buckets.c
index 7ef3047df2ce0..37e774f5458f0 100644
--- a/buckets/bwtp_buckets.c
+++ b/buckets/bwtp_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/buckets/chunk_buckets.c b/buckets/chunk_buckets.c
index 7f255088e6625..6e590676e4463 100644
--- a/buckets/chunk_buckets.c
+++ b/buckets/chunk_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/buckets/dechunk_buckets.c b/buckets/dechunk_buckets.c
index eda1e22642a30..1a2772008bdf3 100644
--- a/buckets/dechunk_buckets.c
+++ b/buckets/dechunk_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_strings.h>
diff --git a/buckets/deflate_buckets.c b/buckets/deflate_buckets.c
index 348d70d993dc6..6d432562d645a 100644
--- a/buckets/deflate_buckets.c
+++ b/buckets/deflate_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_strings.h>
diff --git a/buckets/file_buckets.c b/buckets/file_buckets.c
index bd41cabfe5078..364cb1c98e2b5 100644
--- a/buckets/file_buckets.c
+++ b/buckets/file_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/buckets/headers_buckets.c b/buckets/headers_buckets.c
index 04e64d19b63b1..35bf0536576c3 100644
--- a/buckets/headers_buckets.c
+++ b/buckets/headers_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <stdlib.h>
diff --git a/buckets/iovec_buckets.c b/buckets/iovec_buckets.c
index 9ac1d8d17941b..d31e622089c7c 100644
--- a/buckets/iovec_buckets.c
+++ b/buckets/iovec_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2011 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/buckets/limit_buckets.c b/buckets/limit_buckets.c
index 70b7efb3d620d..95c4fb1eca476 100644
--- a/buckets/limit_buckets.c
+++ b/buckets/limit_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/buckets/mmap_buckets.c b/buckets/mmap_buckets.c
index c96bce43fc616..bfa82083943ef 100644
--- a/buckets/mmap_buckets.c
+++ b/buckets/mmap_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/buckets/request_buckets.c b/buckets/request_buckets.c
index 912da8ad6df77..8d1a963efc0d1 100644
--- a/buckets/request_buckets.c
+++ b/buckets/request_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
@@ -190,6 +195,20 @@ static apr_status_t serf_request_peek(serf_bucket_t *bucket,
return serf_bucket_peek(bucket, data, len);
}
+/* Note that this function is only called when serialize_data()
+ hasn't been called on the bucket */
+static void serf_request_destroy(serf_bucket_t *bucket)
+{
+ request_context_t *ctx = bucket->data;
+
+ serf_bucket_destroy(ctx->headers);
+
+ if (ctx->body)
+ serf_bucket_destroy(ctx->body);
+
+ serf_default_destroy_and_data(bucket);
+}
+
void serf_bucket_request_become(
serf_bucket_t *bucket,
const char *method,
@@ -218,6 +237,6 @@ const serf_bucket_type_t serf_bucket_type_request = {
serf_default_read_for_sendfile,
serf_default_read_bucket,
serf_request_peek,
- serf_default_destroy_and_data,
+ serf_request_destroy,
};
diff --git a/buckets/response_body_buckets.c b/buckets/response_body_buckets.c
index c9648a69f6dab..3e18c07df0e50 100644
--- a/buckets/response_body_buckets.c
+++ b/buckets/response_body_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/buckets/response_buckets.c b/buckets/response_buckets.c
index 39518bbd856e1..eb72ef9906f6c 100644
--- a/buckets/response_buckets.c
+++ b/buckets/response_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_lib.h>
@@ -128,7 +133,17 @@ static apr_status_t parse_status_line(response_context_t *ctx,
int res;
char *reason; /* ### stupid APR interface makes this non-const */
- /* ctx->linebuf.line should be of form: HTTP/1.1 200 OK */
+ /* Ensure a valid length, to avoid overflow on the final '\0' */
+ if (ctx->linebuf.used >= SERF_LINEBUF_LIMIT) {
+ return SERF_ERROR_BAD_HTTP_RESPONSE;
+ }
+
+ /* apr_date_checkmask assumes its arguments are valid C strings */
+ ctx->linebuf.line[ctx->linebuf.used] = '\0';
+
+ /* ctx->linebuf.line should be of form: 'HTTP/1.1 200 OK',
+ but we also explicitly allow the forms 'HTTP/1.1 200' (no reason)
+ and 'HTTP/1.1 401.1 Logon failed' (iis extended error codes) */
res = apr_date_checkmask(ctx->linebuf.line, "HTTP/#.# ###*");
if (!res) {
/* Not an HTTP response? Well, at least we won't understand it. */
diff --git a/buckets/simple_buckets.c b/buckets/simple_buckets.c
index 7ce7aeb25fd14..656e082c41def 100644
--- a/buckets/simple_buckets.c
+++ b/buckets/simple_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/buckets/socket_buckets.c b/buckets/socket_buckets.c
index d0facdab0daf9..25dc07b54d810 100644
--- a/buckets/socket_buckets.c
+++ b/buckets/socket_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/buckets/ssl_buckets.c b/buckets/ssl_buckets.c
index 579814ec81ac6..b01e5359db08b 100644
--- a/buckets/ssl_buckets.c
+++ b/buckets/ssl_buckets.c
@@ -1,36 +1,24 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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.
+ * ====================================================================
*
* ----
*
- * For the OpenSSL thread-safety locking code:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- *
* Originally developed by Aaron Bannert and Justin Erenkrantz, eBuilt.
*/
@@ -64,6 +52,10 @@
#define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary)))
#endif
+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L
+#define USE_OPENSSL_1_1_API
+#endif
+
/*
* Here's an overview of the SSL bucket's relationship to OpenSSL and serf.
@@ -152,6 +144,7 @@ struct serf_ssl_context_t {
SSL_CTX *ctx;
SSL *ssl;
BIO *bio;
+ BIO_METHOD *biom;
serf_ssl_stream_t encrypt;
serf_ssl_stream_t decrypt;
@@ -244,10 +237,28 @@ apps_ssl_info_callback(const SSL *s, int where, int ret)
}
#endif
+static void bio_set_data(BIO *bio, void *data)
+{
+#ifdef USE_OPENSSL_1_1_API
+ BIO_set_data(bio, data);
+#else
+ bio->ptr = data;
+#endif
+}
+
+static void *bio_get_data(BIO *bio)
+{
+#ifdef USE_OPENSSL_1_1_API
+ return BIO_get_data(bio);
+#else
+ return bio->ptr;
+#endif
+}
+
/* Returns the amount read. */
static int bio_bucket_read(BIO *bio, char *in, int inlen)
{
- serf_ssl_context_t *ctx = bio->ptr;
+ serf_ssl_context_t *ctx = bio_get_data(bio);
const char *data;
apr_status_t status;
apr_size_t len;
@@ -291,7 +302,7 @@ static int bio_bucket_read(BIO *bio, char *in, int inlen)
/* Returns the amount written. */
static int bio_bucket_write(BIO *bio, const char *in, int inl)
{
- serf_ssl_context_t *ctx = bio->ptr;
+ serf_ssl_context_t *ctx = bio_get_data(bio);
serf_bucket_t *tmp;
serf__log(SSL_VERBOSE, __FILE__, "bio_bucket_write called for %d bytes\n",
@@ -319,19 +330,16 @@ static int bio_bucket_write(BIO *bio, const char *in, int inl)
/* Returns the amount read. */
static int bio_file_read(BIO *bio, char *in, int inlen)
{
- apr_file_t *file = bio->ptr;
+ apr_file_t *file = bio_get_data(bio);
apr_status_t status;
apr_size_t len;
- BIO_clear_retry_flags(bio);
-
len = inlen;
status = apr_file_read(file, in, &len);
if (!SERF_BUCKET_READ_ERROR(status)) {
/* Oh suck. */
if (APR_STATUS_IS_EOF(status)) {
- BIO_set_retry_read(bio);
return -1;
} else {
return len;
@@ -344,7 +352,7 @@ static int bio_file_read(BIO *bio, char *in, int inlen)
/* Returns the amount written. */
static int bio_file_write(BIO *bio, const char *in, int inl)
{
- apr_file_t *file = bio->ptr;
+ apr_file_t *file = bio_get_data(bio);
apr_size_t nbytes;
BIO_clear_retry_flags(bio);
@@ -357,15 +365,32 @@ static int bio_file_write(BIO *bio, const char *in, int inl)
static int bio_file_gets(BIO *bio, char *in, int inlen)
{
- return bio_file_read(bio, in, inlen);
+ apr_file_t *file = bio_get_data(bio);
+ apr_status_t status;
+
+ status = apr_file_gets(in, inlen, file);
+
+ if (! status) {
+ return (int)strlen(in);
+ } else if (APR_STATUS_IS_EOF(status)) {
+ return 0;
+ } else {
+ return -1; /* Signal generic error */
+ }
}
static int bio_bucket_create(BIO *bio)
{
+#ifdef USE_OPENSSL_1_1_API
+ BIO_set_shutdown(bio, 1);
+ BIO_set_init(bio, 1);
+ BIO_set_data(bio, NULL);
+#else
bio->shutdown = 1;
bio->init = 1;
bio->num = -1;
bio->ptr = NULL;
+#endif
return 1;
}
@@ -399,6 +424,7 @@ static long bio_bucket_ctrl(BIO *bio, int cmd, long num, void *ptr)
return ret;
}
+#ifndef USE_OPENSSL_1_1_API
static BIO_METHOD bio_bucket_method = {
BIO_TYPE_MEM,
"Serf SSL encryption and decryption buckets",
@@ -428,6 +454,55 @@ static BIO_METHOD bio_file_method = {
NULL /* sslc does not have the callback_ctrl field */
#endif
};
+#endif
+
+static BIO_METHOD *bio_meth_bucket_new(void)
+{
+ BIO_METHOD *biom = NULL;
+
+#ifdef USE_OPENSSL_1_1_API
+ biom = BIO_meth_new(BIO_TYPE_MEM,
+ "Serf SSL encryption and decryption buckets");
+ if (biom) {
+ BIO_meth_set_write(biom, bio_bucket_write);
+ BIO_meth_set_read(biom, bio_bucket_read);
+ BIO_meth_set_ctrl(biom, bio_bucket_ctrl);
+ BIO_meth_set_create(biom, bio_bucket_create);
+ BIO_meth_set_destroy(biom, bio_bucket_destroy);
+ }
+#else
+ biom = &bio_bucket_method;
+#endif
+
+ return biom;
+}
+
+static BIO_METHOD *bio_meth_file_new(void)
+{
+ BIO_METHOD *biom = NULL;
+
+#ifdef USE_OPENSSL_1_1_API
+ biom = BIO_meth_new(BIO_TYPE_FILE,
+ "Wrapper around APR file structures");
+ BIO_meth_set_write(biom, bio_file_write);
+ BIO_meth_set_read(biom, bio_file_read);
+ BIO_meth_set_gets(biom, bio_file_gets);
+ BIO_meth_set_ctrl(biom, bio_bucket_ctrl);
+ BIO_meth_set_create(biom, bio_bucket_create);
+ BIO_meth_set_destroy(biom, bio_bucket_destroy);
+#else
+ biom = &bio_file_method;
+#endif
+
+ return biom;
+}
+
+static void bio_meth_free(BIO_METHOD *biom)
+{
+#ifdef USE_OPENSSL_1_1_API
+ BIO_meth_free(biom);
+#endif
+}
typedef enum san_copy_t {
EscapeNulAndCopy = 0,
@@ -977,7 +1052,7 @@ static apr_status_t ssl_encrypt(void *baton, apr_size_t bufsize,
return status;
}
-#if APR_HAS_THREADS
+#if APR_HAS_THREADS && !defined(USE_OPENSSL_1_1_API)
static apr_pool_t *ssl_pool;
static apr_thread_mutex_t **ssl_locks;
@@ -1064,7 +1139,7 @@ static void init_ssl_libraries(void)
val = apr_atomic_cas32(&have_init_ssl, INIT_BUSY, INIT_UNINITIALIZED);
if (!val) {
-#if APR_HAS_THREADS
+#if APR_HAS_THREADS && !defined(USE_OPENSSL_1_1_API)
int i, numlocks;
#endif
@@ -1081,13 +1156,17 @@ static void init_ssl_libraries(void)
}
#endif
+#ifdef USE_OPENSSL_1_1_API
+ OPENSSL_malloc_init();
+#else
CRYPTO_malloc_init();
+#endif
ERR_load_crypto_strings();
SSL_load_error_strings();
SSL_library_init();
OpenSSL_add_all_algorithms();
-#if APR_HAS_THREADS
+#if APR_HAS_THREADS && !defined(USE_OPENSSL_1_1_API)
numlocks = CRYPTO_num_locks();
apr_pool_create(&ssl_pool, NULL);
ssl_locks = apr_palloc(ssl_pool, sizeof(apr_thread_mutex_t*)*numlocks);
@@ -1140,6 +1219,7 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
const char *cert_path;
apr_file_t *cert_file;
BIO *bio;
+ BIO_METHOD *biom;
PKCS12 *p12;
int i;
int retrying_success = 0;
@@ -1165,8 +1245,9 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
continue;
}
- bio = BIO_new(&bio_file_method);
- bio->ptr = cert_file;
+ biom = bio_meth_file_new();
+ bio = BIO_new(biom);
+ bio_set_data(bio, cert_file);
ctx->cert_path = cert_path;
p12 = d2i_PKCS12_bio(bio, NULL);
@@ -1176,6 +1257,7 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
if (i == 1) {
PKCS12_free(p12);
+ bio_meth_free(biom);
ctx->cached_cert = *cert;
ctx->cached_cert_pw = *pkey;
if (!retrying_success && ctx->cert_cache_pool) {
@@ -1211,6 +1293,7 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
i = PKCS12_parse(p12, password, pkey, cert, NULL);
if (i == 1) {
PKCS12_free(p12);
+ bio_meth_free(biom);
ctx->cached_cert = *cert;
ctx->cached_cert_pw = *pkey;
if (!retrying_success && ctx->cert_cache_pool) {
@@ -1238,6 +1321,7 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
}
}
PKCS12_free(p12);
+ bio_meth_free(biom);
return 0;
}
else {
@@ -1245,6 +1329,7 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
ERR_GET_FUNC(err),
ERR_GET_REASON(err));
PKCS12_free(p12);
+ bio_meth_free(biom);
}
}
}
@@ -1339,8 +1424,9 @@ static serf_ssl_context_t *ssl_init_context(serf_bucket_alloc_t *allocator)
disable_compression(ssl_ctx);
ssl_ctx->ssl = SSL_new(ssl_ctx->ctx);
- ssl_ctx->bio = BIO_new(&bio_bucket_method);
- ssl_ctx->bio->ptr = ssl_ctx;
+ ssl_ctx->biom = bio_meth_bucket_new();
+ ssl_ctx->bio = BIO_new(ssl_ctx->biom);
+ bio_set_data(ssl_ctx->bio, ssl_ctx);
SSL_set_bio(ssl_ctx->ssl, ssl_ctx->bio, ssl_ctx->bio);
@@ -1383,6 +1469,7 @@ static apr_status_t ssl_free_context(
/* SSL_free implicitly frees the underlying BIO. */
SSL_free(ssl_ctx->ssl);
+ bio_meth_free(ssl_ctx->biom);
SSL_CTX_free(ssl_ctx->ctx);
serf_bucket_mem_free(ssl_ctx->allocator, ssl_ctx);
diff --git a/build/check.py b/build/check.py
index f440e45c84052..2dacb4cd2a41e 100755
--- a/build/check.py
+++ b/build/check.py
@@ -2,21 +2,25 @@
#
# check.py : Run all the test cases.
#
-# ====================================================================
-# Copyright 2013 Justin Erenkrantz and Greg Stein
+# ===================================================================
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+# ===================================================================
#
-# 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.
-# ====================================================================
import sys
import glob
@@ -31,6 +35,11 @@ if __name__ == '__main__':
else:
testdir = 'test'
+ if len(sys.argv) > 2:
+ test_builddir = sys.argv[2]
+ else:
+ test_builddir = 'test'
+
# define test executable paths
if sys.platform == 'win32':
SERF_RESPONSE_EXE = 'serf_response.exe'
@@ -38,8 +47,8 @@ if __name__ == '__main__':
else:
SERF_RESPONSE_EXE = 'serf_response'
TEST_ALL_EXE = 'test_all'
- SERF_RESPONSE_EXE = os.path.join(testdir, SERF_RESPONSE_EXE)
- TEST_ALL_EXE = os.path.join(testdir, TEST_ALL_EXE)
+ SERF_RESPONSE_EXE = os.path.join(test_builddir, SERF_RESPONSE_EXE)
+ TEST_ALL_EXE = os.path.join(test_builddir, TEST_ALL_EXE)
# Find test responses and run them one by one
for case in glob.glob(testdir + "/testcases/*.response"):
diff --git a/build/gen_def.py b/build/gen_def.py
index ed139e6813330..f4330a58e3cba 100755
--- a/build/gen_def.py
+++ b/build/gen_def.py
@@ -2,22 +2,24 @@
#
# gen_def.py : Generate the .DEF file for Windows builds
#
-# ====================================================================
-# Copyright 2002-2010 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.
-# ====================================================================
-#
+# ===================================================================
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+# ===================================================================
#
# Typically, this script is used like:
#
diff --git a/context.c b/context.c
index b53b0a08a1c75..9b521381f7158 100644
--- a/context.c
+++ b/context.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
@@ -212,7 +217,7 @@ apr_status_t serf_event_trigger(
tdesc.desc.s = conn->skt;
tdesc.reqevents = conn->reqevents;
ctx->pollset_rm(ctx->pollset_baton,
- &tdesc, conn);
+ &tdesc, &conn->baton);
return conn->status;
}
/* apr_pollset_poll() can return a conn multiple times... */
@@ -233,7 +238,7 @@ apr_status_t serf_event_trigger(
tdesc.desc.s = conn->skt;
tdesc.reqevents = conn->reqevents;
ctx->pollset_rm(ctx->pollset_baton,
- &tdesc, conn);
+ &tdesc, &conn->baton);
}
return conn->status;
}
@@ -295,9 +300,9 @@ apr_status_t serf_context_run(
}
while (num--) {
- serf_connection_t *conn = desc->client_data;
+ serf_io_baton_t *io = desc->client_data;
- status = serf_event_trigger(ctx, conn, desc);
+ status = serf_event_trigger(ctx, io, desc);
if (status) {
return status;
}
diff --git a/incoming.c b/incoming.c
index 2757428ece92e..c978984ffd4c7 100644
--- a/incoming.c
+++ b/incoming.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
diff --git a/outgoing.c b/outgoing.c
index 3fc726c038e48..5f5f6b51da453 100644
--- a/outgoing.c
+++ b/outgoing.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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 <apr_pools.h>
@@ -142,7 +147,7 @@ apr_status_t serf__conn_update_pollset(serf_connection_t *conn)
desc.reqevents = conn->reqevents;
status = ctx->pollset_rm(ctx->pollset_baton,
- &desc, conn);
+ &desc, &conn->baton);
if (status && !APR_STATUS_IS_NOTFOUND(status))
return status;
@@ -547,7 +552,7 @@ static apr_status_t remove_connection(serf_context_t *ctx,
desc.reqevents = conn->reqevents;
return ctx->pollset_rm(ctx->pollset_baton,
- &desc, conn);
+ &desc, &conn->baton);
}
/* A socket was closed, inform the application. */
@@ -623,6 +628,11 @@ static apr_status_t reset_connection(serf_connection_t *conn,
conn->ctx->dirty_pollset = 1;
conn->state = SERF_CONN_INIT;
+ conn->hit_eof = 0;
+ conn->connect_time = 0;
+ conn->latency = -1;
+ conn->stop_writing = 0;
+
serf__log(CONN_VERBOSE, __FILE__, "reset connection 0x%x\n", conn);
conn->status = APR_SUCCESS;
diff --git a/serf.h b/serf.h
index 79504a5617e66..f9fb975235119 100644
--- a/serf.h
+++ b/serf.h
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 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.
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ * ====================================================================
*/
#ifndef SERF_H
@@ -1062,7 +1067,7 @@ void serf_debug__bucket_alloc_check(
/* Version info */
#define SERF_MAJOR_VERSION 1
#define SERF_MINOR_VERSION 3
-#define SERF_PATCH_VERSION 8
+#define SERF_PATCH_VERSION 9
/* Version number string */
#define SERF_VERSION_STRING APR_STRINGIFY(SERF_MAJOR_VERSION) "." \
diff --git a/serf_bucket_types.h b/serf_bucket_types.h
index 900f67d1673f1..190dd12b974f5 100644
--- a/serf_bucket_types.h
+++ b/serf_bucket_types.h
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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.
+ * ====================================================================
*/
#ifndef SERF_BUCKET_TYPES_H
diff --git a/serf_bucket_util.h b/serf_bucket_util.h
index b146c226839d1..dbacd3d8978db 100644
--- a/serf_bucket_util.h
+++ b/serf_bucket_util.h
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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.
+ * ====================================================================
*/
#ifndef SERF_BUCKET_UTIL_H
diff --git a/serf_private.h b/serf_private.h
index d38680b473bc1..f906379b6798a 100644
--- a/serf_private.h
+++ b/serf_private.h
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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.
+ * ====================================================================
*/
#ifndef _SERF_PRIVATE_H_
diff --git a/ssltunnel.c b/ssltunnel.c
index 0ad04d6770362..2c5c885a9c61e 100644
--- a/ssltunnel.c
+++ b/ssltunnel.c
@@ -1,16 +1,21 @@
-/* Copyright 2011 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * 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
*
- * 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.
+ * 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.
+ * ====================================================================
*/
/*** Setup a SSL tunnel over a HTTP proxy, according to RFC 2817. ***/