Commit Graph

213 Commits

Author SHA1 Message Date
pancho horrillo
ec227c2ba3 fix: don't flush status immediately
Closes: #148

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2021-01-11 17:54:54 +01:00
pancho horrillo
68a25e68b8 feat: kapow server <initprgs> honors --debug
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2020-12-24 14:16:39 +01:00
pancho horrillo
26fa12c871 doc: drop mentions to .pow files ($deity REST their soul)
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2020-12-24 14:03:49 +01:00
pancho horrillo
e72c65c859 feat: os-dependent default entrypoint
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2020-12-24 14:03:49 +01:00
Roberto Abdelkader Martínez Pérez
0c16b5472f feat: run multiple init programs
- We log their outputs and status codes
- Windows is supported as well, leveraging cmd.exe /c

Co-authored-by: pancho horrillo <pancho.horrillo@bbva.com>
2020-12-24 14:03:25 +01:00
pancho horrillo
7c4e32a34b feat: add /server/log/{prefix} endpoint
/{prefix} is optional

Sample usage: kapow set /server/log/myapp "$msg"

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2020-12-18 11:48:25 +01:00
pancho horrillo
4d05223224 feat: Access Logging on the user server
Closes: #98

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2020-12-17 16:30:55 +01:00
pancho horrillo
41be4f9344 refactor: use a common logger for consistency
All kapow messages will end up in stderr (incl. debug mode).
stdout is reserved for the access logs.

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2020-12-16 17:29:26 +01:00
pancho horrillo
d62a9dba68 chore: Remove unused code
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2020-12-16 16:41:49 +01:00
pancho horrillo
4546fc65b6 fix: honor global flag --debug
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2020-12-15 18:59:29 +01:00
pancho horrillo
58fae53e2e test: logStream() behaves correctly like a good kiddo
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2020-12-15 18:37:44 +01:00
pancho horrillo
6ec9b54670 fix: add missing spawner reset code to test
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2020-12-15 18:37:44 +01:00
Roberto Abdelkader Martínez Pérez
0dd9cf07ab wip: create pipes to manage entrypoint stdout/stderr even after termination 2020-12-15 18:37:44 +01:00
Héctor Hurtado
c7567fb4cc Fix getSSLClietnDN returns DN instead CN 2020-09-11 11:18:11 +02:00
Héctor Hurtado
a17cc4838d Add ssl/client/i/dn resource. Closes #113 2020-09-10 16:35:41 +02:00
Héctor Hurtado
6d24cc4d2d Fix typo getRequestId -> getRouteId 2020-09-10 12:44:58 +02:00
Héctor Hurtado
9a78bddcc4 Change tests for getRequestId to validate against passed value 2020-09-10 12:41:04 +02:00
Héctor Hurtado
66b227e67b Fix error getting HTTP version in getRequestVersion 2020-09-10 12:30:58 +02:00
Héctor Hurtado
99871de601 Fix error getting remote address in getRequestRemote 2020-09-10 12:07:25 +02:00
Héctor Hurtado
5c1a00e340 getRequestHeaders returns value for Host header. Fixes #78 2020-09-09 14:13:44 +02:00
Héctor Hurtado
6c3bee9ae0 Add route/id resource. Closes #10 2020-09-09 14:12:53 +02:00
Héctor Hurtado
774b9202b5 Add routes for /request/version and /request/remote in data server. Add resource tree documentation for /request/version and /request/remote. Closes #85 2020-09-09 14:11:46 +02:00
Héctor Hurtado
fc19b921be Add request/remote resource 2020-09-09 08:53:40 +02:00
Héctor Hurtado
9988d0e0d4 Add request/version resource 2020-09-08 15:27:51 +02:00
pancho horrillo
975aea88ae fix: prevent spurious stack trace with misbehaving clients
See 9997545a86
and the previous commit.

Co-authored-by: César Gallego Rodríguez <gallego.cesar@gmail.com>
2020-05-11 15:57:25 +02:00
pancho horrillo
13adcc37b6 fix: panic sentinel value if http client misbehaves
When an http client does not consume the whole body, we panic'ed a
custom message instead of the required sentinel value.

For the details, check ¹ and look for ErrAbortHandler.

¹: https://pkg.go.dev/net/http

Co-authored-by: César Gallego Rodríguez <gallego.cesar@gmail.com>
2020-05-11 13:59:09 +02:00
Héctor Hurtado
35376a407b Add missing copyright message to source files 2020-04-22 16:50:10 +02:00
Héctor Hurtado
248f7d1fcc Added stderr output management to jaillover.
Added Spawn support for stderr redirection.
Added --debug option to server cmd.
Added debug information to documentation.
Finnished script logger.
2020-04-20 10:18:16 +02:00
Héctor Hurtado
63a675675a Added clean target to Makefile. Created package logger 2020-04-15 17:52:46 +02:00
Héctor Hurtado
e1788b2874 Default handlers for NotFound and MethodNotAllowed returning json reason added to control y data servers 2020-04-07 12:22:15 +02:00
Héctor Hurtado
4988c48e03 Correct typo assigning KAPOW_CONTROL_URL env variable 2020-04-06 19:38:43 +02:00
Héctor Hurtado
e6e25f25c7 Fix #102 2020-04-06 18:02:29 +02:00
Héctor Hurtado
73ef493f04 cmd/server sets now environment variables KAPOW_DATA_URL and KAPOW_CONTROL_URL
Remove golinter error S1036: unnecessary guard around map access in 
spawn package
2020-04-03 21:42:42 +02:00
Héctor Hurtado
f103b39a94 If CA certificate file is incorrect return an error instead of use default syustem CA store 2020-01-24 11:54:06 +01:00
Héctor Hurtado
cddc5ff351 Fixes #45: Added Support fot Mutual TLS Authentication 2020-01-23 17:39:58 +01:00
Héctor Hurtado
493e6be78c Added support fot https in user server 2020-01-22 17:27:24 +01:00
Héctor Hurtado
a65eb102b2 Fix variable name in spawn function. Added working with json, upload examples and install&configuration documentation 2019-11-20 16:33:18 +01:00
pancho horrillo
206aac5747 Rename package srverrors to httperror
- Package names are preferred to be in singular form¹.
- Since errors are just for HTTP and not generic, I changed the base name to
'http'.
- I didn't name it simply 'error', because it would then conflict with the
- standard 'error' interface.

¹: https://rakyll.org/style-packages/
2019-11-20 07:54:45 +01:00
pancho horrillo
0d66fe9963 Rename WriteErrorResponse() to simply ErrorJSON() and reorder arguments
This way we better mimic net/http.Error()

https://pkg.go.dev/net/http?tab=doc#Error
2019-11-20 07:37:35 +01:00
pancho horrillo
7ea43048bc Add missing comments 2019-11-20 07:14:00 +01:00
pancho horrillo
75b0908b16 Rename GetReasonFromBody() to simply Reason()
See ¹ for the customary idiomatic way of naming getters in Go.

¹: https://golang.org/doc/effective_go.html#Getters
2019-11-20 05:04:10 +01:00
pancho horrillo
3a47b34bc1 Drop stale GetReason() and associated tests 2019-11-20 04:54:07 +01:00
pancho horrillo
b40f73115f Add missing comment to GetReasonFromBody() 2019-11-20 04:51:29 +01:00
pancho horrillo
81c677c3be internal/http/request.go: replace GetReason() with GetReasonFromBody()
Update tests to inject the required JSON error body with reason.
2019-11-19 21:17:49 +01:00
pancho horrillo
e7619238ae Add GetReasonFromBody() that extracts reason from JSON 2019-11-19 21:17:34 +01:00
pancho horrillo
83e4523dc7 Simplify files via gofmt -s (thanks, Go Report Card!) 2019-11-19 14:14:55 +01:00
pancho horrillo
92fbb72735 Fix typos catched via misspell (thanks Go Report Card!) 2019-11-19 14:07:58 +01:00
Héctor Hurtado
7bca5b8577 New error handling added to module resource in package data. Minor coding improvements. 2019-11-18 19:09:55 +01:00
pancho horrillo
1249b23458 Fix case mismatch in error JSON (adding tag) 2019-11-18 17:44:39 +01:00
Héctor Hurtado
4c7eae8ebb New error handling added to getRequestBody function in data package 2019-11-18 15:01:02 +01:00