Esempio n. 1
0
        public static HttpWebRequest CreateRequest(OAuthTicket ticket, string URL)
        {
            var req = (HttpWebRequest)HttpWebRequest.Create(URL);

            if (Config.WebProxyHost != null)
            {
                req.Proxy = new WebProxy(Config.WebProxyHost, Config.WebProxyPort);
            }
            else
            {
                req.Proxy = null;
            }

            req.UserAgent = Config.CloudPrintUserAgent;
            req.Headers.Add("X-CloudPrint-Proxy", Config.CloudPrintProxyName);

            if (ticket != null)
            {
                req.Headers.Add("Authorization", ticket.TokenType + " " + ticket.AccessToken);
            }

            return(req);
        }
Esempio n. 2
0
 public static dynamic PostCloudPrintUrlEncodedRequest(OAuthTicket ticket, string iface, dynamic postdata)
 {
     return(HTTPHelper.ToJson(HTTPHelper.SendUrlEncodedPostData(CreateCloudPrintRequest(ticket, iface), postdata)));
 }
Esempio n. 3
0
 public static HttpWebRequest CreateCloudPrintRequest(OAuthTicket ticket, string iface)
 {
     return(CreateRequest(ticket, Config.CloudPrintBaseURL + "/" + iface));
 }