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
48f19b41
Commit
48f19b41
authored
Jan 17, 2016
by
astaxie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1571 from astaxie/develop
beego 1.6.0 released
parents
895748d6
9adf20d7
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
46 additions
and
44 deletions
+46
-44
file.go
cache/file.go
+4
-4
memcache.go
cache/memcache/memcache.go
+3
-2
memory.go
cache/memory.go
+3
-3
json.go
config/json.go
+1
-1
acceptencoder_test.go
context/acceptencoder_test.go
+7
-8
doc.go
doc.go
+1
-1
grace.go
grace/grace.go
+8
-8
console_test.go
logs/console_test.go
+0
-1
file_test.go
logs/file_test.go
+1
-2
orm_conds.go
orm/orm_conds.go
+1
-1
qb_mysql.go
orm/qb_mysql.go
+1
-1
apiauth.go
plugins/apiauth/apiauth.go
+1
-1
sess_cookie_test.go
session/sess_cookie_test.go
+2
-2
docs_spec.go
swagger/docs_spec.go
+2
-2
template.go
template.go
+1
-1
templatefunc.go
templatefunc.go
+1
-1
tree.go
tree.go
+2
-2
captcha.go
utils/captcha/captcha.go
+2
-2
mail.go
utils/mail.go
+5
-1
No files found.
cache/file.go
View file @
48f19b41
...
...
@@ -39,10 +39,10 @@ type FileCacheItem struct {
// FileCache Config
var
(
FileCachePath
=
"cache"
// cache directory
FileCacheFileSuffix
=
".bin"
// cache file suffix
FileCacheDirectoryLevel
=
2
// cache file deep level if auto generated cache files.
FileCacheEmbedExpiry
time
.
Duration
=
0
// cache expire time, default is no expire forever.
FileCachePath
=
"cache"
// cache directory
FileCacheFileSuffix
=
".bin"
// cache file suffix
FileCacheDirectoryLevel
=
2
// cache file deep level if auto generated cache files.
FileCacheEmbedExpiry
time
.
Duration
=
0
// cache expire time, default is no expire forever.
)
// FileCache is cache adapter for file storage.
...
...
cache/memcache/memcache.go
View file @
48f19b41
...
...
@@ -36,8 +36,9 @@ import (
"github.com/bradfitz/gomemcache/memcache"
"github.com/astaxie/beego/cache"
"time"
"github.com/astaxie/beego/cache"
)
// Cache Memcache adapter.
...
...
@@ -100,7 +101,7 @@ func (rc *Cache) Put(key string, val interface{}, timeout time.Duration) error {
if
!
ok
{
return
errors
.
New
(
"val must string"
)
}
item
:=
memcache
.
Item
{
Key
:
key
,
Value
:
[]
byte
(
v
),
Expiration
:
int32
(
timeout
/
time
.
Second
)}
item
:=
memcache
.
Item
{
Key
:
key
,
Value
:
[]
byte
(
v
),
Expiration
:
int32
(
timeout
/
time
.
Second
)}
return
rc
.
conn
.
Set
(
&
item
)
}
...
...
cache/memory.go
View file @
48f19b41
...
...
@@ -86,9 +86,9 @@ func (bc *MemoryCache) Put(name string, value interface{}, lifespan time.Duratio
bc
.
Lock
()
defer
bc
.
Unlock
()
bc
.
items
[
name
]
=
&
MemoryItem
{
val
:
value
,
val
:
value
,
createdTime
:
time
.
Now
(),
lifespan
:
lifespan
,
lifespan
:
lifespan
,
}
return
nil
}
...
...
@@ -200,7 +200,7 @@ func (bc *MemoryCache) StartAndGC(config string) error {
cf
=
make
(
map
[
string
]
int
)
cf
[
"interval"
]
=
DefaultEvery
}
dur
:=
time
.
Duration
(
cf
[
"interval"
])
*
time
.
Second
dur
:=
time
.
Duration
(
cf
[
"interval"
])
*
time
.
Second
bc
.
Every
=
cf
[
"interval"
]
bc
.
dur
=
dur
go
bc
.
vaccuum
()
...
...
config/json.go
View file @
48f19b41
...
...
@@ -164,7 +164,7 @@ func (c *JSONConfigContainer) String(key string) string {
// DefaultString returns the string value for a given key.
// if err != nil return defaltval
func
(
c
*
JSONConfigContainer
)
DefaultString
(
key
string
,
defaultval
string
)
string
{
// TODO FIXME should not use "" to replace non exist
a
nce
// TODO FIXME should not use "" to replace non exist
e
nce
if
v
:=
c
.
String
(
key
);
v
!=
""
{
return
v
}
...
...
context/acceptencoder_test.go
View file @
48f19b41
...
...
@@ -20,26 +20,25 @@ import (
)
func
Test_ExtractEncoding
(
t
*
testing
.
T
)
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"gzip,deflate"
}}})
!=
"gzip"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
{
"gzip,deflate"
}}})
!=
"gzip"
{
t
.
Fail
()
}
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"deflate,gzip"
}}})
!=
"deflate"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
{
"deflate,gzip"
}}})
!=
"deflate"
{
t
.
Fail
()
}
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"gzip;q=.5,deflate"
}}})
!=
"deflate"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
{
"gzip;q=.5,deflate"
}}})
!=
"deflate"
{
t
.
Fail
()
}
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"gzip;q=.5,deflate;q=0.3"
}}})
!=
"gzip"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
{
"gzip;q=.5,deflate;q=0.3"
}}})
!=
"gzip"
{
t
.
Fail
()
}
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"gzip;q=0,deflate"
}}})
!=
"deflate"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
{
"gzip;q=0,deflate"
}}})
!=
"deflate"
{
t
.
Fail
()
}
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"deflate;q=0.5,gzip;q=0.5,identity"
}}})
!=
""
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
{
"deflate;q=0.5,gzip;q=0.5,identity"
}}})
!=
""
{
t
.
Fail
()
}
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"*"
}}})
!=
"gzip"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
{
"*"
}}})
!=
"gzip"
{
t
.
Fail
()
}
}
doc.go
View file @
48f19b41
...
...
@@ -12,6 +12,6 @@ beego is inspired by Tornado, Sinatra and Flask with the added benefit of some G
beego.Run()
}
more infomation: http://beego.me
more info
r
mation: http://beego.me
*/
package
beego
grace/grace.go
View file @
48f19b41
...
...
@@ -118,15 +118,15 @@ func NewServer(addr string, handler http.Handler) (srv *Server) {
sigChan
:
make
(
chan
os
.
Signal
),
isChild
:
isChild
,
SignalHooks
:
map
[
int
]
map
[
os
.
Signal
][]
func
(){
PreSignal
:
map
[
os
.
Signal
][]
func
()
{
syscall
.
SIGHUP
:
[]
func
()
{},
syscall
.
SIGINT
:
[]
func
()
{},
syscall
.
SIGTERM
:
[]
func
()
{},
PreSignal
:
{
syscall
.
SIGHUP
:
{},
syscall
.
SIGINT
:
{},
syscall
.
SIGTERM
:
{},
},
PostSignal
:
map
[
os
.
Signal
][]
func
()
{
syscall
.
SIGHUP
:
[]
func
()
{},
syscall
.
SIGINT
:
[]
func
()
{},
syscall
.
SIGTERM
:
[]
func
()
{},
PostSignal
:
{
syscall
.
SIGHUP
:
{},
syscall
.
SIGINT
:
{},
syscall
.
SIGTERM
:
{},
},
},
state
:
StateInit
,
...
...
logs/console_test.go
View file @
48f19b41
...
...
@@ -42,4 +42,3 @@ func TestConsole(t *testing.T) {
log2
.
SetLogger
(
"console"
,
`{"level":3}`
)
testConsoleCalls
(
log2
)
}
logs/file_test.go
View file @
48f19b41
...
...
@@ -130,7 +130,6 @@ func BenchmarkFile(b *testing.B) {
os
.
Remove
(
"test4.log"
)
}
func
BenchmarkFileAsynchronous
(
b
*
testing
.
B
)
{
log
:=
NewLogger
(
100000
)
log
.
SetLogger
(
"file"
,
`{"filename":"test4.log"}`
)
...
...
@@ -168,7 +167,7 @@ func BenchmarkFileOnGoroutine(b *testing.B) {
log
:=
NewLogger
(
100000
)
log
.
SetLogger
(
"file"
,
`{"filename":"test4.log"}`
)
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
go
log
.
Debug
(
"debug"
)
go
log
.
Debug
(
"debug"
)
}
os
.
Remove
(
"test4.log"
)
}
orm/orm_conds.go
View file @
48f19b41
...
...
@@ -19,7 +19,7 @@ import (
"strings"
)
// ExprSep define the expression sep
e
ration
// ExprSep define the expression sep
a
ration
const
(
ExprSep
=
"__"
)
...
...
orm/qb_mysql.go
View file @
48f19b41
...
...
@@ -20,7 +20,7 @@ import (
"strings"
)
// CommaSpace is the sep
e
ration
// CommaSpace is the sep
a
ration
const
CommaSpace
=
", "
// MySQLQueryBuilder is the SQL build
...
...
plugins/apiauth/apiauth.go
View file @
48f19b41
...
...
@@ -41,7 +41,7 @@
//
// 1. appid
//
// appid is asigned to the application
// appid is as
s
igned to the application
//
// 2. signature
//
...
...
session/sess_cookie_test.go
View file @
48f19b41
...
...
@@ -80,7 +80,7 @@ func TestDestorySessionCookie(t *testing.T) {
t
.
Fatal
(
"get cookie session id is not the same again."
)
}
// After dest
or
y session , will get a new session id .
// After dest
ro
y session , will get a new session id .
globalSessions
.
SessionDestroy
(
w
,
r1
)
r2
,
_
:=
http
.
NewRequest
(
"GET"
,
"/"
,
nil
)
r2
.
Header
.
Set
(
"Cookie"
,
w
.
Header
()
.
Get
(
"Set-Cookie"
))
...
...
@@ -91,6 +91,6 @@ func TestDestorySessionCookie(t *testing.T) {
t
.
Fatal
(
"session start error"
)
}
if
newSession
.
SessionID
()
==
session
.
SessionID
()
{
t
.
Fatal
(
"after dest
or
y session and reqeust again ,get cookie session id is same."
)
t
.
Fatal
(
"after dest
ro
y session and reqeust again ,get cookie session id is same."
)
}
}
swagger/docs_spec.go
View file @
48f19b41
...
...
@@ -23,8 +23,8 @@ type ResourceListing struct {
APIVersion
string
`json:"apiVersion"`
SwaggerVersion
string
`json:"swaggerVersion"`
// e.g 1.2
// BasePath string `json:"basePath"` obsolete in 1.1
APIs
[]
APIRef
`json:"apis"`
Info
Information
`json:"info"`
APIs
[]
APIRef
`json:"apis"`
Info
Information
`json:"info"`
}
// APIRef description the api path and description
...
...
template.go
View file @
48f19b41
...
...
@@ -31,7 +31,7 @@ var (
beegoTplFuncMap
=
make
(
template
.
FuncMap
)
// BeeTemplates caching map and supported template file extensions.
BeeTemplates
=
make
(
map
[
string
]
*
template
.
Template
)
// BeeTemplateExt stores the template exten
t
ion which will build
// BeeTemplateExt stores the template exten
s
ion which will build
BeeTemplateExt
=
[]
string
{
"tpl"
,
"html"
}
)
...
...
templatefunc.go
View file @
48f19b41
...
...
@@ -670,7 +670,7 @@ func MapGet(arg1 interface{}, arg2 ...interface{}) (interface{}, error) {
if
arg1Type
.
Kind
()
==
reflect
.
Map
&&
len
(
arg2
)
>
0
{
// check whether arg2[0] type equals to arg1 key type
// if they are different, make conver
t
ion
// if they are different, make conver
s
ion
arg2Val
:=
reflect
.
ValueOf
(
arg2
[
0
])
arg2Type
:=
reflect
.
TypeOf
(
arg2
[
0
])
if
arg2Type
.
Kind
()
!=
arg1Type
.
Key
()
.
Kind
()
{
...
...
tree.go
View file @
48f19b41
...
...
@@ -141,7 +141,7 @@ func (t *Tree) addtree(segments []string, tree *Tree, wildcards []string, reg st
regexpStr
=
"([^.]+).(.+)"
params
=
params
[
1
:
]
}
else
{
for
_
=
range
params
{
for
range
params
{
regexpStr
=
"([^/]+)/"
+
regexpStr
}
}
...
...
@@ -254,7 +254,7 @@ func (t *Tree) addseg(segments []string, route interface{}, wildcards []string,
regexpStr
=
"/([^.]+).(.+)"
params
=
params
[
1
:
]
}
else
{
for
_
=
range
params
{
for
range
params
{
regexpStr
=
"/([^/]+)"
+
regexpStr
}
}
...
...
utils/captcha/captcha.go
View file @
48f19b41
...
...
@@ -158,7 +158,7 @@ func (c *Captcha) Handler(ctx *context.Context) {
}
}
// CreateCaptchaHTML temp
al
te func for output html
// CreateCaptchaHTML temp
la
te func for output html
func
(
c
*
Captcha
)
CreateCaptchaHTML
()
template
.
HTML
{
value
,
err
:=
c
.
CreateCaptcha
()
if
err
!=
nil
{
...
...
@@ -255,7 +255,7 @@ func NewCaptcha(urlPrefix string, store cache.Cache) *Captcha {
}
// NewWithFilter create a new captcha.Captcha and auto AddFilter for serve captacha image
// and add a temp
al
te func for output html
// and add a temp
la
te func for output html
func
NewWithFilter
(
urlPrefix
string
,
store
cache
.
Cache
)
*
Captcha
{
cpt
:=
NewCaptcha
(
urlPrefix
,
store
)
...
...
utils/mail.go
View file @
48f19b41
...
...
@@ -96,12 +96,16 @@ func (e *Email) Bytes() ([]byte, error) {
e
.
Headers
.
Set
(
"Disposition-Notification-To"
,
strings
.
Join
(
e
.
ReadReceipt
,
","
))
}
e
.
Headers
.
Set
(
"MIME-Version"
,
"1.0"
)
e
.
Headers
.
Set
(
"Content-Type"
,
fmt
.
Sprintf
(
"multipart/mixed;
\r\n
boundary=%s
\r\n
"
,
w
.
Boundary
()))
// Write the envelope headers (including any custom headers)
if
err
:=
headerToBytes
(
buff
,
e
.
Headers
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Failed to render message headers: %s"
,
err
)
}
e
.
Headers
.
Set
(
"Content-Type"
,
fmt
.
Sprintf
(
"multipart/mixed;
\r\n
boundary=%s
\r\n
"
,
w
.
Boundary
()))
fmt
.
Fprintf
(
w
,
"%s:"
,
"Content-Type"
)
fmt
.
Fprintf
(
w
,
" %s
\r\n
"
,
fmt
.
Sprintf
(
"multipart/mixed;
\r\n
boundary=%s
\r\n
"
,
w
.
Boundary
()))
// Start the multipart/mixed part
fmt
.
Fprintf
(
buff
,
"--%s
\r\n
"
,
w
.
Boundary
())
header
:=
textproto
.
MIMEHeader
{}
...
...
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