blob: e8ea3689499fdf04b248bcb4d493f000bbc114c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.IO;
namespace DotNetOpenId {
/// <summary>
/// Conversion to and from the HTTP Encoding defined by
/// OpenID Authentication 2.0 section 4.1.2.
/// http://openid.net/specs/openid-authentication-2_0.html#anchor4
/// </summary>
internal class HttpEncoding : IProtocolMessageEncoding {
public byte[] GetBytes(IDictionary<string, string> dictionary) {
return Encoding.ASCII.GetBytes(UriUtil.CreateQueryString(dictionary));
}
public IDictionary<string, string> GetDictionary(Stream data) {
using (StreamReader sr = new StreamReader(data, Encoding.ASCII))
return Util.NameValueCollectionToDictionary(
HttpUtility.ParseQueryString(sr.ReadToEnd()));
}
}
}
|