pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/browserify/http-browserify/pull/37/files

="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-0eb15370f045c7e0.css" /> Use 'global' instead of window. Fixes #36 by kumavis · Pull Request #37 · browserify/http-browserify · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ http.request = function (params, cb) {
}
if (!params) params = {};
if (!params.host && !params.port) {
params.port = parseInt(window.location.port, 10);
params.port = parseInt(global.location.port, 10);
}
if (!params.host && params.hostname) {
params.host = params.hostname;
}

if (!params.scheme) params.scheme = window.location.protocol.split(':')[0];
if (!params.scheme) params.scheme = global.location.protocol.split(':')[0];
if (!params.host) {
params.host = window.location.hostname || window.location.host;
params.host = global.location.hostname || global.location.host;
}
if (/:/.test(params.host)) {
if (!params.port) {
Expand All @@ -43,29 +43,29 @@ http.Agent = function () {};
http.Agent.defaultMaxSockets = 4;

var xhrHttp = (function () {
if (typeof window === 'undefined') {
throw new Error('no window object present');
if (typeof global === 'undefined') {
throw new Error('no global object present');
}
else if (window.XMLHttpRequest) {
return window.XMLHttpRequest;
else if (global.XMLHttpRequest) {
return global.XMLHttpRequest;
}
else if (window.ActiveXObject) {
else if (global.ActiveXObject) {
var axs = [
'Msxml2.XMLHTTP.6.0',
'Msxml2.XMLHTTP.3.0',
'Microsoft.XMLHTTP'
];
for (var i = 0; i < axs.length; i++) {
try {
var ax = new(window.ActiveXObject)(axs[i]);
var ax = new(global.ActiveXObject)(axs[i]);
return function () {
if (ax) {
var ax_ = ax;
ax = null;
return ax_;
}
else {
return new(window.ActiveXObject)(axs[i]);
return new(global.ActiveXObject)(axs[i]);
}
};
}
Expand Down
12 changes: 5 additions & 7 deletions test/request_url.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
global.window = {
location: {
host: 'localhost:8081',
port: 8081,
protocol: 'http:'
}
global.location = {
host: 'localhost:8081',
port: 8081,
protocol: 'http:'
};

var noop = function() {};
global.window.XMLHttpRequest = function() {
global.XMLHttpRequest = function() {
this.open = noop;
this.send = noop;
};
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy