kim (grufwub)
43ddf00b36
massively improve code commenting, fix SkipPrefixWriter bug
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-08 16:52:17 +01:00
kim (grufwub)
6576d436f7
move constants to config (user modifiable), support CGI header stripping
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-07 17:08:06 +01:00
kim (grufwub)
c7ae3fd151
more big changes
...
- Current Request structure renamed to Responder
- Request's RequestPath and Parameters separated into
new Request structure
- Responder sent on calls to render to filecontents,
but creation / caching of filecontents stores onto a
a copy of Request instead (as we don't need the extra host
or client info held by Responder)
- Cached gophermaps now do not cache regular files within them
if inserted, as these files could be over the cache file size
limit
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-07 08:59:53 +01:00
kim (grufwub)
10c9f02eb3
rename connwrapper and gophorconn to make more sense
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-06 21:08:04 +01:00
kim (grufwub)
a6a779aaf0
turn gophorconn --> connwrapper, gophorconn now wraps net.conn with deadline setting
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-06 20:53:07 +01:00
kim (grufwub)
e27f7aea81
modify error sending to use WriteFlush to ensure writer flushed
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-06 18:47:32 +01:00
kim (grufwub)
8dae2abb6f
move struct member usage to instead be struct methods, improve README.md
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-06 11:38:53 +01:00
kim (grufwub)
3a41efcc5b
huge changes
...
- massively improve request handling -- passes request object between
functions now to encapsulate all the data needed
- writing is now handled by the passed request object with attached
writer
- files > max cached file size and fed directly to socket now instead
of read into buffer first (which would have caused MAJOR memory issues)
- CGI support further fleshed out, and timer started for child processes
that attempts to kill them if they don't clean up in time
- probably many more fixes i'm forgetting
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-05 23:46:50 +01:00
kim (grufwub)
6ac26c2225
further fixes to CGI 1.1 implementation
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-04 20:00:53 +01:00
kim (grufwub)
6cd6adecca
move requestpath contents into filesystemrequest, which is passed everywhere instead of individual variables
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-04 18:19:56 +01:00
kim (grufwub)
eac520031a
inline shell commands, executable gophermaps, initial cgi-bin support
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-03 22:42:51 +01:00
kim (grufwub)
41d6f279fc
replace logging system + add support for log options + toggleable output
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-02 22:34:49 +01:00
kim (grufwub)
9e3dfe50ad
set abspath to be calculated at RequestPath creation
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-02 10:36:02 +01:00
kim (grufwub)
ac20b9d6b3
move RootDir variable to be stored in ConnHost (will help with virtual hosts in future)
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-02 08:42:12 +01:00
kim (grufwub)
0893652b65
add RequestPath to handle relative+absolute paths, move sanitization logic here
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-05-01 15:08:47 +01:00
kim (grufwub)
5dca694849
remove newline after URL redirect log, add access errors
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-30 12:26:45 +01:00
kim (grufwub)
e348ab2c35
rework 'readUpToFirstTabOrCrlf' logic to include UnixLineEnd (clients using this instead of CrLf :/)
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-30 12:06:22 +01:00
kim (grufwub)
d95316cb04
modify HTML redirect access log print (double printed 'URL')
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-30 11:33:01 +01:00
kim (grufwub)
1c119afa1c
move worker constants to constants.go, filetype type defintion to filesystem.go
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-30 10:48:24 +01:00
kim (grufwub)
4fdd45855d
fix worker logging to system instead of access log + root dir fetch failing
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-29 23:21:20 +01:00
kim (grufwub)
06eca4d50a
major rework to worker response logic
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-29 18:28:51 +01:00
kim (grufwub)
3de53f5f25
small formatting changes, remove extra goroutine spawned in Worker.Serve()
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-25 18:38:26 +01:00
kim (grufwub)
0f2a2099f2
improve code commenting
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-24 12:09:54 +01:00
kim (grufwub)
13878b4310
reformat passing of connhost to instead now use FileSystemRequest
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-24 11:21:46 +01:00
kim (grufwub)
3fb83b520e
update file logic to pass 'connHost' when rendering contents, ready for TLS / virtual hosts
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-23 20:39:31 +01:00
kim (grufwub)
b79bcf562d
begin rework use of conn interfaces to hold onto host info, will be useful for TLS
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-23 09:29:58 +01:00
kim (grufwub)
c45d62899c
rework the configuration and program flag setting system
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-22 19:42:54 +01:00
kim (grufwub)
102df8039f
rework listDir function, stop root directory showing as '.' after path.Clean()
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-22 13:41:27 +01:00
kim (grufwub)
3077661510
fixes to request parsing
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-20 17:30:01 +01:00
kim (grufwub)
e37898019c
better error responding, move regex matching to listDir(), ...
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-20 15:18:35 +01:00
kim (grufwub)
5074fcce5c
various fixes to autogenerated policy files etc
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-19 21:28:15 +01:00
kim (grufwub)
b953fe846c
add in support for new flags referenced in policy.go
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-19 20:46:14 +01:00
kim (grufwub)
5b18a9756f
add support for DOS or Unix line endings in all files
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-17 18:51:30 +01:00
kim (grufwub)
7b834eb479
refactor most of file reading/caching code to use one global cache
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-17 16:39:25 +01:00
kim (grufwub)
d87e974c6b
add TODO comments + remove unused global constant
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-15 19:41:00 +01:00
kim (grufwub)
2c9d68c2ac
minor bug fixes during serving of gophermap / dir listings
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-15 10:52:03 +01:00
kim (grufwub)
965ea4e089
add last-line to reponse (somehow lost this in big changes...)
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-13 14:46:13 +01:00
kim (grufwub)
16f754a884
file-cache implementation now working! pushing files out of cache TBA
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-13 14:39:35 +01:00
kim (grufwub)
e3e07948f1
separate out into separate files, first work towards file caching system
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-13 13:15:12 +01:00
kim (grufwub)
352bcb67f6
big code refactoring + work on supporting new item types
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-12 21:32:09 +01:00
kim (grufwub)
62b59a5d6d
add support for some auto-formatting of gophermap files
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-12 16:12:56 +01:00
kim (grufwub)
ab5584ecfd
only append LastLine to dir listings, not file.
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-12 09:09:06 +01:00
kim (grufwub)
bb63109755
small formatting changes + efficiency improvements to worker
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-11 21:42:41 +01:00
kim (grufwub)
0cb0946f80
change name client->worker, more type standards+comments, improved error sending
...
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
2020-04-11 19:32:35 +01:00