Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
39e91f88
Commit
39e91f88
authored
Feb 22, 2010
by
Petar Maymounkov
Committed by
Russ Cox
Feb 22, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: use RawURL in Request.Write
R=rsc CC=golang-dev
https://golang.org/cl/217066
parent
1a37656b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
src/pkg/http/request.go
src/pkg/http/request.go
+7
-4
src/pkg/http/requestwrite_test.go
src/pkg/http/requestwrite_test.go
+1
-1
No files found.
src/pkg/http/request.go
View file @
39e91f88
...
...
@@ -152,7 +152,7 @@ const defaultUserAgent = "Go http package"
// Write writes an HTTP/1.1 request -- header and body -- in wire format.
// This method consults the following fields of req:
// Host
// URL
//
RawURL, if non-empty, or else
URL
// Method (defaults to "GET")
// UserAgent (defaults to defaultUserAgent)
// Referer
...
...
@@ -167,9 +167,12 @@ func (req *Request) Write(w io.Writer) os.Error {
host
=
req
.
URL
.
Host
}
uri
:=
valueOrDefault
(
urlEscape
(
req
.
URL
.
Path
,
false
),
"/"
)
if
req
.
URL
.
RawQuery
!=
""
{
uri
+=
"?"
+
req
.
URL
.
RawQuery
uri
:=
req
.
RawURL
if
uri
==
""
{
uri
=
valueOrDefault
(
urlEscape
(
req
.
URL
.
Path
,
false
),
"/"
)
if
req
.
URL
.
RawQuery
!=
""
{
uri
+=
"?"
+
req
.
URL
.
RawQuery
}
}
fmt
.
Fprintf
(
w
,
"%s %s HTTP/1.1
\r\n
"
,
valueOrDefault
(
req
.
Method
,
"GET"
),
uri
)
...
...
src/pkg/http/requestwrite_test.go
View file @
39e91f88
...
...
@@ -50,7 +50,7 @@ var reqWriteTests = []reqWriteTest{
Form
:
map
[
string
][]
string
{},
},
"GET / HTTP/1.1
\r\n
"
+
"GET
http://www.techcrunch.com
/ HTTP/1.1
\r\n
"
+
"Host: www.techcrunch.com
\r\n
"
+
"User-Agent: Fake
\r\n
"
+
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
\r\n
"
+
...
...
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