Commit Graph

1450 Commits

Author SHA1 Message Date
Tobias Weingartner
61c7a51bfa Errant commented import. 2016-05-01 16:50:25 -07:00
Tobias Weingartner
45e783c3f9 Fix headers and unexport plaintext renderer. 2016-05-01 16:45:24 -07:00
Tobias Weingartner
2bccc1466e Fixup and address most of the feedback. 2016-04-30 20:09:25 -07:00
Tobias Weingartner
a3af232dc5 Use http.MethodGet instead of "GET". 2016-04-30 17:06:46 -07:00
Tobias Weingartner
04089c533b Return errors. 2016-04-30 17:04:44 -07:00
Tobias Weingartner
e0bc426050 Initial re-add of markdown summary functionality. 2016-04-30 17:01:31 -07:00
Tobias Weingartner
bd2a33dd14 Europeans know time. :) 2016-04-30 14:21:30 -07:00
Tobias Weingartner
20dfaab703 Nuke unused function. 2016-04-30 14:16:19 -07:00
Tobias Weingartner
249c9a17f5 Make default template more readable/clean. 2016-04-30 14:07:42 -07:00
Tobias Weingartner
c431a07af5 Merge branch 'master' into md_changes 2016-04-30 13:33:47 -07:00
William Bezuidenhout
e2234497b7 proxy: Add, remove, or replace upstream and downstream headers (closes #666) (PR #788)
* Overwrite proxy headers based on directive

Headers of the request sent by the proxy upstream can now be modified in
the following way:

Prefix header with `+`: Header will be added if it doesn't exist
otherwise, the values will be merge
Prefix header with `-': Header will be removed
No prefix: Header will be replaced with given value

* Add missing formating directive reported by go vet

* Overwrite up/down stream proxy headers

Add Up/DownStreamHeaders to UpstreamHost

Split `proxy_header` option in `proxy` directive into `header_upstream`
and `header_downstream`. By splitting into two, it makes it clear in
what direction the given headers must be applied.

`proxy_header` can still be used (to maintain backward compatability)
but its assumed to be `header_upstream`

Response headers received by the reverse proxy from the upstream host
are updated according the `header_downstream` rules.
The update occurs through a func given to the reverse proxy, which is
applied once a response is received.

Headers (for upstream and downstream) can now be modified in
the following way:

Prefix header with `+`: Header will be added if it doesn't exist
otherwise, the values will be merge
Prefix header with `-': Header will be removed
No prefix: Header will be replaced with given value

Updated branch with changes from master

* minor refactor to make intent clearer

* Make Up/Down stream headers naming consistent

* Fix error descriptions to be more clear

* Fix lint issue
2016-04-30 13:41:30 -06:00
Matthew Holt
96425f0f40
Fix vet failing on Go tip 2016-04-30 11:13:04 -06:00
Matthew Holt
d05dac8d2e Little bit of housekeeping 2016-04-27 12:52:00 -06:00
Matt Holt
81e26970a3 proxy: Move handling of headers around to prevent memory usage spikes (#784)
* Move handling of headers around to prevent memory use spikes

While debugging #782, I noticed that using http2 and max_fails=0,
X-Forwarded-For grew infinitely when an upstream request failed after
refreshing the test page. This change ensures that headers are only
set once per request rather than appending in a time-terminated loop.

* Refactor some code into its own function
2016-04-27 12:50:18 -06:00
W. Mark Kubacki
f561dc0bc1 browse: Serve a datetime format the IE11 and Firefox understand
Another new safeguard is that we check whether the datetime has been read
correctly. If not then the listing will not be localized.

closes #793
2016-04-27 19:24:42 +02:00
Matthew Holt
21382702d2
Update readme version, 0.8.3 2016-04-26 09:28:05 -06:00
Matthew Holt
e97649493b
Update change log; version 0.8.3 2016-04-26 08:36:59 -06:00
Matthew Holt
19d6f666aa
Fix build script with default git repo path (cwd) 2016-04-25 22:10:16 -06:00
W. Mark Kubacki
6f5cff5393 tls: Prevent Go stdlib from overwriting our very first tls ticket key (#785)
[1] 57e459e02b/src/crypto/tls/common.go (L424)
[2] 57e459e02b/src/crypto/tls/common.go (L392-L407)

[2] has overwritten the first tls ticket key on round N=0, that has previously
been written using [1].

Go's stdlib does not use c.sessionTicketKeys≥1 as indicator if those values had
already been set; initializing that lone SessionTicketKey does the job for for
now.
    If c.serverInit() were called in round N+1 all existing tls ticket keys
would be overwritten (in round N<4 except the very first one, of course).
As member variables of tls.Config are read-only by then, we cannot keep
updating SessionTicketKey as well.

This has been escalated to Go's authors with golang/go#15421 here:
https://github.com/golang/go/issues/15421

Thanks to Matthew Holt for the initial report!
2016-04-23 17:49:48 +02:00
Matthew Holt
5c96ee1d9c
Fix bug in renewing default certificate 2016-04-22 10:14:56 -06:00
W. Mark Kubacki
3c578dfbc1 Catch whitespace code style violations locally (#774)
Those settings enforce convergence on common coding style with respect to whitespace.

Do not use tabs to indent with shell scripts because those tabs most often
serve the function of triggering command completion. Which could end a
command before it is pasted completely.
  Traditionally indentation is two spaces here, not four.

Other rules will catch stray whitespace at the end of lines or files, which,
once committed, would annoy the next developer because his editor would strip
them from lines he did not intended to modify in the first place.
2016-04-20 16:56:57 +02:00
Abiola Ibrahim
a093aea797 Merge pull request #773 from eliasp/patch-1
Typ (creatation → creation)
2016-04-20 14:52:14 +01:00
Elias Probst
9f1762873a Typ (creatation → creation) 2016-04-20 13:08:31 +02:00
Matt Holt
c3417a0757 Merge pull request #772 from mholt/fix-browse
Make Browse Great Again ★★★
2016-04-19 10:16:08 -06:00
W-Mark Kubacki
72bc6932b0 browse: Jail the root directory using http.Dir() 2016-04-19 03:48:27 +02:00
W-Mark Kubacki
a41e3d2515 browse: Use JavaScript to localize the shown datetime
The datetime format is whatever the user sets in his/her browser or OS.

This converts timezones.

Tested with Chrome 50 and Internet Explorer 11.
2016-04-19 03:48:27 +02:00
W-Mark Kubacki
7f35600b28 browse: Emit datetime in UTC instead of the server's timezone
Makes sure the view is the same no matter where a site is hosted.
2016-04-19 00:56:47 +02:00
W-Mark Kubacki
cc6aa6b54b browse: Remove whitespace from template's output, annotate output
Fixes a surplus — next to "go up".

Identifies the preamble as the table's summary.

Emits filesizes in bytes, which can be consumed by any browser-side scripts
or utilized in sorting when the table is copy-and-pasted into a spreadsheet
software.

Uses <time> along with proper datetime representation, which a browser could
utilize to display the datetime rendered according to the requestor's locale.
2016-04-19 00:20:44 +02:00
W-Mark Kubacki
239f6825f7 browse: When sorting by size, offset directories
Assigns negative sizes to directories in order to have them listed reliably
before any zero-sized files. That order is what most users expect when
sorting by size.

As side effect directories will appear before files on all filesystem
implementations. To give an example: before this change directories had a size
of 4 KiB when using Linux with ext4 or tmpfs, and with ZFS a size resembling
an estimation of the number of leaves within said directory.
2016-04-19 00:20:44 +02:00
W-Mark Kubacki
1d38d113f8 browse: Move predicate 'limit' to ServeListing
This keeps the interface of all available formatters honest,
and allows for truncated listings all formats.
2016-04-19 00:20:44 +02:00
W-Mark Kubacki
6908136092 browse: Split ServeHTTP into small specialized functions 2016-04-19 00:20:44 +02:00
Matt Holt
da016f8d5a Merge pull request #760 from Burmudar/hostname-placeholder
Add hostname placeholder. Headers use replacer
2016-04-18 15:54:31 -06:00
W. Mark Kubacki
2f2d357fb6 browse: Fix known bugs (#770)
* browse: Catch the case of a directory disappearing before having been read

* browse: Revert to old pass-through behaviour

PROPFIND is a request for an alternate view on a directory's contents, which
response is indeed not implemented but ideally allowed to ask for.
OPTIONS would ideally return (at least) what methods the requestor could use,
which is an allowed request method, too.

This addresses #767.
2016-04-18 11:42:36 -06:00
Matthew Holt
924b53eb3c Minor changes 2016-04-18 09:43:28 -06:00
Tobias Weingartner
2b51be7fd7 Better error message. (#768)
* Fix PrivateKeyBytes to error out and fail tests on error.

* Better error message.
2016-04-17 15:15:14 -06:00
Tobias Weingartner
376e1090a3 Fix PrivateKeyBytes to error out and fail tests on error. 2016-04-17 14:17:42 -06:00
Tobias Weingartner
dd4de698cf Better search for config.
Handle LastModifiedHeader better.
Handle HEAD/GET.
2016-04-17 10:58:51 -07:00
elcore
a682100c5e Merge pull request #765 from mholt/elcore-error-ecdsa
Error if we are unable to marshal the ECDSA private key
2016-04-17 18:40:02 +02:00
elcore
aba3d37c88 Error if we are unable to marshal the ECDSA private key 2016-04-17 18:19:41 +02:00
W. Mark Kubacki
0890e330e2 Merge pull request #759 from mholt/paths-cleanup
Tell usage of 'path' from 'filepath' and fix *path checking
2016-04-17 14:16:57 +02:00
Tobias Weingartner
19a85d08c6 Merge branch 'master' into md_changes 2016-04-16 19:43:50 -07:00
Tobias Weingartner
5a0d373fcd Missed fixing setup. 2016-04-16 17:13:13 -07:00
Tobias Weingartner
ecf91f525f Fix gofmt -s and ineffassign. 2016-04-16 17:07:06 -07:00
Tobias Weingartner
b541c717ca Add ability to markdown a directory with a template. 2016-04-16 16:50:45 -07:00
W-Mark Kubacki
c05c5163e2 browse: Don't leak Cookies to sessions in HTTP from HTTPS 2016-04-17 01:16:17 +02:00
W-Mark Kubacki
3513b6f2f7 fileserver: When out of filedescriptors, spread retry attempts 2016-04-17 01:16:17 +02:00
W-Mark Kubacki
4a6121f989 Tell usage of 'path' from 'filepath' and fix *path checking 2016-04-17 01:16:16 +02:00
Tobias Weingartner
e652d12cfc Move Metadata load into NewMetadata function. 2016-04-16 15:36:52 -07:00
Tobias Weingartner
b97a7909d8 Nuke more redundant things. 2016-04-16 15:18:17 -07:00
Tobias Weingartner
7c9867917a Fixup tests and move metadata into own package 2016-04-16 14:45:32 -07:00