Revision: 2835ada2a94b
Author:   Jean Deruelle <[email protected]>
Date:     Tue Nov  5 23:53:45 2013 UTC
Log:      Update Issue 239

(cherry picked from telscale commit 193ef1245d7ac440e310c0933066f4244baa85c0)

http://code.google.com/p/sipservlets/source/detail?r=2835ada2a94b

Modified:
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/JainSipUtils.java /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletMessageImpl.java /sip-servlets-test-suite/applications/shootist-sip-servlet-auth/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServletAuth.java

=======================================
--- /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/JainSipUtils.java Thu May 2 13:21:45 2013 UTC +++ /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/JainSipUtils.java Tue Nov 5 23:53:45 2013 UTC
@@ -1,23 +1,20 @@
 /*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * TeleStax, Open Source Cloud Communications
+ * Copyright 2011-2013, Telestax Inc and individual contributors
+ * by the @authors tag.
  *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
+ * This program is free software: you can redistribute it and/or modify
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation; either version 3 of
  * the License, or (at your option) any later version.
  *
- * This software is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
  */

 package org.mobicents.servlet.sip;
@@ -258,7 +255,11 @@
                PARAMETERABLE_HEADER_NAMES.add(ErrorInfoHeader.NAME);
                PARAMETERABLE_HEADER_NAMES.add(RetryAfterHeader.NAME);
                PARAMETERABLE_HEADER_NAMES.add(ViaHeader.NAME);
-
+               // https://code.google.com/p/sipservlets/issues/detail?id=239
+               PARAMETERABLE_HEADER_NAMES.add(WWWAuthenticateHeader.NAME);
+               PARAMETERABLE_HEADER_NAMES.add(ProxyAuthenticateHeader.NAME);
+               PARAMETERABLE_HEADER_NAMES.add(AuthorizationHeader.NAME);
+        PARAMETERABLE_HEADER_NAMES.add(ProxyAuthorizationHeader.NAME);
        }


=======================================
--- /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletMessageImpl.java Sun Dec 9 12:25:23 2012 UTC +++ /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletMessageImpl.java Tue Nov 5 23:53:45 2013 UTC
@@ -1,24 +1,22 @@
 /*
- * TeleStax, Open Source Cloud Communications  Copyright 2012.
- * and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * TeleStax, Open Source Cloud Communications
+ * Copyright 2011-2013, Telestax Inc and individual contributors
+ * by the @authors tag.
  *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
+ * This program is free software: you can redistribute it and/or modify
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation; either version 3 of
  * the License, or (at your option) any later version.
  *
- * This software is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
  */
+
 package org.mobicents.servlet.sip.message;

 import gov.nist.javax.sip.header.HeaderExt;
@@ -106,6 +104,7 @@
  * Implementation of SipServletMessage
  *
  * @author mranga
+ * @author [email protected]
  *
  */
public abstract class SipServletMessageImpl implements MobicentsSipServletMessage, Externalizable {
@@ -1828,7 +1827,32 @@
                                        // from Alexander Kozlov from 
Codeminders
                                        paramMap.put(vals[0], vals.length == 2 ? vals[1] 
: "");
                                }
-                       }
+                       } else if (value.length() > 1 && value.contains(",")) {
+ // Deals with https://code.google.com/p/sipservlets/issues/detail?id=239
+                // repleace first ";" with ""
+// String parameters = value.substring(value.indexOf(",") + 1);
+//                value = value.substring(0, value.indexOf(","));
+                String[] split = value.split(",");
+
+                for (String pair : split) {
+                    String[] vals = pair.split("=");
+                    if (vals.length > 2) {
+                        logger
+ .error("Wrong parameter format, expected value and name, got ["
+                                        + pair + "]");
+                        throw new ServletParseException(
+ "Wrong parameter format, expected value or name["
+                                        + pair + "]");
+                    }
+                    String paramValue = vals[1];
+                    if(vals.length < 2) {
+                        paramValue ="";
+ } else if(vals.length == 2 && vals[1].indexOf('\"') == 0 && vals[1].lastIndexOf('\"') == vals[1].length()-1) { + paramValue = vals[1].substring(1, vals[1].length()-1);
+                    }
+                    paramMap.put(vals[0], paramValue);
+                }
+            }
                }

                // quotes are parts of the value as well as the display Name
=======================================
--- /sip-servlets-test-suite/applications/shootist-sip-servlet-auth/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServletAuth.java Fri Jul 22 18:20:11 2011 UTC +++ /sip-servlets-test-suite/applications/shootist-sip-servlet-auth/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServletAuth.java Tue Nov 5 23:53:45 2013 UTC
@@ -1,23 +1,20 @@
 /*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * TeleStax, Open Source Cloud Communications
+ * Copyright 2011-2013, Telestax Inc and individual contributors
+ * by the @authors tag.
  *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
+ * This program is free software: you can redistribute it and/or modify
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation; either version 3 of
  * the License, or (at your option) any later version.
  *
- * This software is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
  */

 package org.mobicents.servlet.sip.testsuite;
@@ -27,6 +24,7 @@
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.sip.AuthInfo;
+import javax.servlet.sip.Parameterable;
 import javax.servlet.sip.ServletParseException;
 import javax.servlet.sip.SipApplicationSession;
 import javax.servlet.sip.SipFactory;
@@ -40,6 +38,7 @@
 import javax.servlet.sip.SipSessionListener;
 import javax.servlet.sip.SipURI;
 import javax.sip.ListeningPoint;
+import javax.sip.header.ProxyAuthenticateHeader;

 import org.apache.log4j.Logger;
 import org.mobicents.javax.servlet.sip.SipServletRequestExt;
@@ -75,8 +74,11 @@
                                String fromString = 
response.getFrom().getURI().toString();

                                getServletContext().setAttribute("FirstResponseRecieved", 
"true");
+ // non regression test for https://code.google.com/p/sipservlets/issues/detail?id=239 + Parameterable proxyAuthHeader = response.getParameterableHeader(ProxyAuthenticateHeader.NAME);
                                AuthInfo authInfo = sipFactory.createAuthInfo();
- authInfo.addAuthInfo(response.getStatus(), "sip-servlets-realm", "user", "pass");
+                               String realm = proxyAuthHeader.getParameter("Digest 
realm");
+                               authInfo.addAuthInfo(response.getStatus(), realm, "user", 
"pass");
SipServletRequest challengeRequest = response.getSession().createRequest(
                                                
response.getRequest().getMethod());
                                boolean cacheCredentials = false;

--

--- You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to