Associate a custom user agent to a specific Google Chrome page/tab

The webRequest API can be used to modify the User Agent header. Note: The Network tab at the Developer tools show the old headers. I’ve verified that the headers are set correctly, using netcat (nc -l 127.0.0.1 -p 6789). In the example below, the code activates on all tabs. Adjust the request filter to meet … Read more

Request Web Page in c# spoofing the Host

Although this is a very late answer, maybe someone can get benefit of it HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(“http://192.168.1.1”)); request.Headers.GetType().InvokeMember(“ChangeInternal”, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, request.Headers, new object[] {“Host”,”www.mysite.com”}); Reflection is your friend 🙂

Can I serve MP3 files with PHP?

Your Content-Disposition should be: header(‘Content-Disposition: attachment; filename=”sometrack.mp3″‘); Not sure if that’s the problem though. I would also recommend using readfile to output the file: readfile($rSong); Also, it can’t hurt to use an exhaustive Content-Type header, and set the Content-Transfer-Encoding: header(“Content-Transfer-Encoding: binary”); header(“Content-Type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3”);

How to make an HTTP GET with modified headers?

Created a solution that worked for me (worked very well) – this example getting a range offset: require ‘uri’ require ‘net/http’ size = 1000 #the last offset (for the range header) uri = URI(“http://localhost:80/index.html”) http = Net::HTTP.new(uri.host, uri.port) headers = { ‘Range’ => “bytes=#{size}-” } path = uri.path.empty? ? “https://stackoverflow.com/” : uri.path #test to ensure … Read more

Byte Ranges in Django [closed]

The are two relevant feature requests (one is open, another is a duplicate of the first): Ticket #22479 – Support byte range requests in django.views.static.serve Ticket #23382 – Support byte range requests in django.views.static.serve Both of the issues are based on the Google Group discussion. The ticket is in a “hanging” state due to architectural … Read more

Ajax – Get size of file before downloading

You can get XHR response header data manually: http://www.w3.org/TR/XMLHttpRequest/#the-getresponseheader()-method This function will get the filesize of the requested URL: function get_filesize(url, callback) { var xhr = new XMLHttpRequest(); xhr.open(“HEAD”, url, true); // Notice “HEAD” instead of “GET”, // to get only the header xhr.onreadystatechange = function() { if (this.readyState == this.DONE) { callback(parseInt(xhr.getResponseHeader(“Content-Length”))); } }; … Read more