Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
6752ce93
Commit
6752ce93
authored
Aug 26, 2010
by
Scott Lawrence
Committed by
Russ Cox
Aug 26, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: obscure passwords in return value of URL.String
Fixes #974. R=rsc CC=golang-dev
https://golang.org/cl/1742057
parent
25410fc5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletion
+30
-1
client.go
src/pkg/http/client.go
+2
-0
url.go
src/pkg/http/url.go
+6
-1
url_test.go
src/pkg/http/url_test.go
+22
-0
No files found.
src/pkg/http/client.go
View file @
6752ce93
...
...
@@ -118,6 +118,7 @@ func Get(url string) (r *Response, finalURL string, err os.Error) {
if
req
.
URL
,
err
=
ParseURL
(
url
);
err
!=
nil
{
break
}
url
=
req
.
URL
.
String
()
if
r
,
err
=
send
(
&
req
);
err
!=
nil
{
break
}
...
...
@@ -167,6 +168,7 @@ func Head(url string) (r *Response, err os.Error) {
if
req
.
URL
,
err
=
ParseURL
(
url
);
err
!=
nil
{
return
}
url
=
req
.
URL
.
String
()
if
r
,
err
=
send
(
&
req
);
err
!=
nil
{
return
}
...
...
src/pkg/http/url.go
View file @
6752ce93
...
...
@@ -389,7 +389,12 @@ func (url *URL) String() string {
if
url
.
Host
!=
""
||
url
.
Userinfo
!=
""
{
result
+=
"//"
if
url
.
Userinfo
!=
""
{
result
+=
urlEscape
(
url
.
Userinfo
,
false
)
+
"@"
// hide the password, if any
info
:=
url
.
Userinfo
if
i
:=
strings
.
Index
(
info
,
":"
);
i
>=
0
{
info
=
info
[
0
:
i
]
+
":******"
}
result
+=
urlEscape
(
info
,
false
)
+
"@"
}
result
+=
url
.
Host
}
...
...
src/pkg/http/url_test.go
View file @
6752ce93
...
...
@@ -185,6 +185,28 @@ var urltests = []URLTest{
},
""
,
},
URLTest
{
"http://user:password@google.com"
,
&
URL
{
Raw
:
"http://user:password@google.com"
,
Scheme
:
"http"
,
Authority
:
"user:password@google.com"
,
Userinfo
:
"user:password"
,
Host
:
"google.com"
,
},
"http://user:******@google.com"
,
},
URLTest
{
"http://user:longerpass@google.com"
,
&
URL
{
Raw
:
"http://user:longerpass@google.com"
,
Scheme
:
"http"
,
Authority
:
"user:longerpass@google.com"
,
Userinfo
:
"user:longerpass"
,
Host
:
"google.com"
,
},
"http://user:******@google.com"
,
},
}
var
urlnofragtests
=
[]
URLTest
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment