Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
edb7699d
Unverified
Commit
edb7699d
authored
3 years ago
by
Tim van Dijen
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Simplify HTTP status code to always be 303 on redirect (#1538)
parent
c769bc1a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/SimpleSAML/Utils/HTTP.php
+1
-14
1 addition, 14 deletions
lib/SimpleSAML/Utils/HTTP.php
tests/www/IndexTest.php
+3
-3
3 additions, 3 deletions
tests/www/IndexTest.php
with
4 additions
and
17 deletions
lib/SimpleSAML/Utils/HTTP.php
+
1
−
14
View file @
edb7699d
...
@@ -225,26 +225,13 @@ class HTTP
...
@@ -225,26 +225,13 @@ class HTTP
$url
=
$this
->
addURLParameters
(
$url
,
$parameters
);
$url
=
$this
->
addURLParameters
(
$url
,
$parameters
);
}
}
/* Set the HTTP result code. This is either 303 See Other or
* 302 Found. HTTP 303 See Other is sent if the HTTP version
* is HTTP/1.1 and the request type was a POST request.
*/
if
(
$_SERVER
[
'SERVER_PROTOCOL'
]
===
'HTTP/1.1'
&&
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
$code
=
303
;
}
else
{
$code
=
302
;
}
if
(
strlen
(
$url
)
>
2048
)
{
if
(
strlen
(
$url
)
>
2048
)
{
Logger
::
warning
(
'Redirecting to a URL longer than 2048 bytes.'
);
Logger
::
warning
(
'Redirecting to a URL longer than 2048 bytes.'
);
}
}
if
(
!
headers_sent
())
{
if
(
!
headers_sent
())
{
// set the location header
// set the location header
header
(
'Location: '
.
$url
,
true
,
$code
);
header
(
'Location: '
.
$url
,
true
,
303
);
// disable caching of this response
// disable caching of this response
header
(
'Pragma: no-cache'
);
header
(
'Pragma: no-cache'
);
...
...
This diff is collapsed.
Click to expand it.
tests/www/IndexTest.php
+
3
−
3
View file @
edb7699d
...
@@ -74,7 +74,7 @@ class IndexTest extends TestCase
...
@@ -74,7 +74,7 @@ class IndexTest extends TestCase
$resp
=
$this
->
server
->
get
(
'/index.php'
,
[],
[
$resp
=
$this
->
server
->
get
(
'/index.php'
,
[],
[
CURLOPT_FOLLOWLOCATION
=>
0
,
CURLOPT_FOLLOWLOCATION
=>
0
,
]);
]);
$this
->
assertEquals
(
'30
2
'
,
$resp
[
'code'
]);
$this
->
assertEquals
(
'30
3
'
,
$resp
[
'code'
]);
$this
->
assertEquals
(
$this
->
assertEquals
(
'http://example.org/simplesaml/module.php/core/login'
,
'http://example.org/simplesaml/module.php/core/login'
,
$resp
[
'headers'
][
'Location'
]
$resp
[
'headers'
][
'Location'
]
...
@@ -87,7 +87,7 @@ class IndexTest extends TestCase
...
@@ -87,7 +87,7 @@ class IndexTest extends TestCase
$resp
=
$this
->
server
->
get
(
'/index.php'
,
[],
[
$resp
=
$this
->
server
->
get
(
'/index.php'
,
[],
[
CURLOPT_FOLLOWLOCATION
=>
0
,
CURLOPT_FOLLOWLOCATION
=>
0
,
]);
]);
$this
->
assertEquals
(
'30
2
'
,
$resp
[
'code'
]);
$this
->
assertEquals
(
'30
3
'
,
$resp
[
'code'
]);
$this
->
assertEquals
(
$this
->
assertEquals
(
'https://example.org/module.php/core/login'
,
'https://example.org/module.php/core/login'
,
$resp
[
'headers'
][
'Location'
]
$resp
[
'headers'
][
'Location'
]
...
@@ -100,7 +100,7 @@ class IndexTest extends TestCase
...
@@ -100,7 +100,7 @@ class IndexTest extends TestCase
$resp
=
$this
->
server
->
get
(
'/index.php'
,
[],
[
$resp
=
$this
->
server
->
get
(
'/index.php'
,
[],
[
CURLOPT_FOLLOWLOCATION
=>
0
,
CURLOPT_FOLLOWLOCATION
=>
0
,
]);
]);
$this
->
assertEquals
(
'30
2
'
,
$resp
[
'code'
]);
$this
->
assertEquals
(
'30
3
'
,
$resp
[
'code'
]);
$this
->
assertEquals
(
$this
->
assertEquals
(
'http://'
.
$this
->
server_addr
.
'/simplesaml/module.php/core/login'
,
'http://'
.
$this
->
server_addr
.
'/simplesaml/module.php/core/login'
,
$resp
[
'headers'
][
'Location'
]
$resp
[
'headers'
][
'Location'
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment