Skip to content

Commit 66c2570

Browse files
committed
fix: Use previous host for redirect if redirect does not include a full URL
1 parent a17437f commit 66c2570

14 files changed

Lines changed: 110 additions & 115 deletions

.travis.yml

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
1+
os: linux
2+
dist: xenial
13
language: java
2-
sudo: required
34
jdk:
4-
- openjdk8
5-
cache:
6-
directories:
7-
- $HOME/.CommandBox
5+
- openjdk8
86
env:
9-
matrix:
10-
- ENGINE=lucee@5
11-
- ENGINE=adobe@2018
12-
- ENGINE=adobe@2016
13-
- ENGINE=adobe@11
14-
global:
15-
secure: ytBE5/0yTki2SDLwIwVtLmheTxzKKe5hX4dl3/dqK9/W4BfFvyFfUMQgL9729tXXSKpANguyDDAEfhtHiO72HSyggOg9Ys5nsV/N42UzgOKpefKWyEQDJ2b6vZt/bbQ7CvpgXsvz72YrBKoHdrgGbdO46iLEkSdRsAXOyOre84ie68vT66yDpsrgWe21B23y8hUyG0jud3Vb9yg1VFEzdlgj08thHvxpmcnuLyBwiCZ36SBmJZImXpR78o/WT/1c8AJW2+wqwg3FzYkT+Gp8Ncckv3Z4nPsxAePZiLm9O7QLEwrK0OJzYtyR+MSW3aJPP5KMLA8pFi73LyJv5tvGDy2ftgiAS88FTO3MXgwbomiRAnvpLDRYo7CV0cKW05Y5xYQ4ro5nhV98SwNhsMWd+juYd4+d64/VUdC3mt+VoQU5AZSpQ3vf/1dCFO4PKM25n1qT773M1hzyQNO0wXTn07AJ0+W2PE3dcOO/ZUiAbmF943Fs1e/pjnfVrAEPJl17M63csvlrFo2CDiNbKeMZDcv5oVA0logv6eo+k/D/WVMyZ1LYFkx8xPW3B6LaolxMhiLAjgvOgAu6tOB7cOOwjS8kgejUlKd5H39CsZzbNiq4+gDo0e8lxufRCWv6cl6f8UPNQN8SWHc/ruBsIrAJIW30n2+wjot3EhEp26Nwri0=
7+
global:
8+
- MODULE_ID=hyper
9+
jobs:
10+
- ENGINE=adobe@11 COLDBOX_VERSION=stable
11+
- ENGINE=adobe@2018 COLDBOX_VERSION=stable
12+
- ENGINE=adobe@2016 COLDBOX_VERSION=stable
13+
- ENGINE=lucee@5 COLDBOX_VERSION=stable
14+
jobs:
15+
include:
16+
- if: type = cron
17+
env:
18+
- ENGINE=adobe@11 COLDBOX_VERSION=be
19+
- ENGINE=adobe@2018 COLDBOX_VERSION=be
20+
- ENGINE=adobe@2016 COLDBOX_VERSION=be
21+
- ENGINE=lucee@5 COLDBOX_VERSION=be
22+
- ENGINE=lucee@be COLDBOX_VERSION=stable
23+
- ENGINE=lucee@be COLDBOX_VERSION=be
1624
before_install:
17-
- curl -fsSl https://downloads.ortussolutions.com/debs/gpg | sudo apt-key add -
18-
- sudo echo "deb http://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a /etc/apt/sources.list.d/commandbox.list
25+
- curl -fsSl https://downloads.ortussolutions.com/debs/gpg | sudo apt-key add -
26+
- sudo echo "deb http://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a /etc/apt/sources.list.d/commandbox.list
1927
install:
20-
- sudo apt-get update && sudo apt-get --assume-yes install commandbox
21-
- box install
28+
- sudo apt-get update && sudo apt-get --assume-yes install commandbox
29+
- box install commandbox-cfformat
30+
- box install --verbose
31+
- box install coldbox@${COLDBOX_VERSION} --force --!save
2232
before_script:
23-
- box server start cfengine=$ENGINE port=8500
33+
- box server start cfengine=$ENGINE port=8500 debug=true
2434
script:
25-
- box testbox run runner='http://127.0.0.1:8500/tests/runner.cfm'
35+
- box testbox run runner='http://127.0.0.1:8500/tests/runner.cfm' verbose=false
36+
- box run-script format:check
2637
after_success:
27-
- box install commandbox-semantic-release
28-
- box config set endpoints.forgebox.APIToken=${FORGEBOX_TOKEN}
29-
- box semantic-release
38+
- box install commandbox-semantic-release
39+
- box config set endpoints.forgebox.APIToken=${FORGEBOX_TOKEN}
40+
- box semantic-release
3041
notifications:
31-
email: false
42+
email:
43+
if: type = cron
44+
on_failure: always

box.json

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
{
2-
"name":"hyper",
3-
"version":"2.2.0",
4-
"author":"",
5-
"location":"forgeboxStorage",
6-
"homepage":"https://github.com/coldbox-modules/hyper",
7-
"documentation":"https://github.com/coldbox-modules/hyper",
8-
"repository":{
9-
"type":"git",
10-
"URL":"https://github.com/coldbox-modules/hyper"
2+
"name": "hyper",
3+
"version": "2.2.0",
4+
"author": "Eric Peterson <eric@elpete.com>",
5+
"location": "forgeboxStorage",
6+
"homepage": "https://github.com/coldbox-modules/hyper",
7+
"documentation": "https://github.com/coldbox-modules/hyper",
8+
"repository": {
9+
"type": "git",
10+
"URL": "https://github.com/coldbox-modules/hyper"
1111
},
12-
"bugs":"https://github.com/coldbox-modules/hyper/issues",
13-
"slug":"hyper",
14-
"shortDescription":"A CFML HTTP Builder",
15-
"description":"A CFML HTTP Builder",
16-
"type":"modules",
17-
"dependencies":{},
18-
"devDependencies":{
19-
"testbox":"^3.2.0+356",
20-
"coldbox":"^4.3.0"
12+
"bugs": "https://github.com/coldbox-modules/hyper/issues",
13+
"slug": "hyper",
14+
"shortDescription": "A CFML HTTP Builder",
15+
"description": "A CFML HTTP Builder",
16+
"type": "modules",
17+
"dependencies": {},
18+
"devDependencies": {
19+
"testbox": "^4.1.0+384",
20+
"coldbox": "^5.6.2+1148"
2121
},
22-
"installPaths":{
23-
"testbox":"testbox/",
24-
"coldbox":"tests/resources/app/coldbox/"
22+
"installPaths": {
23+
"testbox": "testbox/",
24+
"coldbox": "tests/resources/app/coldbox/"
2525
},
26-
"scripts":{},
27-
"ignore":[
26+
"scripts": {
27+
"format": "cfformat run ModuleConfig.cfc,models/**/*.cfc,tests/specs/**/*.cfc,tests/resources/app/handlers/**/*.cfc,tests/resources/app/config/**/*.cfc --overwrite",
28+
"format:check": "cfformat check ModuleConfig.cfc,models/**/*.cfc,tests/specs/**/*.cfc,tests/resources/app/handlers/**/*.cfc,tests/resources/app/config/**/*.cfc --verbose",
29+
"format:watch": "cfformat watch ModuleConfig.cfc,models/**/*.cfc,tests/specs/**/*.cfc,tests/resources/app/handlers/**/*.cfc,tests/resources/app/config/**/*.cfc"
30+
},
31+
"ignore": [
2832
"**/.*",
2933
"test",
3034
"tests"

models/HyperRequest.cfc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,11 @@ component accessors="true" {
574574
private function followRedirect( res ) {
575575
var redirectReq = new Hyper.models.HyperRequest();
576576
redirectReq.setReferrer( res );
577-
redirectReq.setUrl( res.getHeader( "Location" ) );
577+
redirectReq.setUrl(
578+
createObject( "java", "java.net.URI" )
579+
.init( res.getRequest().getFullUrl() )
580+
.resolve( res.getHeader( "Location" ) )
581+
);
578582
redirectReq.setMaximumRedirects( decrementRedirects() );
579583
return redirectReq.send();
580584
}

tests/resources/app/config/Coldbox.cfc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,7 @@
9292
};
9393

9494
//Register interceptors as an array, we need order
95-
interceptors = [
96-
//SES
97-
{class="coldbox.system.interceptors.SES",
98-
properties={}
99-
}
100-
];
95+
interceptors = [];
10196

10297
/*
10398
// module setting overrides
@@ -151,4 +146,4 @@
151146
coldbox.customErrorTemplate = "/coldbox/system/includes/BugReport.cfm";
152147
}
153148

154-
}
149+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
component {
2+
3+
function configure() {
4+
// Set Full Rewrites
5+
setFullRewrites( false );
6+
7+
// Conventions based routing
8+
route( ":handler/:action?" ).end();
9+
}
10+
11+
}

tests/resources/app/config/Routes.cfm

Lines changed: 0 additions & 46 deletions
This file was deleted.

tests/resources/app/handlers/api.cfc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ component {
1212
function redirect( event, rc, prc ) {
1313
param rc.times = 0;
1414
if ( rc.times == 0 ) {
15-
setNextEvent( "api.index" );
15+
relocate( "api.index" );
1616
}
1717
else {
18-
setNextEvent( event = "api.redirect", queryString = "times=#rc.times-1#" );
18+
relocate( event = "api.redirect", queryString = "times=#rc.times-1#" );
1919
}
2020
}
2121

22+
function redirectPartial( event, rc, prc ) {
23+
relocate( url = "/tests/resources/app/index.cfm/api/index" );
24+
}
25+
2226
function create( event, rc, prc ) {
2327
var data = { "id" = 101 };
2428
var content = event.getHTTPContent();

tests/specs/integration/BuilderDefaultsSpec.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
77
} );
88

99
afterEach( function() {
10-
if ( variables.keyExists( "hyper" ) ) {
11-
variables.delete( "hyper" );
10+
if ( structKeyExists( variables, "hyper" ) ) {
11+
structDelete( variables, "hyper" );
1212
}
1313
} );
1414

tests/specs/integration/BuilderPassThroughSpec.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
77
} );
88

99
afterEach( function() {
10-
if ( variables.keyExists( "hyper" ) ) {
11-
variables.delete( "hyper" );
10+
if ( structKeyExists( variables, "hyper" ) ) {
11+
structDelete( variables, "hyper" );
1212
}
1313
} );
1414

tests/specs/integration/GetSpec.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
77
} );
88

99
afterEach( function() {
10-
if ( variables.keyExists( "hyper" ) ) {
11-
variables.delete( "hyper" );
10+
if ( structKeyExists( variables, "hyper" ) ) {
11+
structDelete( variables, "hyper" );
1212
}
1313
} );
1414

0 commit comments

Comments
 (0)