Граф коммитов

517 Коммитов

Автор SHA1 Сообщение Дата
Dmitri Shuralyov 8b031907f2 doc: factor out redirect logic from newPackage to gosrc.MaybeRedirect
This is a refactor to bring the redirect check into a small dedicated
function within gosrc. It can be tested more directly/easily.

Change-Id: Ib9c907bae00384c1f7fef74146b19b715976c546
Reviewed-on: https://go-review.googlesource.com/134475
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-09-11 17:57:31 +00:00
Dmitri Shuralyov ee3b7b11ec doc: don't redirect vanity packages to GitHub
This change fixes a regression from CL 120059. We started to redirect
to GitHub's reported canonical case when the request path didn't
match too aggressively. It should only be done if the request path is
already on GitHub; otherwise we're redirecting a vanity import path to
its GitHub hosting location whenever it doesn't have an import path
comment.

Add tests for this newPackage redirection behavior to increase
confidence in the fix, and help avoid future regressions.

Fix typos in gosrc package comments.

Fixes golang/gddo#579.

Change-Id: I7ed0787a125d2f39ca979d01983e971729e181fd
Reviewed-on: https://go-review.googlesource.com/134355
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-09-11 02:46:56 +00:00
Martin Tournoij 656e7e11a7 gosrc: add missing context parameters to print.go
Support for the context package was added in baa18d8, but the
gosrc/print.go debug utility was never updated, and since it has the
ignore build tag go test etc. didn't catch this.

This will not affect godoc.org operation; it's just a debug utility for
developers; it was helpful for me in examining #576.

Change-Id: Ie48ede8b1a54289d5dd848c4ca7867fd9ca38a02
GitHub-Last-Rev: ad319e617b
GitHub-Pull-Request: golang/gddo#577
Reviewed-on: https://go-review.googlesource.com/132655
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-09-05 15:03:33 +00:00
Dmitri Shuralyov 96d2a289f4 doc: add js/wasm GOOS/GOARCH env pair
Go 1.11 adds an experimental WebAssembly port. The port uses
new GOOS=js GOARCH=wasm values. Some packages, such as syscall/js,
are implemented only for js/wasm environment, so this needs to be
one of the environments to try in order for its documentation to
be available.

Updates golang/gddo#572.

Change-Id: I35b6eae735602e7387beacff07f2b7d6fe323314
Reviewed-on: https://go-review.googlesource.com/131343
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-08-28 05:16:04 +00:00
Dmitri Shuralyov c32df13dda gosrc: regenerate with Go 1.11
This change regenerates the list of standard packages to contain
packages that are new to Go 1.11, which has been recently released.

It was done by running:

	go generate ./gosrc

Updates golang/gddo#572.

Change-Id: Iaefbd8e7119b9bfb46944e137da652c6209e7231
Reviewed-on: https://go-review.googlesource.com/131342
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-08-28 05:15:30 +00:00
Martin Tournoij 9d8ff1c67b improve redirection to canonical import path
Problem:

Our GitHub organisation is named Teamwork, but for various hard to
change reasons we import packages as teamwork (lower case t). To enforce
this we add an import enforcement for our packages:

	package duck // import "github.com/teamwork/duck"

This works well, but godoc.org enforces users to use the canonical
GitHub path (Teamwork), but with the import statement the Go compiler
enforces a different path, leading to an error.

Fix:

Instead of immediately redirecting in the gosrc package, it will now
only store the canonical import path there. This is before the Go source
code is actually scanned, so we don't *actually* know what the real
canonical path should be.

In the doc.newPackage() function it will check for the canonical import
path, taking both the Go import path as well as the reported path from
the gosrc package in to account, and redirect as needed.

This seems to work for all the cases I can think of:

    github.com/Teamwork/validate    -> github.com/teamwork/validate
    github.com/pkg/ERRORS           -> github.com/pkg/errors
    github.com/Carpetsmoker/sconfig -> arp242.net/sconfig
    arp242.net/SCONFIG              -> not found (expected)
    bitbucket.org/pkg/inflect       -> works
    bitbucket.org/pkg/INFLECT       -> works (should probably redirect too)
    github.com/docker/docker/client -> works (#534)
    github.com/moby/moby/client     -> redirects (on master this actually seems to error out?)

It should also be easy to add a similar check for for some other repo
providers, such as BitBucket, GitLab, etc.

Fixes #507

Change-Id: I49c5ccb328694f95dd7a0e5d577297d56d88893f
GitHub-Last-Rev: 28efc37564
GitHub-Pull-Request: golang/gddo#560
Reviewed-on: https://go-review.googlesource.com/120059
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-08-23 22:19:19 +00:00
Dmitri Shuralyov 3a2d59ca57 gddo-server: revert "hide internal packages"
This reverts commit 9b12a26f3f (CL 90855).

CL 90855 applied a change to fix issue golang/gddo#402, but caused a
regression golang/gddo#533. The regression led to an earlier version
of gddo to be redeployed.

There was an attempt to resolve issue golang/gddo#533 in CL 93196,
which was later picked up and resent as CL 130496.

Tuo and I reviewed CL 130496 and its behavior, and found that
it was not a satisfactory resolution. It introduced additional
complexity and was better in some contexts and situations, but
worse in others. The main downside is that it made it less clear
why some internal packages were being hidden in some places but
not other places.

To fully resolve the original golang/gddo#402, we will need to
come up with and evaluate a more complete plan of action. Until
then, we want to restore the source code to a state which can be
deployed, so take the short term action of reverting the original
CL and go back to a simple and functional behavior: always display
all packages.

Updates golang/gddo#402.
Fixes golang/gddo#533.

Change-Id: I8fb6ac05aa6f118e740e27eaec1bcf2fc9d32766
Reviewed-on: https://go-review.googlesource.com/130937
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-08-23 14:53:33 +00:00
Dmitriy a475e03076 Update http links to https
Change-Id: Ie2de4c427f234495c77b57ea0ce31cf41fa46ff1
GitHub-Last-Rev: e2d1d79ba3
GitHub-Pull-Request: golang/gddo#568
Reviewed-on: https://go-review.googlesource.com/126575
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-07-28 00:57:09 +00:00
Tuo Shan daffe1f90e gosrc: validate repo from meta
Fixes CVE-2018-12976.

Change-Id: I6b87ab692915d46ba4f668ab848473de9b054c8a
Reviewed-on: https://go-review.googlesource.com/121358
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-07-03 17:44:36 +00:00
Paul Jolly 9ab275bde8 gosrc: add minimal support for vgo-aware modules
Currently, gddo assumes that there will be just one go-import HTML meta
tag when resolving a custom import's VCS repository. vgo introduces a
special new go-import meta tag to identify the location of published Go
modules; it has the VCS identifier 'mod'.

https://golang.org/issue/25140 and https://golang.org/issue/25139 added
minimal awareness to the Go 1.9 and 1.10 branches for the vgo transition
that will start in Go 1.11. Part of this backported support is to ignore
the module special go-import meta tag which has a 'mod' vcvs type:

https://go-review.googlesource.com/c/go/+/115298/4/src/cmd/go/internal/get/discovery.go

Per https://golang.org/issue/25069, the 'mod' vcs type is used by 'new'
Go code to identify where published modules can be fetched.

As a first minimal step we can make gddo "aware" in the same way that Go
1.9 and 1.10 are "aware" of these published modules by simply ignoring
that go-import meta tag.

Later gddo CLs will likely need to enhance support for vgo, but this is
a sufficient first step.

Fixes #558

Change-Id: Ibddfcc8e0a663792da206a244e5cffb8c68fe894
Reviewed-on: https://go-review.googlesource.com/120817
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-06-27 22:11:37 +00:00
Mike Kabischev 574849d519 cloud.google.com/go/pubsub added to vendor
Fixes #553
I've added `cloud.google.com/go/pubsub` to vendor to avoid problem with double http handlers registrations.

Change-Id: I0ea6cebdc8547b53ae4dd8801a4bd89547e4f2b7
GitHub-Last-Rev: 0cb2eab2e3
GitHub-Pull-Request: golang/gddo#557
Reviewed-on: https://go-review.googlesource.com/116417
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-06-21 22:15:06 +00:00
Suriyaa Sundararuban 3afa281c27 lintapp: use HTTPS protocol
Change-Id: Ie8f47a410ab568ebcfb308db1c4fe060e1479614
Reviewed-on: https://go-review.googlesource.com/118576
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 15:28:26 +00:00
Suriyaa Sundararuban f4a8462fcc gddo-server: use HTTPS protocol
Change-Id: Ic69e98d709640fe572ba3019f80d62dd7bd1a07d
Reviewed-on: https://go-review.googlesource.com/118575
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 15:28:04 +00:00
David Symonds a154dc8b46 gddo-server: fix bogus comment
This was accidentally left behind in abcff89 during review.

Change-Id: Ia259269a56e37754f4faf793b13deb9a918359a1
Reviewed-on: https://go-review.googlesource.com/114975
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-05-29 06:41:06 +00:00
David Symonds abcff8962b gddo-server: publish crawl events to a Pub/Sub feed
Change-Id: I55d798a8be5ca1b05375d57d011eda3444b0b415
Reviewed-on: https://go-review.googlesource.com/114775
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-05-29 06:05:04 +00:00
Frederik Ring 416d5fc8c9 gddo-server: do not 404 when URL contains unknown query parameters
Currently, the server sends a 404 when the URL contains query parameters
unknown to the application. Instead, ignore the parameters. Fixes #500

Change-Id: I4478118311ee57c2f4adcb28fcdfff98357d0c39
GitHub-Last-Rev: f2754463e0
GitHub-Pull-Request: golang/gddo#548
Reviewed-on: https://go-review.googlesource.com/103400
Reviewed-by: Dmitri Shuralyov <dmitri@shuralyov.com>
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-03-30 18:00:52 +00:00
Parker Moore 6d3df77eef gddo-server: log configuration settings as Debug only
To prevent leaking sensitive data in the normal case, use the Debug
logging level instead of Info when logging credentials.

There are very sensitive pieces of data in the settings, namely GitHub
secrets, Redis database passwords, etc. In the normal case, these are
logged. To prevent accidental leaking of credentials, only print
settings map when logging in Debug mode.

Change-Id: I4144074bf2b26a940fd9bfb4ed695b9112e67521
GitHub-Last-Rev: 70b36f7481
GitHub-Pull-Request: golang/gddo#545
Reviewed-on: https://go-review.googlesource.com/102278
Reviewed-by: Parker Moore <parkrmoore@gmail.com>
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-03-30 17:50:11 +00:00
Andrew Bonventre 052378f547 CONTRIBUTING.md: remove note about not accepting Pull Requests
Updates golang/go#24185

Change-Id: I10753a1e9829a7b2f74c3e9bade62f8a1d4ef9e1
Reviewed-on: https://go-review.googlesource.com/100682
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-14 18:02:51 +00:00
Leigh McCulloch dcea65fd03 talksapp: go-talks.appspot.com => talks.godoc.org
Update references of go-talks.appspot.com to talks.godoc.org, because
the talksapp is hosted on the talks.godoc.org domain now and the old
appspot domain is irrelevant.

Also, some of the references are incorrectly go-talks.appspot.org which
must be a typo, because that domain displays a for sale sign and does
not appear to be owned by Google.

Fixes golang/gddo#532

Change-Id: I8b8ec58e2f2de0e1f2f8d66a6adedc2cb50da754
Reviewed-on: https://go-review.googlesource.com/95256
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-20 18:13:50 +00:00
Tuo Shan 34dd0bc619 gosrc: re-generate Go 1.10 std library
Change-Id: Iba28ae765a527f737bb87ab2b789e3f6741f071f
Reviewed-on: https://go-review.googlesource.com/94875
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-16 22:43:20 +00:00
Daniel Nephin 2d52dba233 gddo-server: fix redirect loop with canonical imports
Only redirect to canonical github project when the requested is a case
insensitive match, but not an exact match to the requested project.
Otherwise projects which have been moved to a new name, but use a
canonical import to the old name will result in a redirect loop.

Change-Id: I350359d802c3c42e47f2247ffee2469d6449eabc
Reviewed-on: https://go-review.googlesource.com/93176
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-02-13 23:56:19 +00:00
Leigh McCulloch a70545fe9a talksapp: Enforce HTTPS
Add redirects from HTTP to HTTPS. Add HSTS header. Update example URLs
to use HTTPS.

Fixes golang/gddo#536

Change-Id: Iffbf1cff8ed0e87a8cae90496907577f410e4444
Reviewed-on: https://go-review.googlesource.com/93276
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-02-13 21:26:12 +00:00
JBD 9b12a26f3f gddo-server: hide internal packages
List internal packages only underneath their direct parent
or whether is browsing the internal package themselves.

Change-Id: I856178b427de2486c17b8f162e64be62bded9272
Reviewed-on: https://go-review.googlesource.com/90855
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-01-30 20:44:05 +00:00
Herbie Ong bc1419aa93 gddo: remove no longer used internal support packages.
Change-Id: I29ef5640e1196a9804e1a2fd6de06541d1fb0049
Reviewed-on: https://go-review.googlesource.com/87895
Reviewed-by: Ross Light <light@google.com>
2018-01-16 22:35:24 +00:00
Herbie Ong 7940e40f71 internal/runtimeconfig: improve test set up of fake server by using port
0 to automatically pick a port.

Change-Id: I6619af41ed18520f1c39256407fa774a660fd513
Reviewed-on: https://go-review.googlesource.com/86076
Reviewed-by: Ross Light <light@google.com>
2018-01-04 20:51:03 +00:00
Herbie Ong e9020e607f Remove travis build/test using 1.8.
Change-Id: I0bb528467effb355c435ec55f792a027ffd41341
Reviewed-on: https://go-review.googlesource.com/86036
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-01-04 01:43:12 +00:00
Herbie Ong 3e1261df12 internal/runtimeconfig: add tests.
Allow user to set any minimum value for wait time > 0.

Change-Id: I61592707f840029c6f401e383d66fd9608b993f5
Reviewed-on: https://go-review.googlesource.com/85655
Reviewed-by: Ross Light <light@google.com>
2018-01-02 23:19:33 +00:00
Tuo Shan 293f5da99e database: cast float and time types in incrementalCounter.
Newer Redis version requires arguments types to be string or integer.

Change-Id: I5f3fba9affda3b0747372da824ca0662cc95a495
Reviewed-on: https://go-review.googlesource.com/78535
Reviewed-by: Ross Light <light@google.com>
2017-11-17 22:08:09 +00:00
Ross Light b04e9d22f1 internal/requestlog: use http.Get instead of s.Client.Get
Same rationale as golang.org/cl/78539.

Change-Id: I32f0f412b3d31d803b554a0cc5df9265e7405796
Reviewed-on: https://go-review.googlesource.com/78541
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 21:57:12 +00:00
Ross Light 768ea9c9e9 internal/health: use http.Get instead of s.Client.Get
httptest.Server.Client was added in Go 1.9, and we want to support Go
1.8+ for App Engine.

Change-Id: I1eb539a69c2dadc85505b181eeeb6e20dd333df7
Reviewed-on: https://go-review.googlesource.com/78539
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 21:49:08 +00:00
Tuo Shan dd0daf836b all: fix travis build pt 2
Added go_appengine directory to PATH.

Change-Id: Iad959c15c1cc62ac31018f3fddb76e348d97c609
Reviewed-on: https://go-review.googlesource.com/78437
Reviewed-by: Ross Light <light@google.com>
2017-11-17 19:35:31 +00:00
Herbie Ong 8b95641ad7 internal/runtimeconfig: initial prototype
Adding initial prototype of runtimeconfig package which provides ability
to be notified of runtime config changes from Cloud Runtime Configurator
service.

Change-Id: Id5765e15bc960fd001286ee14678c5ff8e2ec168
Reviewed-on: https://go-review.googlesource.com/69297
Reviewed-by: Ross Light <light@google.com>
2017-11-17 05:56:38 +00:00
Tuo Shan 5e41e08db6 all: fix travis config for gddo
Change-Id: Ia5fdfe784fa7e47641ab0c02f81415db3eb5039e
Reviewed-on: https://go-review.googlesource.com/78436
Reviewed-by: Ross Light <light@google.com>
2017-11-17 00:42:27 +00:00
Tuo Shan 6bb33fc146 all: fixed broken tests
1. Use cmp package to replace reflect.DeepEqual
2. db.PutIndex and db.DeleteIndex won't return error when remote_api is
not setup, since they are only called inside db.Put and db.Delete.
db.Search remains unchanged since it is called externally.

Change-Id: Ife84f5a98abe721fbb127e497fdae34125d547a1
Reviewed-on: https://go-review.googlesource.com/78435
Reviewed-by: Ross Light <light@google.com>
2017-11-17 00:38:41 +00:00
Ross Light 46b0a98c66 internal/health: new health check package
Currently only serving Redis, but could be used for other GCP gRPC
connections.

Mildly surprising behavior: taking down Redis does not make Pool.Get
return an error: it isn't until sending another request on a connection
before the pool starts failing.  This only matters when testing the
health checks with no load.

Change-Id: Ie720b80a398fd9f7d4aa6ab0c6a88adaa85ccdc9
Reviewed-on: https://go-review.googlesource.com/76750
Reviewed-by: Tuo Shan <shantuo@google.com>
2017-11-10 19:12:07 +00:00
Tuo Shan 6e435af490 vendor: update vendor to pick up trace changes
Change-Id: I497019b66fa94186d0d55a2a1a952234ac7b37f5
Reviewed-on: https://go-review.googlesource.com/76731
Reviewed-by: Ross Light <light@google.com>
2017-11-09 22:19:20 +00:00
Ross Light 9125e5a0ec internal/requestlog: add end-to-end benchmarks
Results from my workstation:

BenchmarkE2E/Baseline-12  	   20000	     85744 ns/op	    5171 B/op	      68 allocs/op
BenchmarkE2E/WithLog-12   	   20000	     98693 ns/op	    6321 B/op	     102 allocs/op

We can expect ~10us CPU and ~1KB RAM of overhead per each request.
Likely fluentd will be the bottleneck at that point.

I dug in with the profiler and the overhead is almost entirely coming
from JSON encoding.  If performances becomes an issue, use of the
encoding/json package could be eschewed for a custom marshaler.

Change-Id: I757740b31d168ac339e4775bf24212ba12329ae9
Reviewed-on: https://go-review.googlesource.com/73770
Reviewed-by: Sarah Adams <shadams@google.com>
2017-10-26 17:57:52 +00:00
Ross Light d536b428ac internal/requestlog: prototype request log middleware
- Request/response body sizes are collected on a streaming basis
  (negligible overhead).
- Header sizes are approximate and only based on what the underlying
  handler sends or receives.  net/http may add extra headers, so headers
  will likely be undercounted.  I don't see a reliable way to address
  this.
- Includes a fluentd logger to send the forward input plugin that is
  open by default in google-fluentd.  I've integration tested this
  middleware locally.  Unit tests verify that the format is correct.
- Hijack/Websocket support is missing.  This is fine for gddo.

Change-Id: I53c006edc1c3004e08c1b7e4b68fa94240f38db6
Reviewed-on: https://go-review.googlesource.com/70790
Reviewed-by: Herbie Ong <herbie@google.com>
2017-10-18 22:40:21 +00:00
Ross Light 2fa06788d5 httputil: remove Transport constructors aware of environment
Each of the servers has slightly different needs for configuring their
outbound HTTP transport.  A little copying is better than a little
dependency.

Notably, the configuration logic in gddo-server is now consistent with
the rest of the configuration-gathering logic.

Change-Id: Ibe7d287a102e20e6e13d97e8a6483d9febab6442
Reviewed-on: https://go-review.googlesource.com/69291
Reviewed-by: Tuo Shan <shantuo@google.com>
2017-10-13 23:46:08 +00:00
Tuo Shan 7957f9b795 all: add basic trace to gddo
This uses Stackdriver trace API to trace search, package requests
as well as background tasks. It also traces outbound requests to
VCS's and remote_api calls.

Change-Id: Ice82c1fbd267eefa4bad9d6674dc39ef10a1c874
Reviewed-on: https://go-review.googlesource.com/68472
Reviewed-by: Ross Light <light@google.com>
2017-10-10 20:11:15 +00:00
Ross Light 376e728d96 httputil: only send client authorization over HTTPS
Might just be a hypothetical concern, but better for this to fail closed
(not send credentials when needed) than to fail open (send credentials
insecurely).

Change-Id: I8542e8c0b533a3c5f53a5f03f4e3b639b6b55f71
Reviewed-on: https://go-review.googlesource.com/69290
Reviewed-by: Tuo Shan <shantuo@google.com>
2017-10-09 20:27:33 +00:00
Ross Light 1e2b1a1a6d gddo-server: replace globals with struct
This is intended to simplify the number of stages of initialization in
gddo-server.  Before this CL, globals and the config may or may not be
correctly initialized at various points of executing methods during
main().  While this largely does not come up because the handlers are
not used until appengine.Main, it can be problematic for background
tasks.  After this CL, handlers (being methods on the server struct) can
depend on server being completely initialized, and the server can depend
on the config being completely initialized.

Change-Id: I1a83a2337a2cdb4d98ec00b26d5e0498ed7e4edd
Reviewed-on: https://go-review.googlesource.com/67290
Reviewed-by: Tuo Shan <shantuo@google.com>
2017-10-03 17:09:54 +00:00
Ross Light d0b0199669 gddo-server: consolidate template initialization
This is in preparation for passing around the template map explicitly
instead of using it as a global.  It also moves the manifest of template
sets into templates.go and out of main.go.

Change-Id: Ic7db8d5ab0186c1f4eb2446871e2c18ae1554d82
Reviewed-on: https://go-review.googlesource.com/67051
Reviewed-by: Tuo Shan <shantuo@google.com>
2017-10-03 16:28:10 +00:00
Ross Light ddb3324051 gddo-server: collect GCE metadata configuration in Viper
Remove the gaAccount global variable in favor of reading from
configuration.

Minor behavior changes:
- The GA_ACCOUNT environment variable will override the GCE metadata
  ga-account, where before it was not being read on GCE.
- The project ID across the program defaults to the one from GCE
  metadata, overridden by the GCLOUD_PROJECT environment variable or the
  command-line flag.  The GCE logger now uses this project ID instead of
  just considering the GCE metadata.
- The GCE log name can now be set using the gddo_gce_log_name
  environment variable.

Change-Id: I0ed2ae7a5130d63146e9bf2746f22980c8a782b9
Reviewed-on: https://go-review.googlesource.com/67050
Reviewed-by: Tuo Shan <shantuo@google.com>
2017-09-29 22:44:37 +00:00
Tuo Shan 9ab519192d talksapp and lintapp: opt in to use Go 1.8 on GAE standard.
Change-Id: I042f74f8592a8907cde93bcfcd1d6b9e52467b8d
Reviewed-on: https://go-review.googlesource.com/67030
Reviewed-by: Ross Light <light@google.com>
2017-09-29 16:31:35 +00:00
Ross Light 8943a5059f gddo-server: parameterize newHTTPClient on Viper config
Change-Id: I32115eecf1689c5d32c080b686df422ddddd0d61
Reviewed-on: https://go-review.googlesource.com/66933
Reviewed-by: Tuo Shan <shantuo@google.com>
2017-09-28 22:49:16 +00:00
Ross Light c0b42450bb gddo-server: refactor runHandler into an http.Handler
Change-Id: I2708a67e045589c5a7d45cf3c182b99876bdeb3c
Reviewed-on: https://go-review.googlesource.com/66932
Reviewed-by: Tuo Shan <shantuo@google.com>
2017-09-28 22:48:52 +00:00
Ross Light f0835b24d4 gddo-server: clarify that TestRobots only checks the regex
There is much more complicated behavior in isRobot based on usage by IP
address.  This isn't being tested, but requires access to the database.
This is in need of a fuller test (as is much of the gddo-server
directory).

Change-Id: I4f3467b30e3ecc83bf72712f01a183bd211adc16
Reviewed-on: https://go-review.googlesource.com/66931
Reviewed-by: Tuo Shan <shantuo@google.com>
2017-09-28 20:07:24 +00:00
Tuo Shan baa18d854f all: propagate context throughout the codebase.
Change-Id: Icdb6f5911e49e121014077067ac8c9a83b0ea8cd
Reviewed-on: https://go-review.googlesource.com/66112
Reviewed-by: Ross Light <light@google.com>
2017-09-28 18:11:49 +00:00
Ross Light d7f7d5f2c5 gddo-server: simplify background tasks with time.Tick
These tasks operate concurrently with the request flow anyway, so each
task should be on its own tick loop.

Change-Id: I129212b297db15395f7852e5b73e66081c63fbd0
Reviewed-on: https://go-review.googlesource.com/66652
Reviewed-by: Tuo Shan <shantuo@google.com>
2017-09-28 15:23:11 +00:00