public override void handlePOSTRequest(HttpProcessor p, StreamReader inputData)
 {
     p.writeSuccess();
 }
        public override void handleGETRequest(HttpProcessor p)
        {
            p.writeSuccess();
            if (p.http_url == "/favicon.ico")
                return;

            Thread t = null;
            if(type == AuthType.AUTHORIZATION)
            {
                String url = p.http_url;
                url = url.Substring(2, url.Length - 2);
                NameValueCollection col = HttpUtility.ParseQueryString(url);
                if (col.Keys.Get(0) != "code")
                {
                    p.outputStream.WriteLine("<html><body><h1>Spotify Auth canceled!</h1></body></html>");
                    t = new Thread(new ParameterizedThreadStart((o) => { funcOne(null, col.Get(1), col.Get(0)); }));
                }
                else
                {
                    p.outputStream.WriteLine("<html><body><h1>Spotify Auth successful!</h1></body></html>");
                    t = new Thread(new ParameterizedThreadStart((o) => { funcOne(col.Get(0), col.Get(1), null); }));
                }
            }
            else
            {
                if(p.http_url == "/")
                {
                    p.outputStream.WriteLine("<html><body>" +
                    "<script>" +
                    "" +
                    "var hashes = window.location.hash;" +
                    "hashes = hashes.replace('#','&');" +
                    "window.location = hashes" +
                    "</script>" +
                    "<h1>Spotify Auth successful!<br>Please copy the URL and paste it into the application</h1></body></html>");
                    return;
                }
                String url = p.http_url;
                url = url.Substring(2, url.Length - 2);
                NameValueCollection col = HttpUtility.ParseQueryString(url);
                if (col.Keys.Get(0) != "access_token")
                {
                    p.outputStream.WriteLine("<html><body><h1>Spotify Auth canceled!</h1></body></html>");
                    t = new Thread(new ParameterizedThreadStart((o) => { funcTwo(null, null,0,col.Get(1),col.Get(0)); }));
                }
                else
                {
                    p.outputStream.WriteLine("<html><body><h1>Spotify Auth successful!</h1></body></html>");
                    t = new Thread(new ParameterizedThreadStart((o) => { funcTwo(col.Get(0), col.Get(1), Convert.ToInt32(col.Get(2)),col.Get(3),null); }));
                }
            }
            t.Start();
        }
 public abstract void handlePOSTRequest(HttpProcessor p, StreamReader inputData);
        public void listen()
        {
            try
            {
                listener = new TcpListener(port);
                listener.Start();
                while (IsActive)
                {
                    TcpClient s = listener.AcceptTcpClient();
                    HttpProcessor processor = new HttpProcessor(s, this);
                    Thread thread = new Thread(new ThreadStart(processor.process));
                    thread.Start();
                    Thread.Sleep(1);
                }
            }catch(Exception)
            {

            }
        }
 public abstract void handleGETRequest(HttpProcessor p);