public UploadRequest(string requestUri, string username, string password)
 {
     BaseUri         = requestUri;
     AuthString      = HttpUtil.BasicAuthHeader(username, password);
     Files           = new List <string>();
     KeyValues       = new Dictionary <string, string>();
     HeaderKeyValues = new Dictionary <string, string>();
     Enc             = Encoding.UTF8;
 }
Beispiel #2
0
        private BackgroundDownloader ToDownloader(MusicItem track)
        {
            var    downloader = new BackgroundDownloader();
            var    cloud      = track.CloudServer;
            var    user       = track.Username;
            var    pass       = track.Password;
            string authHeader = cloud == null?HttpUtil.BasicAuthHeader(user, pass) : HttpUtil.Basic + " " + HttpUtil.Base64ColonSeparated(cloud, user, pass);

            downloader.SetRequestHeader(HttpUtil.Authorization, authHeader);
            return(downloader);
        }
Beispiel #3
0
        public async Task TestWebSockets()
        {
            var webSocket = new MessageWebSocket();

            webSocket.Control.MessageType = SocketMessageType.Utf8;
            webSocket.MessageReceived    += webSocket_MessageReceived;
            webSocket.SetRequestHeader(HttpUtil.Authorization, HttpUtil.BasicAuthHeader("admin", "test"));
            var uri = new Uri("ws://*****:*****@"{""cmd"":""status""}");
            await writer.StoreAsync();
        }
Beispiel #4
0
        private async Task TestWebSockets()
        {
            var authHeader   = new KeyValuePair <string, string>(HttpUtil.Authorization, HttpUtil.BasicAuthHeader("d30f4e3c-818f-4513-934f-9bc828b42221", "beam"));
            var formatHeader = new KeyValuePair <string, string>(HttpUtil.Accept, HttpUtil.Json);
            var headers      = new List <KeyValuePair <string, string> >()
            {
                authHeader, formatHeader
            };

            webSocket                  = new WebSocket4Net.WebSocket("ws://desktop:9001/ws/control", customHeaderItems: headers);
            webSocket.Opened          += webSocket_Opened;
            webSocket.MessageReceived += webSocket_MessageReceived;
            await SetOutput("Opening...");

            webSocket.Open();
        }