Пример #1
0
        internal RequestInfo(Router router, TcpClient newClient, int port, Func <int, string> statusMessageFetcher,
                             string httpVersion)
        {
            GetStatusMessage = statusMessageFetcher;
            HttpVersion      = httpVersion;
            @Router          = router;
            BodyInternal     = new ReadOnlyNetworkStream(newClient.GetStream());

            Client = newClient;
            Stream = Client.GetStream();
            Reader = new StreamReader(Stream);
            Port   = port;

            HeadersInternal = new SmartDictionary <string, string>();

            Headers = new ReadOnlySmartDictionary <string, string>(HeadersInternal);

            FetchRequestLine();

            if (!FetchHeaders())
            {
                throw new Exception("Error during fetching of the headers.");
            }
        }
Пример #2
0
 /// <summary>
 ///     Constructs a new <see cref="ReadOnlySmartDictionary" />.
 /// </summary>
 /// <param name="dict">
 ///     A <see cref="SmartDictionary" /> to use as a base. Changes are reflected in this instance.
 /// </param>
 public ReadOnlySmartDictionary(SmartDictionary <TK, TV> dict)
 {
     this.Dict = dict.Dict;
 }