Sergey,

The issue with IE11 (maybe other earlier versions of IE too) is that IE 
builds the Authentication header differently. Chrome/FF put a space in 
between each name/value pair and IE doesn't. I tweaked the parse_headerfunction 
to account for this and IE 11 now works.

IE header sample:

"Digest 
username=\"admin\",realm=\"xetawave\",nonce=\"1390849663\",uri=\"/protected/cgi-bin/helloDate.cgi\",cnonce=\"e02ae08fdffcc05ba8169b3d9feee890\",nc=00000001,response=\"bc3fbe334b57b9b77a74bdee7fc490f6\",qop"...


Chrome header sample:

"Digest username=\"admin\", realm=\"xetawave\", nonce=\"1390835128\", 
uri=\"/protected/cgi-bin/helloDate.cgi\", 
response=\"c6ade1754b8868b646a6d51ec82eebe4\", qop=auth, nc=00000015, 
cnonce=\"5faf32dd1f395363\""


Modified parse_header function (my changes highlighted in yellow, it 
assumes that a comma will never be a character in a value, so this might be 
a problem):

int parse_header(const char *str, int str_len, const char *var_name, char 
*buf,
                 size_t buf_size) {
  int ch = ' ', len = 0, n = strlen(var_name);
  const char *p, *end = str + str_len, *s = NULL;

  if (buf != NULL && buf_size > 0) buf[0] = '\0';

  // Find where variable starts
  for (s = str; s != NULL && s + n < end; s++) {
    if ((s == str || s[-1] == ' ' || s[-1] == ',') && s[n] == '=' &&
        !memcmp(s, var_name, n)) break;
  }

  if (s != NULL && &s[n + 1] < end) {
    s += n + 1;
    if (*s == '"' || *s == '\'') ch = *s++;
    p = s;
    while (p < end && p[0] != ch && p[0] != ',' && len < (int) buf_size) {
      if (p[0] == '\\' && p[1] == ch) p++;
      buf[len++] = *p++;
    }
    if (len >= (int) buf_size || (ch != ' ' && *p != ch)) {
      len = 0;
    } else {
      if (len > 0 && s[len - 1] == ',') len--;
      if (len > 0 && s[len - 1] == ';') len--;
      buf[len] = '\0';
    }
  }

  return len;
}


Thanks,
Ben


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

Reply via email to