Browse code

b/f: uac auth with \r\n headers

Stefan Sayer authored on 09/03/2011 10:58:31
Showing 1 changed files
... ...
@@ -146,7 +146,7 @@ bool UACAuth::onSipReply(const AmSipReply& reply, int old_dlg_status, const stri
146 146
 	  DBG("Authorization failed!\n");
147 147
 	} else {
148 148
 	  string auth_hdr = (reply.code==407) ? 
149
-      getHeader(reply.hdrs, SIP_HDR_PROXY_AUTHENTICATE, true) : 
149
+	    getHeader(reply.hdrs, SIP_HDR_PROXY_AUTHENTICATE, true) : 
150 150
 	    getHeader(reply.hdrs, SIP_HDR_WWW_AUTHENTICATE, true);
151 151
 	  string result; 
152 152
 			
... ...
@@ -156,11 +156,15 @@ bool UACAuth::onSipReply(const AmSipReply& reply, int old_dlg_status, const stri
156 156
 	  if (do_auth(reply.code, auth_hdr,  
157 157
 		      ri->second.method,
158 158
 		      auth_uri, result)) {
159
-	    string hdrs = ri->second.hdrs; 
160
-	    // TODO: strip headers 
159
+	    string hdrs = ri->second.hdrs;
160
+	    // TODO(?): strip headers 
161 161
 	    // ((code==401) ? stripHeader(ri->second.hdrs, "Authorization")  :
162 162
 	    //	 		    stripHeader(ri->second.hdrs, "Proxy-Authorization"));
163
-	    hdrs += result;
163
+
164
+	    if (hdrs == "\r\n" || hdrs == "\r" || hdrs == "\n")
165
+	      hdrs = result;
166
+	    else
167
+	      hdrs += result;
164 168
 
165 169
 	    if (dlg->getStatus() < AmSipDialog::Connected && 
166 170
 		ri->second.method != SIP_METH_BYE) {