Compare commits

..

11 Commits

Author SHA1 Message Date
NotZippy
18e6b92704 Spaces to tabs (gofmt) files 2017-05-03 15:56:37 -07:00
NotZippy
49041fb83d Changed build to print a warning if import-path build failed. 2017-05-02 14:31:15 -07:00
NotZippy
f86def601d Merge branch 'server-engine' of github.com:revel/cmd into server-engine 2017-05-02 14:30:04 -07:00
NotZippy
15875dc9a1 Added allowance for test packages to co-exist 2017-05-02 14:28:33 -07:00
NotZippy
16f98f92e0 Changed SetHeader to SetHttpHeader, HeaderHttpValue to GetHttpHeader 2017-04-26 21:13:46 -07:00
NotZippy
9de11613ce Revamped engine to reduce the interface size.
Added BufferedServerHeader to CompressWriter to prevent header from writing out immediately
Reduced object stack to a single controller stack which has the request and response objects already instaniated in it
Fixed go engine to match new spec
Modified code to make use of the Request object to access the ServerEngine (allows caching of ServerHeader and ResponseWriter)
Modified simple stack to add an upper bounds to the number of objects in cache, any more objects then the upper bounds will be left to garbage collect
2017-04-26 21:13:46 -07:00
notzippy
32d1f12b51 Merge pull request #89 from notzippy/server-engine
Changed SetHeader to SetHttpHeader, HeaderHttpValue to GetHttpHeader
2017-04-26 17:57:54 -07:00
NotZippy
d114a92b3d Changed SetHeader to SetHttpHeader, HeaderHttpValue to GetHttpHeader 2017-04-26 17:52:20 -07:00
notzippy
8bf654d8b0 Merge pull request #88 from notzippy/server-engine
Revamped engine to reduce the interface size.
2017-04-26 17:36:23 -07:00
NotZippy
79ed869901 Revamped engine to reduce the interface size.
Added BufferedServerHeader to CompressWriter to prevent header from writing out immediately
Reduced object stack to a single controller stack which has the request and response objects already instaniated in it
Fixed go engine to match new spec
Modified code to make use of the Request object to access the ServerEngine (allows caching of ServerHeader and ResponseWriter)
Modified simple stack to add an upper bounds to the number of objects in cache, any more objects then the upper bounds will be left to garbage collect
2017-04-26 17:32:51 -07:00
notzippy
3ba212afb4 Merge pull request #83 from notzippy/server-engine
Makes it so harness can bootstrap using the new GoRequest / response …
2017-04-06 09:44:20 -07:00
4 changed files with 27 additions and 9 deletions

View File

@@ -47,10 +47,12 @@ type Harness struct {
proxy *httputil.ReverseProxy
}
func renderError(w http.ResponseWriter, r *http.Request, err error) {
req, resp := revel.NewRequest(r), revel.NewResponse(w)
c := revel.NewController(req, resp)
c.RenderError(err).Apply(req, resp)
func renderError(iw http.ResponseWriter, ir *http.Request, err error) {
context := revel.NewGOContext(nil)
context.Request.SetRequest(ir)
context.Response.SetResponse(iw)
c := revel.NewController(context)
c.RenderError(err).Apply(c.Request, c.Response)
}
// ServeHTTP handles all requests.

View File

@@ -160,8 +160,20 @@ func ProcessSource(roots []string) (*SourceInfo, *revel.Error) {
return nil
}
// Ignore packages that end with _test
for i := range pkgs {
if len(i) > 6 {
if string(i[len(i)-5:]) == "_test" {
delete(pkgs, i)
}
}
}
// There should be only one package in this directory.
if len(pkgs) > 1 {
for i := range pkgs {
println("Found package ", i)
}
log.Println("Most unexpected! Multiple packages in a single directory:", pkgs)
}

View File

@@ -89,7 +89,12 @@ func parseRunArgs(args []string) *RunArgs {
// 1. revel run [import-path]
// 2. revel run [port]
// 3. revel run [run-mode]
if _, err := build.Import(args[0], "", build.FindOnly); err == nil {
_, err := build.Import(args[0], "", build.FindOnly)
if err != nil {
revel.WARN.Printf("Unable to run using an import path, assuming import path is working directory %s %s", args[0], err.Error())
}
println("Trying to build with", args[0], err)
if err == nil {
// 1st arg is the import path
inputArgs.ImportPath = args[0]
} else if port, err := strconv.Atoi(args[0]); err == nil {

View File

@@ -29,7 +29,6 @@ func init() {
revel.ActionInvoker, // Invoke the action.
}
// register startup functions with OnAppStart
// revel.DevMode and revel.RunMode only work inside of OnAppStart. See Example Startup Script
// ( order dependent )
@@ -43,9 +42,9 @@ func init() {
// should probably also have a filter for CSRF
// not sure if it can go in the same filter or not
var HeaderFilter = func(c *revel.Controller, fc []revel.Filter) {
c.Response.Out.Header().Add("X-Frame-Options", "SAMEORIGIN")
c.Response.Out.Header().Add("X-XSS-Protection", "1; mode=block")
c.Response.Out.Header().Add("X-Content-Type-Options", "nosniff")
c.Response.SetHttpHeader("X-Frame-Options", "SAMEORIGIN")
c.Response.SetHttpHeader("X-XSS-Protection", "1; mode=block")
c.Response.SetHttpHeader("X-Content-Type-Options", "nosniff")
fc[0](c, fc[1:]) // Execute the next filter stage.
}