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); } }
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"); } }