diff -u -r -N squid-3.1.12.3/ChangeLog squid-3.1.13/ChangeLog
--- squid-3.1.12.3/ChangeLog	2011-06-18 21:02:56.000000000 +1200
+++ squid-3.1.13/ChangeLog	2011-07-01 14:48:17.000000000 +1200
@@ -1,3 +1,9 @@
+Changes to squid-3.1.13 (01 Jul 2011):
+
+	- Regression Bug 3239: problems with myip/myport upgrade
+	- Bug 3153: hung ICAP RESPMOD transactions
+	- Update ssl_crtd to use 'OK' status inline with other helpers
+
 Changes to squid-3.1.12.3 (18 Jun 2011):
 
 	- Bug 3236: Port of %oa, %<lp and %<lp and %<la log format options
diff -u -r -N squid-3.1.12.3/configure squid-3.1.13/configure
--- squid-3.1.12.3/configure	2011-06-18 21:05:12.000000000 +1200
+++ squid-3.1.13/configure	2011-07-01 14:50:54.000000000 +1200
@@ -1,7 +1,7 @@
 #! /bin/sh
 # From configure.ac Revision.
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for Squid Web Proxy 3.1.12.3.
+# Generated by GNU Autoconf 2.68 for Squid Web Proxy 3.1.13.
 #
 # Report bugs to <http://www.squid-cache.org/bugs/>.
 #
@@ -575,8 +575,8 @@
 # Identity of this package.
 PACKAGE_NAME='Squid Web Proxy'
 PACKAGE_TARNAME='squid'
-PACKAGE_VERSION='3.1.12.3'
-PACKAGE_STRING='Squid Web Proxy 3.1.12.3'
+PACKAGE_VERSION='3.1.13'
+PACKAGE_STRING='Squid Web Proxy 3.1.13'
 PACKAGE_BUGREPORT='http://www.squid-cache.org/bugs/'
 PACKAGE_URL=''
 
@@ -1539,7 +1539,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Squid Web Proxy 3.1.12.3 to adapt to many kinds of systems.
+\`configure' configures Squid Web Proxy 3.1.13 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1609,7 +1609,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Squid Web Proxy 3.1.12.3:";;
+     short | recursive ) echo "Configuration of Squid Web Proxy 3.1.13:";;
    esac
   cat <<\_ACEOF
 
@@ -1940,7 +1940,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Squid Web Proxy configure 3.1.12.3
+Squid Web Proxy configure 3.1.13
 generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2951,7 +2951,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Squid Web Proxy $as_me 3.1.12.3, which was
+It was created by Squid Web Proxy $as_me 3.1.13, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
@@ -3770,7 +3770,7 @@
 
 # Define the identity of the package.
  PACKAGE='squid'
- VERSION='3.1.12.3'
+ VERSION='3.1.13'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -28135,7 +28135,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Squid Web Proxy $as_me 3.1.12.3, which was
+This file was extended by Squid Web Proxy $as_me 3.1.13, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -28201,7 +28201,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Squid Web Proxy config.status 3.1.12.3
+Squid Web Proxy config.status 3.1.13
 configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
diff -u -r -N squid-3.1.12.3/configure.ac squid-3.1.13/configure.ac
--- squid-3.1.12.3/configure.ac	2011-06-18 21:05:11.000000000 +1200
+++ squid-3.1.13/configure.ac	2011-07-01 14:50:53.000000000 +1200
@@ -2,7 +2,7 @@
 dnl
 dnl  $Id$
 dnl
-AC_INIT([Squid Web Proxy],[3.1.12.3],[http://www.squid-cache.org/bugs/],[squid])
+AC_INIT([Squid Web Proxy],[3.1.13],[http://www.squid-cache.org/bugs/],[squid])
 AC_PREREQ(2.61)
 AC_CONFIG_HEADERS([include/autoconf.h])
 AC_CONFIG_AUX_DIR(cfgaux)
diff -u -r -N squid-3.1.12.3/include/version.h squid-3.1.13/include/version.h
--- squid-3.1.12.3/include/version.h	2011-06-18 21:05:12.000000000 +1200
+++ squid-3.1.13/include/version.h	2011-07-01 14:50:54.000000000 +1200
@@ -9,7 +9,7 @@
  */
 
 #ifndef SQUID_RELEASE_TIME
-#define SQUID_RELEASE_TIME 1308387775
+#define SQUID_RELEASE_TIME 1309488494
 #endif
 
 #ifndef APP_SHORTNAME
diff -u -r -N squid-3.1.12.3/RELEASENOTES.html squid-3.1.13/RELEASENOTES.html
--- squid-3.1.12.3/RELEASENOTES.html	2011-06-18 21:33:15.000000000 +1200
+++ squid-3.1.13/RELEASENOTES.html	2011-07-01 15:35:59.000000000 +1200
@@ -2,10 +2,10 @@
 <HTML>
 <HEAD>
  <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.66">
- <TITLE>Squid 3.1.12.3 release notes</TITLE>
+ <TITLE>Squid 3.1.13 release notes</TITLE>
 </HEAD>
 <BODY>
-<H1>Squid 3.1.12.3 release notes</H1>
+<H1>Squid 3.1.13 release notes</H1>
 
 <H2>Squid Developers</H2>
 <HR>
@@ -71,7 +71,7 @@
 <HR>
 <H2><A NAME="s1">1.</A> <A HREF="#toc1">Notice</A></H2>
 
-<P>The Squid Team are pleased to announce the release of Squid-3.1.12.3</P>
+<P>The Squid Team are pleased to announce the release of Squid-3.1.13</P>
 <P>This new release is available for download from 
 <A HREF="http://www.squid-cache.org/Versions/v3/3.1/">http://www.squid-cache.org/Versions/v3/3.1/</A> or the 
 <A HREF="http://www.squid-cache.org/Mirrors/http-mirrors.html">mirrors</A>.</P>
@@ -99,6 +99,7 @@
 <UL>
 <LI>Windows support is still largely missing.</LI>
 <LI>AIX support for building with the IBM compiler is broken.</LI>
+<LI>OpenSSL 1.0.0 support is incomplete.</LI>
 </UL>
 </P>
 
@@ -1311,7 +1312,7 @@
         X-Forwarded-For header.
 
         If set to "truncate", Squid will remove all existing
-        X-Forwarded-For entries, and place itself as the sole entry.
+        X-Forwarded-For entries, and place the client IP as the sole entry.
         
 </PRE>
 </P>
@@ -1643,27 +1644,6 @@
 <P>A copy of the latest translated files can instead be downloaded from
 <A HREF="http://www.squid-cache.org/Versions/langpack/">http://www.squid-cache.org/Versions/langpack/</A></P>
 
-<DT><B>--with-dns-cname</B><DD>
-<P>Enable CNAME recursion within the Internal DNS resolver stub squid uses.
-This has no effect on the external DNS helper.</P>
-<P>Please note this extension is still experimental and may encounter problems.
-To see if it is actually needed you can run squid without it for a period and
-check the CNAME-Only Requests statistics squid maintains.</P>
-<P>If it produces ongoing serious problems the external helper may be needed
-but please report the bugs anyway.</P>
-
-<DT><B>--with-libexpat / --without-libexpat</B><DD>
-<P>Require libexpat XML parser to be built into Squid for ESI parsing.
-Build will fail if this option is used and the library is not present.
-Default is to auto-detect it when using ESI and ignore if not present.
-Use --without-libexpat to prevent it being auto-detected.</P>
-
-<DT><B>--with-libxml2 / --without-libxml2</B><DD>
-<P>Require libxml2 XML parser to be built into Squid for ESI parsing.
-Build will fail if this option is used and the library is not present.
-Default is to auto-detect it when building with ESI.
-Use --without-libxml2 to prevent it being auto-detected.</P>
-
 <DT><B>--with-logdir=PATH</B><DD>
 <P>Allow build-time configuration of Default location for Squid logs.</P>
 
diff -u -r -N squid-3.1.12.3/src/acl/Acl.cc squid-3.1.13/src/acl/Acl.cc
--- squid-3.1.12.3/src/acl/Acl.cc	2011-06-18 21:02:56.000000000 +1200
+++ squid-3.1.13/src/acl/Acl.cc	2011-07-01 14:48:17.000000000 +1200
@@ -128,17 +128,17 @@
     }
 
     // Is this ACL going to work?
-    if (strcmp(theType, "myip") != 0) {
+    if (strcmp(theType, "myip") == 0) {
         http_port_list *p = Config.Sockaddr.http;
-        while(p) {
+        while (p) {
             // Bug 3239: not reliable when there is interception traffic coming
             if (p->intercepted)
                 debugs(28, DBG_CRITICAL, "WARNING: 'myip' ACL is not reliable for interception proxies. Please use 'myportname' instead.");
             p = p->next;
         }
-    } else if(strcmp(theType, "myport") != 0) {
+    } else if (strcmp(theType, "myport") == 0) {
         http_port_list *p = Config.Sockaddr.http;
-        while(p) {
+        while (p) {
             // Bug 3239: not reliable when there is interception traffic coming
             // Bug 3239: myport - not reliable (yet) when there is interception traffic coming
             if (p->intercepted)
diff -u -r -N squid-3.1.12.3/src/adaptation/Initiate.cc squid-3.1.13/src/adaptation/Initiate.cc
--- squid-3.1.12.3/src/adaptation/Initiate.cc	2011-06-18 21:02:56.000000000 +1200
+++ squid-3.1.13/src/adaptation/Initiate.cc	2011-07-01 14:48:17.000000000 +1200
@@ -29,17 +29,21 @@
 
 /// Calls expectNoConsumption() if noteAdaptationAnswer async call is
 /// scheduled but never fired (e.g., because the HTTP transaction aborts).
-class AnswerCall: public AsyncCallT<AnswerDialer>{
+class AnswerCall: public AsyncCallT<AnswerDialer>
+{
+public:
     AnswerCall(const char *aName, const AnswerDialer &aDialer) :
-        AsyncCallT<AnswerDialer>(93, 5, aName, aDialer), fired(false) {}
+            AsyncCallT<AnswerDialer>(93, 5, aName, aDialer), fired(false) {}
     virtual void fire() {
-        fired = true; 
+        fired = true;
         AsyncCallT<AnswerDialer>::fire();
     }
     virtual ~AnswerCall() {
-        if (!fired && dialer.arg1.message != NULL && dialer.arg1.message->body_pipe != NULL)
-            dialer.arg1.message->body_pipe->expectNoConsumption();
+        if (!fired && dialer.arg1 != NULL && dialer.arg1->body_pipe != NULL)
+            dialer.arg1->body_pipe->expectNoConsumption();
     }
+
+private:
     bool fired; ///< whether we fired the call
 };
 
@@ -90,7 +94,7 @@
 {
     assert(msg);
     AsyncCall::Pointer call = new AnswerCall("Initiator::noteAdaptationAnswer",
-                                             AnswerDialer(theInitiator, &Initiator::noteAdaptationAnswer, answer));
+            AnswerDialer(theInitiator, &Initiator::noteAdaptationAnswer, msg));
     ScheduleCallHere(call);
     clearInitiator();
 }
diff -u -r -N squid-3.1.12.3/src/client_side.cc squid-3.1.13/src/client_side.cc
--- squid-3.1.12.3/src/client_side.cc	2011-06-18 21:02:56.000000000 +1200
+++ squid-3.1.13/src/client_side.cc	2011-07-01 14:48:17.000000000 +1200
@@ -3382,7 +3382,7 @@
         if (reply_message.parse(reply, strlen(reply)) != Ssl::CrtdMessage::OK) {
             debugs(33, 5, HERE << "Reply from ssl_crtd for " << sslHostName << " is incorrect");
         } else {
-            if (reply_message.getCode() != "ok") {
+            if (reply_message.getCode() != "OK") {
                 debugs(33, 5, HERE << "Certificate for " << sslHostName << " cannot be generated. ssl_crtd response: " << reply_message.getBody());
             } else {
                 debugs(33, 5, HERE << "Certificate for " << sslHostName << " was successfully recieved from ssl_crtd");
diff -u -r -N squid-3.1.12.3/src/ip/IpAddress.cc squid-3.1.13/src/ip/IpAddress.cc
--- squid-3.1.12.3/src/ip/IpAddress.cc	2011-06-18 21:02:56.000000000 +1200
+++ squid-3.1.13/src/ip/IpAddress.cc	2011-07-01 14:48:17.000000000 +1200
@@ -199,7 +199,7 @@
 
 bool IpAddress::IsAnyAddr() const
 {
-    return IN6_IS_ADDR_UNSPECIFIED( &m_SocketAddr.sin6_addr );
+    return IN6_IS_ADDR_UNSPECIFIED( &m_SocketAddr.sin6_addr ) || IN6_ARE_ADDR_EQUAL( &m_SocketAddr.sin6_addr, &v4_anyaddr);
 }
 
 /// NOTE: Does NOT clear the Port stored. Ony the Address and Type.
diff -u -r -N squid-3.1.12.3/src/ssl/ssl_crtd.cc squid-3.1.13/src/ssl/ssl_crtd.cc
--- squid-3.1.12.3/src/ssl/ssl_crtd.cc	2011-06-18 21:02:56.000000000 +1200
+++ squid-3.1.13/src/ssl/ssl_crtd.cc	2011-07-01 14:48:17.000000000 +1200
@@ -247,7 +247,7 @@
         throw std::runtime_error("Cannot write ssl certificate or/and private key to memory.");
 
     Ssl::CrtdMessage response_message;
-    response_message.setCode("ok");
+    response_message.setCode("OK");
     response_message.setBody(bufferToWrite);
 
     // Use the '\1' char as end-of-message character
