King_DuckZ
218e9ab6cd
Add a bool to mustache to tell if a pastie got self-destructed.
2017-06-14 20:31:17 +01:00
King_DuckZ
b6edab7171
Implement self-destruct upon read when selfdes=1 in POST
2017-06-14 20:19:18 +01:00
King_DuckZ
8d19c794ed
Extract string conversion functions from SettingsBag.
...
It's useful to have this functionality elsewhere, especially
the string to bool one which I'm going to use in the next
commit.
2017-06-14 19:30:52 +01:00
King_DuckZ
9fc9cf851c
Add page_time token to mustache.
...
That's the elapsed time from program start to
the moment before the final invocation to
mustache rendering. So not super accurate but
that's what I can do for now.
2017-06-14 09:16:30 +01:00
King_DuckZ
131903c607
Rename TawashiException to just Exception.
...
It's in tawashi namespace already.
2017-06-13 09:36:53 +01:00
King_DuckZ
e5f7f60e8b
Change namespace of kamokan-specific stuff.
2017-06-13 09:36:53 +01:00
King_DuckZ
a912b1e3d4
Expose Tawashi's version to mustache.
2017-06-13 09:36:12 +01:00
King_DuckZ
6c357f1dc7
Separate Tawashi and Kamokan.
...
Unit tests are still a bit mixed up, but that should
be simple to split once I have a separate repo for
Tawashi.
2017-06-13 09:36:12 +01:00
King_DuckZ
44350478c1
Version bump to 0.2.3
2017-06-09 00:19:33 +01:00
King_DuckZ
43e97ee79b
Fix data corruption when submitting a pastie.
2017-06-08 23:38:11 +01:00
King_DuckZ
f3868e5b3f
For some reason the incredis test was still enabled on this machine.
2017-06-08 22:56:35 +01:00
King_DuckZ
f6da79a49d
Add an option to ignore pastie tokens that are too long.
...
0 disables the limit.
2017-06-08 22:02:11 +01:00
King_DuckZ
96a349bb8d
Drop ?blabla before calling factory.make_response().
...
This fixes the problem with error.cgi?reason=... being
mistaken for a pastie.
2017-06-08 21:57:09 +01:00
King_DuckZ
5f0ea56241
Log raw pastie from POST and pastie before going to redis.
...
This is to hopefully track down the pastie corruption
bug that I'm only encountering on the outgoing server.
2017-06-08 21:33:18 +01:00
King_DuckZ
b5b0db8b8d
Implement truncated_string().
...
It will either return the full string if its length was
maxlen or less, or up to maxlen characters with
a "..." appended at the end. It will also replace any
\n or \r character with a literal "\n" or "\r"
respectively. Only line breaks are being replaced, and
this happens inside truncated_string() because truncating
only makes sense to me if you want to use it to
keep stuff short and in one single line.
2017-06-08 21:32:04 +01:00
King_DuckZ
5b88afb276
Reject pastie tokens that are not in the a-z range.
2017-06-08 10:15:51 +01:00
King_DuckZ
c3609e1768
Add an array of lines and line numbers to the mustache context.
2017-06-07 21:52:55 +01:00
King_DuckZ
a56014bed8
Fix wrong code that wasn't splitting on ? correctly
2017-06-07 09:38:05 +01:00
King_DuckZ
8795977da9
Extract pastie's token manually from the request uri.
2017-06-07 00:49:44 +01:00
King_DuckZ
108a8c8e06
Use string_view directly with mstch.
2017-06-07 00:40:03 +01:00
King_DuckZ
056e7dcde4
Use stock std::string conversion.
2017-06-07 00:30:43 +01:00
King_DuckZ
eaf8c0778d
Replace string_ref with string_view in test.
2017-06-07 00:18:52 +01:00
King_DuckZ
befbed413a
Delete unused file.
2017-06-06 23:04:52 +01:00
King_DuckZ
6e19745d69
Replace string_ref with string_view
2017-06-06 23:04:40 +01:00
King_DuckZ
df1afc7616
Fix the bug with the pastie token being invalid.
...
REQUEST_URI would return "ba"?cpp for example, but
the code expects just "ba".
2017-06-06 19:55:22 +01:00
King_DuckZ
e44611301c
Fix the problem with redis not being initialized anymore.
2017-06-06 19:40:52 +01:00
King_DuckZ
60bc194848
Add missing include
2017-06-06 09:44:36 +01:00
King_DuckZ
b0c62fcab3
Add HTTP/1.1 to Status in cgi responses.
2017-06-06 00:56:28 +01:00
King_DuckZ
f94cc9409b
Add test for SubmitPasteResponse.
2017-06-06 00:56:01 +01:00
King_DuckZ
974424398f
Remove hardcoded path to my own machine.
2017-06-05 23:57:47 +01:00
King_DuckZ
4ba3b679fc
Read POST in the Response so I can override it for testing.
2017-06-05 23:56:59 +01:00
King_DuckZ
fb27563fdd
Make functions virtual when building with testing.
2017-06-05 23:02:39 +01:00
King_DuckZ
c302dbee73
Hide calls to Incredis in the Storage class.
...
This should allow me to write some decent
simulation tests.
2017-06-05 21:57:14 +01:00
King_DuckZ
99e52ceb75
More logging, try to fix the 502 gateway error.
2017-06-05 19:53:32 +01:00
King_DuckZ
640315cbba
Another attempt at fixing the 502 Gateway error.
2017-06-05 09:20:37 +01:00
King_DuckZ
26d8b553d7
Version bump to 0.2.2.
2017-06-04 23:06:27 +01:00
King_DuckZ
78156cea75
Off by 1?
2017-06-04 23:05:56 +01:00
King_DuckZ
87b6f85913
Version bump to 0.2.1.
2017-06-04 22:14:50 +01:00
King_DuckZ
1a7ec9c2c4
Use REQUEST_URI instead of PATH_INFO.
2017-06-04 22:14:05 +01:00
King_DuckZ
2293604e11
Fix tests' build.
2017-06-03 21:16:23 +01:00
King_DuckZ
defc365d21
Update link to renamed github page
2017-06-03 21:03:09 +01:00
King_DuckZ
cb2d163981
...rename duckbin to kamokan --> 鴨缶. yay!
2017-06-03 20:52:57 +01:00
King_DuckZ
ae283b6c96
Version bump to 0.2.0
2017-06-02 22:15:41 +01:00
King_DuckZ
2338ecbdb5
Rename tawashi to duckbin in the html.
2017-06-02 21:58:23 +01:00
King_DuckZ
9cda58d0c0
Rename tawashi to duckbin.
...
The library that used to be "tawashi_implem" now
is simply called tawashi.
2017-06-02 21:53:27 +01:00
King_DuckZ
2f00014758
Fail if CONTENT_TYPE is not application/x-www-form-urlencoded.
...
As part of the partial improvement to the POST reading
code I also added a max_post_size setting which defaults
to 1 MiB. POST inputs longer than that size get truncated.
This is separate to max_pastie_size, which is just the
size of one of the values in the POST data.
2017-06-02 09:23:35 +01:00
King_DuckZ
24baf67a65
Use the new SplitMime in the HttpHeader.
...
Something like the old m_param string is still needed
because Location responses need to send an URL.
The type of the response now determines if m_mime
or m_redirect_location is used.
2017-06-01 09:09:21 +01:00
King_DuckZ
5640cb5769
Remove debug text that was breaking the http response.
...
Also check if there are tabs in the mime parameter.
2017-06-01 09:06:10 +01:00
King_DuckZ
22a4503e0e
Merge branch 'mime_karma'
2017-05-31 19:54:47 +01:00
King_DuckZ
009341233d
Use karma to make mime strings from structs.
2017-05-31 19:53:46 +01:00