From 9bad75cb9531c5f02431bef91e38788758de5dce Mon Sep 17 00:00:00 2001 From: Brett Slatkin Date: Sun, 4 Dec 2011 14:00:38 -0800 Subject: [PATCH 1/4] AE blobserver working locally with dev-camput Change-Id: I3dde1bf7fe3cb15e49f2b0ec4a99f85a24497f32 --- dev-appengine | 9 ++++++++- server/go/appengine/camli/appengine/main.go | 8 ++++++-- server/go/appengine/config.json | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dev-appengine b/dev-appengine index 7d84d1b77..6e955701e 100755 --- a/dev-appengine +++ b/dev-appengine @@ -5,13 +5,15 @@ use FindBin qw($Bin); use Getopt::Long; sub usage { - die "Usage: dev-appengine [--wipe] [-a] -- [other_dev_appserver_opts]"; + die "Usage: dev-appengine [--wipe] [-a] [-p port] -- [other_dev_appserver_opts]"; } my $opt_wipe; +my $opt_port; my $opt_all; # listen on all interfaces GetOptions("wipe" => \$opt_wipe, "all" => \$opt_all, + "p=i" => \$opt_port, ) or usage(); my $sdk = readlink("$Bin/appengine-sdk") @@ -29,6 +31,11 @@ if ($opt_all) { if ($opt_wipe) { push @args, "--clear_datastore"; } +if ($opt_port) { + push @args, "-p $opt_port"; +} else { + push @args, "-p 3179"; +} push @args, @ARGV; push @args, "$Bin/server/go/appengine"; diff --git a/server/go/appengine/camli/appengine/main.go b/server/go/appengine/camli/appengine/main.go index 341164004..1aaa9a8bd 100644 --- a/server/go/appengine/camli/appengine/main.go +++ b/server/go/appengine/camli/appengine/main.go @@ -82,8 +82,12 @@ func realInit(w http.ResponseWriter, r *http.Request) bool { // Update the config to use the URL path derived from the first App Engine request. // TODO(bslatkin): Support hostnames that aren't x.appspot.com - // TODO(bslatkin): Support the HTTPS scheme - baseURL := fmt.Sprintf("http://%s/", r.Header.Get("X-Appengine-Default-Version-Hostname")) + scheme := "http" + if r.TLS != nil { + scheme = "https" + } + + baseURL := fmt.Sprintf("%s://%s/", scheme, appengine.DefaultVersionHostname(ctx)) ctx.Infof("baseurl = %q", baseURL) config.Obj["baseURL"] = baseURL diff --git a/server/go/appengine/config.json b/server/go/appengine/config.json index 3dcd7c874..d407a3723 100644 --- a/server/go/appengine/config.json +++ b/server/go/appengine/config.json @@ -1,6 +1,6 @@ { "_for-emacs": "-*- mode: js2;-*-", "baseURL": "*** Populated by runtime. Ignore this.", - "auth": "userpass:foo:bar", + "auth": "userpass:camlistore:pass3179", "prefixes": { "/ui/": { From 1272ff17e9013af0dc30e02044a9004bfd62427c Mon Sep 17 00:00:00 2001 From: Brett Slatkin Date: Sun, 4 Dec 2011 14:10:35 -0800 Subject: [PATCH 2/4] AE: Fix typo in remove.go Change-Id: I065066b2b8d9c4c728fce150348254730d1aecd5 --- lib/go/camli/blobserver/handlers/remove.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/go/camli/blobserver/handlers/remove.go b/lib/go/camli/blobserver/handlers/remove.go index 773225f96..ee1d6525b 100644 --- a/lib/go/camli/blobserver/handlers/remove.go +++ b/lib/go/camli/blobserver/handlers/remove.go @@ -45,7 +45,7 @@ func handleRemove(conn http.ResponseWriter, req *http.Request, storage blobserve configer, ok := storage.(blobserver.Configer) if !ok { conn.WriteHeader(http.StatusForbidden) - fmt.Fprintf(conn, "Remove handler's blobserver.Storage isn't a blobserver.Configuer; can't remove") + fmt.Fprintf(conn, "Remove handler's blobserver.Storage isn't a blobserver.Configer; can't remove") return } if !configer.Config().IsQueue { From db13cfe6a103503a74d3b0b03a0eebff38f6936d Mon Sep 17 00:00:00 2001 From: Brett Slatkin Date: Sun, 4 Dec 2011 14:16:19 -0800 Subject: [PATCH 3/4] AE script: Fixing perl opt escaping Change-Id: Ibd1825ca2dc4661d07e9dbcc6deca93b9679b709 --- dev-appengine | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dev-appengine b/dev-appengine index 6e955701e..81d85ec2f 100755 --- a/dev-appengine +++ b/dev-appengine @@ -32,9 +32,9 @@ if ($opt_wipe) { push @args, "--clear_datastore"; } if ($opt_port) { - push @args, "-p $opt_port"; + push @args, "-p", "$opt_port"; } else { - push @args, "-p 3179"; + push @args, "-p", "3179"; } push @args, @ARGV; @@ -43,4 +43,3 @@ push @args, "$Bin/server/go/appengine"; print "\$ @args\n"; exec(@args); - From 894c3c66ae9437e87e37f5c5eb114b2e3be1be63 Mon Sep 17 00:00:00 2001 From: Brett Slatkin Date: Sun, 4 Dec 2011 14:35:26 -0800 Subject: [PATCH 4/4] Moves sync module into lib/go/server Change-Id: Iccf8674712f4ecb70d9eb28e8316d151a88e842f --- {server/go/camlistored => lib/go/camli/server}/sync.go | 2 +- server/go/appengine/camli/misc/countingreader.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) rename {server/go/camlistored => lib/go/camli/server}/sync.go (99%) create mode 120000 server/go/appengine/camli/misc/countingreader.go diff --git a/server/go/camlistored/sync.go b/lib/go/camli/server/sync.go similarity index 99% rename from server/go/camlistored/sync.go rename to lib/go/camli/server/sync.go index 93b47f1df..4a5c51c8f 100644 --- a/server/go/camlistored/sync.go +++ b/lib/go/camli/server/sync.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package main +package server import ( "fmt" diff --git a/server/go/appengine/camli/misc/countingreader.go b/server/go/appengine/camli/misc/countingreader.go new file mode 120000 index 000000000..d59289e88 --- /dev/null +++ b/server/go/appengine/camli/misc/countingreader.go @@ -0,0 +1 @@ +../../../../../lib/go/camli/misc/countingreader.go \ No newline at end of file