Set max redirects limit to 20 (Closes #414)

This commit is contained in:
Gregory Schier 2017-08-10 08:44:24 -07:00
parent b88f4741e4
commit a834b93e5e
4 changed files with 12 additions and 0 deletions

View File

@ -99,6 +99,7 @@ Curl.option = {
HTTPPOST: 'HTTPPOST',
INFILESIZE: 'INFILESIZE',
KEYPASSWD: 'KEYPASSWD',
MAXREDIRS: 'MAXREDIRS',
NETRC: 'NETRC',
NOBODY: 'NOBODY',
NOPROGRESS: 'NOPROGRESS',

View File

@ -71,6 +71,7 @@ describe('actuallySend()', () => {
ACCEPT_ENCODING: '',
COOKIEFILE: '',
FOLLOWLOCATION: true,
MAXREDIRS: 20,
HTTPHEADER: [
'Content-Type: application/json',
'Expect: ',
@ -123,6 +124,7 @@ describe('actuallySend()', () => {
ACCEPT_ENCODING: '',
COOKIEFILE: '',
FOLLOWLOCATION: true,
MAXREDIRS: 20,
HTTPHEADER: [
'Content-Type: application/x-www-form-urlencoded',
'Expect: ',
@ -200,6 +202,7 @@ describe('actuallySend()', () => {
CUSTOMREQUEST: 'GET',
ACCEPT_ENCODING: '',
FOLLOWLOCATION: true,
MAXREDIRS: 20,
HTTPHEADER: [
'Content-Type: application/json',
'Expect: ',
@ -255,6 +258,7 @@ describe('actuallySend()', () => {
CUSTOMREQUEST: 'POST',
COOKIEFILE: '',
FOLLOWLOCATION: true,
MAXREDIRS: 20,
HTTPHEADER: [
'Content-Type: application/octet-stream',
'Expect: ',
@ -310,6 +314,7 @@ describe('actuallySend()', () => {
ACCEPT_ENCODING: '',
COOKIEFILE: '',
FOLLOWLOCATION: true,
MAXREDIRS: 20,
HTTPHEADER: [
'Content-Type: multipart/form-data',
'Expect: ',
@ -350,6 +355,7 @@ describe('actuallySend()', () => {
ACCEPT_ENCODING: '',
COOKIEFILE: '',
FOLLOWLOCATION: true,
MAXREDIRS: 20,
HTTPHEADER: ['content-type: '],
NOPROGRESS: false,
PROXY: '',
@ -383,6 +389,7 @@ describe('actuallySend()', () => {
ACCEPT_ENCODING: '',
COOKIEFILE: '',
FOLLOWLOCATION: true,
MAXREDIRS: 20,
HTTPHEADER: ['content-type: '],
NOPROGRESS: false,
PROXY: '',
@ -415,6 +422,7 @@ describe('actuallySend()', () => {
ACCEPT_ENCODING: '',
COOKIEFILE: '',
FOLLOWLOCATION: true,
MAXREDIRS: 20,
HTTPHEADER: ['content-type: '],
NOPROGRESS: false,
PROXY: '',
@ -448,6 +456,7 @@ describe('actuallySend()', () => {
ACCEPT_ENCODING: '',
COOKIEFILE: '',
FOLLOWLOCATION: true,
MAXREDIRS: 20,
HTTPHEADER: ['content-type: '],
NOPROGRESS: false,
PROXY: '',

View File

@ -132,6 +132,7 @@ export function _actuallySend (
// Set all the basic options
setOpt(Curl.option.FOLLOWLOCATION, settings.followRedirects);
setOpt(Curl.option.MAXREDIRS, 20);
setOpt(Curl.option.TIMEOUT_MS, settings.timeout); // 0 for no timeout
setOpt(Curl.option.VERBOSE, true); // True so debug function works
setOpt(Curl.option.NOPROGRESS, false); // False so progress function works

View File

@ -14,6 +14,7 @@ declare class Curl {
HTTPPOST: number,
INFILESIZE: number,
KEYPASSWD: number,
MAXREDIRS: number,
NETRC: number,
NOBODY: number,
NOPROGRESS: number,