]> git.ipfire.org Git - thirdparty/squid.git/commit - src/http.cc
Cleanup: base64 coder de-duplication and upgrade
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 2 May 2011 01:14:30 +0000 (19:14 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 2 May 2011 01:14:30 +0000 (19:14 -0600)
commit8bdd0cecd93bc861ed356a5b68eb6c7868451b9a
tree88b651d76f546d5f12c7bee09b5f72a2289f3ea5
parent99e4ad673c09ecb9ba3510a9a0c3dad3861e88e1
Cleanup: base64 coder de-duplication and upgrade

Markus Moeller has re-implemented several of the coder functions for use
by Kerberos helpers.

This patch seeks to de-duplicate them and combine the resulting code
back into the libmiscencoding.la "base64.h" implementation.

Changes include:

  * old function API renamed to old_*() and existing code update to use
the names. Some code has been updated to use the new API.

  * new estimator base64_encode_len()/base64_decode_len() functions added
to provide details of much much buffer space the output will require.

  * new API encoder and decoder functions added which accept caller
provided buffers and encode/decode an arbitrary string into them.

  * also fixes a bug where if the input text or output buffer was too
short the coder functions would crop a few bytes off the end of the result.
Noticable in Kerberos where token lengths are not fixed length.

Some optimizations have been added by myself over and above Markus changes:

  * optimized to short-circuit on several more variations of empty input
and nil result buffer.

  * sub-loop optimizations added to reduce the number of if() calls made
by the new code.

  * split encoder into terminated (C-str) and non-terminated variants.

Also documented both old and new APIs functions.
20 files changed:
helpers/negotiate_auth/SSPI/negotiate_sspi_auth.cc
helpers/negotiate_auth/kerberos/Makefile.am
helpers/negotiate_auth/kerberos/base64.cc [deleted file]
helpers/negotiate_auth/kerberos/base64.h [deleted file]
helpers/negotiate_auth/kerberos/negotiate_kerberos_auth.cc
helpers/negotiate_auth/kerberos/negotiate_kerberos_auth_test.cc
helpers/negotiate_auth/wrapper/Makefile.am
helpers/negotiate_auth/wrapper/negotiate_wrapper.cc
helpers/negotiate_auth/wrapper/nw_base64.cc [deleted file]
helpers/negotiate_auth/wrapper/nw_base64.h [deleted file]
helpers/ntlm_auth/SSPI/ntlm_sspi_auth.cc
helpers/ntlm_auth/fake/ntlm_fake_auth.cc
helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc
include/base64.h
lib/base64.c
src/HttpHeader.cc
src/adaptation/icap/ModXact.cc
src/http.cc
tools/cachemgr.cc
tools/squidclient.cc