protected override void ModifyRequest(HttpRequestItem req)
 {
     req.AddQueryValue("tuin", _friend.Uin);
     req.AddQueryValue("vfwebqq", Session.Vfwebqq);
     req.AddQueryValue("t", Timestamp);
     req.Referrer = ApiUrls.ReferrerS;
 }
예제 #2
0
 public override HttpRequestItem BuildRequest()
 {
     var req = new HttpRequestItem(HttpMethodType.Get, ApiUrls.CheckQRCode);
     req.AddQueryValue("webqq_type", "10");
     req.AddQueryValue("remember_uin", "1");
     req.AddQueryValue("login2qq", "1");
     req.AddQueryValue("aid", "501004106");
     req.AddQueryValue("u1", "http://w.qq.com/proxy.html?login2qq=1&webqq_type=10");
     req.AddQueryValue("ptredirect", "0");
     req.AddQueryValue("ptlang", "2052");
     req.AddQueryValue("daid", "164");
     req.AddQueryValue("from_ui", "1");
     req.AddQueryValue("pttype", "1");
     req.AddQueryValue("dumy", "");
     req.AddQueryValue("fp", "loginerroralert");
     req.AddQueryValue("action", "0-0-205298");
     req.AddQueryValue("mibao_css", "m_webqq");
     req.AddQueryValue("t", "1");
     req.AddQueryValue("g", "1");
     req.AddQueryValue("js_type", "0");
     req.AddQueryValue("js_ver", JsVer);
     req.AddQueryValue("login_sig", "");
     req.AddQueryValue("pt_randsalt", "0");
     return req;
 }
예제 #3
0
 public override HttpRequestItem BuildRequest()
 {
     var req =  new HttpRequestItem(HttpMethodType.Post, string.Format(ApiUrls.GetQRCode, Session.Uuid));
     req.AddQueryValue("t", "webwx");
     req.AddQueryValue("_", Session.Seq++);
     req.ResultType = HttpResultType.Stream;
     return req;
 }
예제 #4
0
 public override HttpRequestItem BuildRequest()
 {
     var req = new HttpRequestItem(HttpMethodType.Post, ApiUrls.GetUuid);
     req.AddQueryValue("appid", ApiUrls.Appid);
     req.AddQueryValue("fun", "new");
     req.AddQueryValue("lang", "zh_CN");
     req.AddQueryValue("_", Session.Seq++);
     return req;
 }
예제 #5
0
 public override HttpRequestItem BuildRequest()
 {
     var req = new HttpRequestItem(HttpMethodType.Post, ApiUrls.CheckQRCode);
     req.AddQueryValue("loginicon", "true");
     req.AddQueryValue("tip", _tip);
     req.AddQueryValue("uuid", Session.Uuid);
     req.AddQueryValue("r", ~Timestamp);
     req.AddQueryValue("_", Session.Seq++);
     return req;
 }
예제 #6
0
 public override HttpRequestItem BuildRequest()
 {
     var url = string.Format(ApiUrls.GetContact, Session.BaseUrl, Session.PassTicket, Session.Skey, Timestamp);
     var obj = new { Session.BaseRequest };
     var req = new HttpRequestItem(HttpMethodType.Post, url)
     {
         RawData = obj.ToJson(),
         ContentType = HttpConstants.JsonContentType
     };
     return req;
 }
예제 #7
0
 public override HttpRequestItem BuildRequest()
 {
     var req = new HttpRequestItem(HttpMethodType.Get, ApiUrls.GetQRCode);
     req.AddQueryValue("appid", AppId);
     req.AddQueryValue("e", "0");
     req.AddQueryValue("l", "M");
     req.AddQueryValue("s", "5");
     req.AddQueryValue("d", "72");
     req.AddQueryValue("v", "4");
     req.AddQueryValue("t", new Random().NextDouble());
     req.ResultType = HttpResultType.Stream;
     return req;
 }
예제 #8
0
 protected override void ModifyRequest(HttpRequestItem req)
 {
     req.Method = HttpMethodType.Post;
     var json = new JObject
     {
         {"clientid", Session.ClientId},
         {"psessionid", Session.SessionId},
         {"key", ""},
         {"ptwebqq", Session.Ptwebqq}
     };
     req.AddQueryValue("r", json.ToSimpleString());
     req.Referrer = "https://d1.web2.qq.com/cfproxy.html?v=20151105001&callback=1";
 }
예제 #9
0
 protected override void ModifyRequest(HttpRequestItem req)
 {
     req.Method = HttpMethodType.Post;
     var json = new JObject
     {
         {"status", QQStatusType.Online.ToLowerString()},
         {"ptwebqq", Session.Ptwebqq},
         {"clientid", Session.ClientId},
         {"psessionid", ""}
     };
     req.AddQueryValue("r", json.ToSimpleString());
     req.Referrer = ApiUrls.Referrer;
 }
예제 #10
0
 public override HttpRequestItem BuildRequest()
 {
     var url = string.Format(ApiUrls.SendMsg, Session.BaseUrl);
     var obj = new
     {
         Session.BaseRequest,
         Msg = _msg
     };
     var req = new HttpRequestItem(HttpMethodType.Post, url)
     {
         RawData = obj.ToJson(),
         ContentType = HttpConstants.JsonContentType
     };
     return req;
 }
예제 #11
0
 public override HttpRequestItem BuildRequest()
 {
     var url = string.Format(ApiUrls.BatchGetContact, Session.BaseUrl, Session.PassTicket, Timestamp);
     var obj = new
     {
         Session.BaseRequest,
         Count = Store.GroupCount,
         List = Store.Groups.Select(m => new { m.UserName, EncryChatRoomId = "" })
     };
     var req = new HttpRequestItem(HttpMethodType.Post, url)
     {
         ContentType = HttpConstants.JsonContentType,
         RawData = JsonConvert.SerializeObject(obj)
     };
     return req;
 }
예제 #12
0
 public override HttpRequestItem BuildRequest()
 {
     var url = string.Format(ApiUrls.WebwxSync, Session.BaseUrl, Session.Sid, Session.Skey, Session.PassTicket);
     // var url = string.Format(ApiUrls.WebwxSync, Session.BaseUrl);
     var obj = new
     {
         Session.BaseRequest,
         Session.SyncKey,
         rr = ~Timestamp // 注意是按位取反
     };
     var req = new HttpRequestItem(HttpMethodType.Post, url)
     {
         RawData = obj.ToJson(),
         ContentType = HttpConstants.JsonContentType,
         Referrer = "https://wx.qq.com/?&lang=zh_CN"
     };
     return req;
 }
예제 #13
0
 public override HttpRequestItem BuildRequest()
 {
     var url = string.Format(ApiUrls.StatusNotify, Session.BaseUrl, Session.PassTicket);
     var obj = new
     {
         Session.BaseRequest,
         Code = 3,
         FromUserName = Session.UserToken["UserName"],
         ToUserName = Session.UserToken["UserName"],
         ClientMsgId = Timestamp
     };
     var req = new HttpRequestItem(HttpMethodType.Post, url)
     {
         RawData = JsonConvert.SerializeObject(obj),
         ContentType = HttpConstants.JsonContentType,
     };
     return req;
 }
예제 #14
0
 public override HttpRequestItem BuildRequest()
 {
     var url = string.Format(ApiUrls.WebwxInit, Session.BaseUrl, Session.PassTicket, Session.Skey, Timestamp);
     var req = new HttpRequestItem(HttpMethodType.Post, url);
     var obj = new { Session.BaseRequest };
     /*
         {
             "BaseRequest": {
                 "DeviceId": "e650946746417762",
                 "Skey": "@crypt_c498484a_1d7a344b3232380eb1aa33c16690399a",
                 "Sid": "PhHAnhCRcFDCA219",
                 "Uin": "463678295"
             }
         }
     */
     req.RawData = JsonConvert.SerializeObject(obj);
     req.ContentType = HttpConstants.JsonContentType;
     return req;
 }
예제 #15
0
        private static HttpRequestMessage GetHttpRequest(HttpRequestItem item)
        {
            var request = new HttpRequestMessage(new HttpMethod(item.Method.ToString().ToUpper()), item.GetUrl());
            switch (item.Method)
            {
                case HttpMethodType.Post:
                case HttpMethodType.Put:
                case HttpMethodType.Delete:
                case HttpMethodType.Head:
                case HttpMethodType.Options:
                case HttpMethodType.Trace:
                    request.Content = new StringContent(item.RawData, item.EncodingType, item.ContentType);
                    break;

                case HttpMethodType.Get:
                default:
                    break;
            }
            foreach (var header in item.HeaderMap.Where(h => !NotAddHeaderNames.Contains(h.Key)))
            {
                request.Headers.Add(header.Key, header.Value);
            }
            return request;
        }
예제 #16
0
        public virtual async Task<HttpResponseItem> ExecuteHttpRequestAsync(HttpRequestItem requestItem, CancellationToken token)
        {
            token.ThrowIfCancellationRequested();

            var responseItem = new HttpResponseItem { RequestItem = requestItem };
            var httpRequest = GetHttpRequest(requestItem);
            using (var response = await _httpClient.SendAsync(httpRequest, HttpCompletionOption.ResponseHeadersRead, token).ConfigureAwait(false))
            {
                response.EnsureSuccessStatusCode();
                responseItem.StatusCode = response.StatusCode;
                ReadHeader(response, responseItem);
                await ReadContentAsync(response, responseItem).ConfigureAwait(false);
                return responseItem;
            }
        }
예제 #17
0
 protected virtual void ModifyRequest(HttpRequestItem req)
 {
 }