Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
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
beego
Commits
d9019506
Commit
d9019506
authored
Mar 13, 2016
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #1783
parent
474bdd2e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
14 deletions
+6
-14
context.go
context/context.go
+0
-10
output.go
context/output.go
+5
-3
router.go
router.go
+1
-1
No files found.
context/context.go
View file @
d9019506
...
@@ -24,13 +24,11 @@ package context
...
@@ -24,13 +24,11 @@ package context
import
(
import
(
"bufio"
"bufio"
"bytes"
"crypto/hmac"
"crypto/hmac"
"crypto/sha1"
"crypto/sha1"
"encoding/base64"
"encoding/base64"
"errors"
"errors"
"fmt"
"fmt"
"io"
"net"
"net"
"net/http"
"net/http"
"strconv"
"strconv"
...
@@ -195,14 +193,6 @@ func (r *Response) Write(p []byte) (int, error) {
...
@@ -195,14 +193,6 @@ func (r *Response) Write(p []byte) (int, error) {
return
r
.
ResponseWriter
.
Write
(
p
)
return
r
.
ResponseWriter
.
Write
(
p
)
}
}
// Copy writes the data to the connection as part of an HTTP reply,
// and sets `started` to true.
// started means the response has sent out.
func
(
r
*
Response
)
Copy
(
buf
*
bytes
.
Buffer
)
(
int64
,
error
)
{
r
.
Started
=
true
return
io
.
Copy
(
r
.
ResponseWriter
,
buf
)
}
// WriteHeader sends an HTTP response header with status code,
// WriteHeader sends an HTTP response header with status code,
// and sets `started` to true.
// and sets `started` to true.
func
(
r
*
Response
)
WriteHeader
(
code
int
)
{
func
(
r
*
Response
)
WriteHeader
(
code
int
)
{
...
...
context/output.go
View file @
d9019506
...
@@ -21,6 +21,7 @@ import (
...
@@ -21,6 +21,7 @@ import (
"errors"
"errors"
"fmt"
"fmt"
"html/template"
"html/template"
"io"
"mime"
"mime"
"net/http"
"net/http"
"path/filepath"
"path/filepath"
...
@@ -72,10 +73,11 @@ func (output *BeegoOutput) Body(content []byte) error {
...
@@ -72,10 +73,11 @@ func (output *BeegoOutput) Body(content []byte) error {
if
output
.
Status
!=
0
{
if
output
.
Status
!=
0
{
output
.
Context
.
ResponseWriter
.
WriteHeader
(
output
.
Status
)
output
.
Context
.
ResponseWriter
.
WriteHeader
(
output
.
Status
)
output
.
Status
=
0
output
.
Status
=
0
}
else
{
output
.
Context
.
ResponseWriter
.
Started
=
true
}
}
io
.
Copy
(
output
.
Context
.
ResponseWriter
,
buf
)
_
,
err
:=
output
.
Context
.
ResponseWriter
.
Copy
(
buf
)
return
nil
return
err
}
}
// Cookie sets cookie value via given key.
// Cookie sets cookie value via given key.
...
...
router.go
View file @
d9019506
...
@@ -783,7 +783,7 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
...
@@ -783,7 +783,7 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
if
!
context
.
ResponseWriter
.
Started
&&
context
.
Output
.
Status
==
0
{
if
!
context
.
ResponseWriter
.
Started
&&
context
.
Output
.
Status
==
0
{
if
BConfig
.
WebConfig
.
AutoRender
{
if
BConfig
.
WebConfig
.
AutoRender
{
if
err
:=
execController
.
Render
();
err
!=
nil
{
if
err
:=
execController
.
Render
();
err
!=
nil
{
panic
(
err
)
Error
(
err
)
}
}
}
}
}
}
...
...
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