
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
http-browserify-xdr
Advanced tools
The http module from browserify, but for browsers that can only do cross-origin requests with XDomainRequest (IE8 & IE9).
The out-of-the-box [http-browserify] does not work for cross-origin requests with XDomainRequest, and an open issue has gone unresponded to for almost 3 years.
Use this in your browserify project by adding the following to your package.json:
"browser": {
"http": "http-browserify-xdr"
}
Note: XDomainRequests cannot send cookies, so 'withCredentials' options will be ignored. The way to do cross-origin requests withCredentials in these browsers is, well, you can't. You have to open an iframe serving a src on the origin you want to request, then postMessage into it, have it make the request, then postMessage the response out. See sockjs-client for a referenc eimplementation of that.
The following is the original http-browserify README because the API is the same.
var http = require('http');
http.get({ host: 'anotherorigin.com', path : '/beep' }, function (res) {
var div = document.getElementById('result');
div.innerHTML += 'GET /beep<br>';
res.on('data', function (buf) {
div.innerHTML += buf;
});
res.on('end', function () {
div.innerHTML += '<br>__END__';
});
});
var http = require('http');
where opts are:
opts.method='GET' - http method verbopts.path - path string, example: '/foo/bar?baz=555'opts.headers={} - as an object mapping key names to string or Array valuesopts.host=window.location.host - http hostopts.port=window.location.port - http portopts.responseType - response type to set on the underlying xhr objectThe callback will be called with the response object.
A shortcut for
options.method = 'GET';
var req = http.request(options, cb);
req.end();
Set an http header.
Get an http header.
Remove an http header.
Write some data to the request body.
Close and send the request body, optionally with additional data to append.
Return an http header, if set. key is case-insensitive.
This module has been tested and works with:
Multipart streaming responses are buffered in all versions of Internet Explorer
and are somewhat buffered in Opera. In all the other browsers you get a nice
unbuffered stream of "data" events when you send down a content-type of
multipart/octet-stream or similar.
You can do:
var bundle = browserify({
require : { http : 'http-browserify-xdr' }
});
in order to map "http-browserify-xdr" over require('http') in your browserified
source.
With npm do:
npm install http-browserify-xdr
MIT
FAQs
http module compatability for browserify
The npm package http-browserify-xdr receives a total of 4 weekly downloads. As such, http-browserify-xdr popularity was classified as not popular.
We found that http-browserify-xdr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.