Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: couchbase/sync_gateway
base: edc8f9e99e
...
head fork: couchbase/sync_gateway
compare: 030e0f6388
  • 4 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jan 22, 2013
@snej snej Dammit, I broke guest/unauthenticated logins a few commits ago. Fixed. 2aa30ab
@snej snej Fixed db package unit test code
Realized I had not actually been running the unit tests for this
package lately, even though I thought I had. (Note to self: running
tests in a package does NOT run tests in the packages it imports!)
1a97a1d
@snej snej Fix crash attempting to run validations e6412fc
@snej snej Fail _changes request if using channel filter but no channels parameter 030e0f6
View
4 base/jsserver.go
@@ -79,7 +79,9 @@ func (server *JSServer) DefineNativeFunction(name string, function func(otto.Fun
// Invokes the JS function. Not thread-safe! This is exposed for use by unit tests.
func (server *JSServer) DirectCallFunction(inputs []string) (interface{}, error) {
- server.Before()
+ if server.Before != nil {
+ server.Before()
+ }
var result otto.Value
var err error
View
2  db/attachment_test.go
@@ -35,7 +35,7 @@ func tojson(obj interface{}) string {
}
func TestAttachments(t *testing.T) {
- db, err := CreateDatabase(gTestBucket, "db")
+ db, err := CreateDatabase(&DatabaseContext{Name: "db", Bucket: gTestBucket})
assertNoError(t, err, "Couldn't create database 'db'")
defer func() {
err = db.Delete()
View
2  db/database_test.go
@@ -30,7 +30,7 @@ func init() {
}
func TestDatabase(t *testing.T) {
- db, err := CreateDatabase(gTestBucket, "db")
+ db, err := CreateDatabase(&DatabaseContext{Name: "db", Bucket: gTestBucket})
assertNoError(t, err, "Couldn't create database 'db'")
defer func() {
err = db.Delete()
View
17 rest/handler.go
@@ -98,16 +98,17 @@ func (h *handler) checkAuth() error {
if h.context.auth == nil {
return nil
}
- userName, password := h.getBasicAuth()
- if userName != "" {
- h.user = h.context.auth.AuthenticateUser(userName, password)
+
+ // Check cookie first, then HTTP auth:
+ var err error
+ h.user, err = h.context.auth.AuthenticateCookie(h.rq)
+ if err != nil {
+ return err
}
+ var userName, password string
if h.user == nil {
- var err error
- h.user, err = h.context.auth.AuthenticateCookie(h.rq)
- if err != nil {
- return err
- }
+ userName, password = h.getBasicAuth()
+ h.user = h.context.auth.AuthenticateUser(userName, password)
}
if h.user == nil || h.user.Channels == nil {
View
6 rest/rest.go
@@ -377,7 +377,11 @@ func (h *handler) handleChanges() error {
if filter != "sync_gateway/bychannel" {
return &base.HTTPError{http.StatusBadRequest, "Unknown filter; try sync_gateway/bychannel"}
}
- userChannels = channels.SimplifyChannels(strings.Split(h.getQuery("channels"), ","), true)
+ channelsParam := h.getQuery("channels")
+ if channelsParam == "" {
+ return &base.HTTPError{http.StatusBadRequest, "Missing 'channels' filter parameter"}
+ }
+ userChannels = channels.SimplifyChannels(strings.Split(channelsParam, ","), true)
}
switch h.getQuery("feed") {

No commit comments for this range

Something went wrong with that request. Please try again.