Subject: RE: [Simple] MSRP Comments

From: Adam Roach <[email-masked]>
Date: Mon, 10 Nov 2003 13:46:07 -0600

Cullen Jennings writes:

> I'm very suspicious that the look ahead scheme to switch to
> TLS is going to be very hard to integrate with existing
> libraries

Like OpenSSL?

int Msrp::read(char *buffer, int maxLen)
{
  int len;
  int magic;

  if (!usingSsl)
  {
    len = recv(s, &magic, 4, MSG_PEEK);

    if ((htonl(magic) >> 8) == 0x160301)
    {
      SSL_set_fd(ssl, s);
      usingSsl = true;
    }
    else
    {
      len = read(s, buffer, maxLen);
    }
  }

  if (usingSsl)
  {
    len = SSL_read(ssl, buffer, maxLen);
  }

  return len;
}

(modulo error checking)

/a

_______________________________________________
Simple mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/simple

---

From: Cullen Jennings <[email-masked]>
Date: Thu, 13 Nov 2003 15:12:08 -0800

How do you do this on an OS that only supports a single byte peek? I imagine
there is a way to push the bytes into the SSL buffer but not sure how.

I do love when you send code, it always makes my day, but my question was
not could you do this but why would you not do it the other way.

Cullen

---

From: Cullen Jennings <[email-masked]>
Date: Thu, 13 Nov 2003 15:12:08 -0800

Cullen