コード例 #1
0
        public URL AppendQueryParameter(string name, string value,
                                        bool escape = true)
        {
            if (_scheme == "file")
            {
                return(this);
            }

            if (escape == true)
            {
                name  = HTTPUtils.URLEncode(name);
                value = HTTPUtils.URLEncode(value);
            }

            if (string.IsNullOrEmpty(_query) == true)
            {
                _query = name + "=" + value;
            }
            else
            {
                _query += "&" + name + "=" + value;
            }

            return(this);
        }
コード例 #2
0
        public HTTPRequest AppendCookie(string name, string value,
                                        bool escape = true)
        {
            string cookie = (headers == null) ? null : headers["Cookie"];

            if (escape == true)
            {
                name  = HTTPUtils.URLEncode(name);
                value = HTTPUtils.URLEncode(value);
            }

            if (string.IsNullOrEmpty(cookie))
            {
                cookie = name + "=" + value;
            }
            else
            {
                cookie += "; " + name + "=" + value;
            }

            return(SetHeader("Cookie", cookie));
        }