[svn-commits] russell: trunk r40131 - /trunk/http.c
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Wed Aug 16 21:26:29 MST 2006
Author: russell
Date: Wed Aug 16 23:26:28 2006
New Revision: 40131
URL: http://svn.digium.com/view/asterisk?rev=40131&view=rev
Log:
Fix cookie parsing for Internet Explorer (issue #7454, jeff)
Modified:
trunk/http.c
Modified: trunk/http.c
URL: http://svn.digium.com/view/asterisk/trunk/http.c?rev=40131&r1=40130&r2=40131&view=diff
==============================================================================
--- trunk/http.c (original)
+++ trunk/http.c Wed Aug 16 23:26:28 2006
@@ -394,23 +394,50 @@
if (ast_strlen_zero(cookie))
break;
if (!strncasecmp(cookie, "Cookie: ", 8)) {
- vname = cookie + 8;
- vval = strchr(vname, '=');
- if (vval) {
- /* Ditch the = and the quotes */
- *vval = '\0';
- vval++;
- if (*vval)
- vval++;
- if (strlen(vval))
- vval[strlen(vval) - 1] = '\0';
- var = ast_variable_new(vname, vval);
- if (var) {
- if (prev)
- prev->next = var;
- else
- vars = var;
- prev = var;
+
+ /* TODO - The cookie parsing code below seems to work
+ in IE6 and FireFox 1.5. However, it is not entirely
+ correct, and therefore may not work in all
+ circumstances.
+ For more details see RFC 2109 and RFC 2965 */
+
+ /* FireFox cookie strings look like:
+ Cookie: mansession_id="********"
+ InternetExplorer's look like:
+ Cookie: $Version="1"; mansession_id="********" */
+
+ /* If we got a FireFox cookie string, the name's right
+ after "Cookie: " */
+ vname = cookie + 8;
+
+ /* If we got an IE cookie string, we need to skip to
+ past the version to get to the name */
+ if (*vname == '$') {
+ vname = strchr(vname, ';');
+ if (vname) {
+ vname++;
+ if (*vname == ' ')
+ vname++;
+ }
+ }
+
+ if (vname) {
+ vval = strchr(vname, '=');
+ if (vval) {
+ /* Ditch the = and the quotes */
+ *vval++ = '\0';
+ if (*vval)
+ vval++;
+ if (strlen(vval))
+ vval[strlen(vval) - 1] = '\0';
+ var = ast_variable_new(vname, vval);
+ if (var) {
+ if (prev)
+ prev->next = var;
+ else
+ vars = var;
+ prev = var;
+ }
}
}
}
More information about the svn-commits
mailing list