示例#1
0
        protected static Http2Stream SubmitRequest(Http2Session session, Uri uri)
        {
            const string method  = "get";
            string       path    = uri.PathAndQuery;
            string       version = Protocols.Http2;
            string       scheme  = uri.Scheme;
            string       host    = uri.Host;

            var pairs = new HeadersList
            {
                new KeyValuePair <string, string>(":method", method),
                new KeyValuePair <string, string>(":path", path),
                new KeyValuePair <string, string>(":version", version),
                new KeyValuePair <string, string>(":host", host),
                new KeyValuePair <string, string>(":scheme", scheme),
            };

            session.SendRequest(pairs, Priority.None, false);

            return(session.ActiveStreams[1]);
        }
示例#2
0
        //localPath should be provided only for post and put cmds
        //serverPostAct should be provided only for post cmd
        private void SubmitRequest(Uri request, string method, string localPath = null, string serverPostAct = null)
        {
            var headers = new HeadersList
            {
                new KeyValuePair <string, string>(":method", method),
                new KeyValuePair <string, string>(":path", request.PathAndQuery),
                new KeyValuePair <string, string>(":version", _version),
                new KeyValuePair <string, string>(":host", _host),
                new KeyValuePair <string, string>(":scheme", _scheme),
            };

            if (!String.IsNullOrEmpty(localPath))
            {
                headers.Add(new KeyValuePair <string, string>(":localPath".ToLower(), localPath));
            }

            if (!String.IsNullOrEmpty(serverPostAct))
            {
                headers.Add(new KeyValuePair <string, string>(":serverPostAct".ToLower(), serverPostAct));
            }

            //Sending request with average priority
            _clientSession.SendRequest(headers, Priority.None, false);
        }