예제 #1
0
 public static string httpGet(string url)
 {
     try
     {
         HttpWebRequest req = BomberUtils.MakeHttpGet(url, "");
         return(BomberUtils.GetHttpResponse(req));
     }
     catch (Exception ex) {
         Console.WriteLine(ex.ToString());
         return(null);
     }
 }
예제 #2
0
        public static void downloadPart(string url, long start, long end, Stream sout)
        {
            HttpWebRequest req = BomberUtils.MakeHttpGet(url);

            req.AddRange(start, end);
            HttpWebResponse resp = req.GetResponse() as HttpWebResponse;

            if (resp.StatusCode == HttpStatusCode.PartialContent || (resp.StatusCode == HttpStatusCode.OK && resp.ContentLength == end - start + 1))
            {
                copyStream(resp.GetResponseStream(), sout);
            }
            else
            {
                throw new Exception("Server not support slice");
            }
        }