Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
1d797e66
...
1d797e668da0a1279656ca0221559d99eecb4e45
authored
2011-12-20 12:24:34 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
closes #29 - casper.open() can now directly handle HTTP authentication parameters in urls
1 parent
963d1a3b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
lib/casper.js
lib/casper.js
View file @
1d797e6
...
...
@@ -578,6 +578,16 @@
open
:
function
(
location
,
options
)
{
options
=
isType
(
options
,
"object"
)
?
options
:
{};
this
.
requestUrl
=
location
;
// http auth
var
httpAuthMatch
=
location
.
match
(
/^https
?
:
\/\/(
.+
)
:
(
.+
)
@/i
);
if
(
httpAuthMatch
)
{
this
.
page
.
settings
.
userName
=
httpAuthMatch
[
1
];
this
.
page
.
settings
.
password
=
httpAuthMatch
[
2
];
this
.
log
(
"Adding authentication for user "
+
this
.
page
.
settings
.
userName
,
"info"
);
}
else
{
delete
this
.
page
.
settings
.
userName
;
delete
this
.
page
.
settings
.
password
;
}
this
.
page
.
open
(
location
);
return
this
;
},
...
...
Please
register
or
sign in
to post a comment