File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6767 test:examples :
6868 dir : ./examples
6969 cmds :
70- - cargo test
70+ - chmod +x ./test.sh
71+ - ./test.sh
7172
7273 test:samples :
7374 dir : ./samples
Original file line number Diff line number Diff line change 1- JWT_SECRET =
1+ JWT_SECRET = your-jwt-secret-key
Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ mod test {
6060 use ohkami:: testing:: * ;
6161
6262 /// regression test for https://github.com/ohkami-rs/ohkami/issues/433
63+ ///
64+ /// run with `OHKAMI_REQUEST_BUFSIZE=4096` or larger
6365 #[ tokio:: test]
6466 async fn test_large_jwt ( ) {
6567 struct LargeJwtSub ;
@@ -84,9 +86,6 @@ mod test {
8486 }
8587 }
8688
87- // SAFETY: this crate contains only this single test
88- unsafe { std:: env:: set_var ( "OHKAMI_REQUEST_BUFSIZE" , ( 1 << 12 ) . to_string ( ) ) } ;
89-
9089 dotenvy:: dotenv ( ) . ok ( ) ;
9190
9291 let t = ohkami :: < LargeJwtSub > ( ) . test ( ) ;
Original file line number Diff line number Diff line change 1+ set -Cue
2+
3+ EXAMPLES=$( pwd)
4+
5+ cd $EXAMPLES /jwt && \
6+ cp .env.sample .env
7+ cd $EXAMPLES /jwt && \
8+ cargo test 2>&1 | grep ' Unexpected end of headers' \
9+ && echo ' ---> expected error' \
10+ || exit 1
11+ cd $EXAMPLES /jwt && \
12+ OHKAMI_REQUEST_BUFSIZE=4096 cargo test
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ impl Request {
264264 let key_bytes = r. read_while ( |b| b != & b':' ) ;
265265 r. consume ( ": " ) . ok_or_else ( || {
266266 crate :: WARNING !( "\
267- [Request::read] Header key is not found. \
267+ [Request::read] Unexpected end of headers! \
268268 Maybe request buffer size is not enough. \
269269 Try to set `OHKAMI_REQUEST_BUFSIZE` to larger value \
270270 (default: 2048).\
@@ -275,7 +275,7 @@ impl Request {
275275 let value = CowSlice :: Ref ( Slice :: from_bytes ( r. read_while ( |b| b != & b'\r' ) ) ) ;
276276 r. consume ( "\r \n " ) . ok_or_else ( || {
277277 crate :: WARNING !( "\
278- [Request::read] Header value is not found. \
278+ [Request::read] Unexpected end of headers! \
279279 Maybe request buffer size is not enough. \
280280 Try to set `OHKAMI_REQUEST_BUFSIZE` to larger value \
281281 (default: 2048).\
You can’t perform that action at this time.
0 commit comments