Releases: connorslade/afire
v3.0.0-alpha.3
Change log
- Use loopback, private, and unique local addresses for RealIp
- Add is_informational, is_success, is_redirect, is_client_error, and is_server_error methods on status codes.
- Use a Cow in HeaderName::Custom
- Don't store whole stream to get its length in Head ext
- Added sync_route extension
- Make threadpool more robust
- Add a Stream trait to allow using different socket impls
- Allow using custom event loop
- The custom event loop with the Stream trait should allow a separate crate to add tls support to an afire server
- Cleanup Query struct
- Now stores a set of QueryParameter structs instead of [String; 2]
- Implement Debug for Query
- Rename
Query::from_body
toQuery::from_str
- Made internal::handle::handle function public for use in custom event loops.
- Made
error::AnyResult
public - Disable keep-alive if only running with one thread
Full Changelog: v2.1.0...v3.0.0-alpha.3
v3.0.0-alpha.1
Changelog
- The thread pool can now be resized at runtime.
Server::start_threaded
has been replaced withServer::workers
to set the number of worker threads and the normalServer::start
.- Supply a context to all route handlers.
The context contains a reference to the server, request, and acts as a response builder.
Note: This also allows access to the thread_pool for both executing tasks and resizing it. - Remove the
stateful_route
method, use normal routes withctx.app()
instead. - You can now send responses before the route handler ends.
This allows you to easily send a response and then do some work after the response is sent as to not block the client. - Responses can be sent from other threads.
You will have to notify the handler that you will be sending a response after the handler function returns withctx.guarantee_will_send()
. - Allow returning any error type from route handlers.
This is done with a return type ofResult<(), Box<dyn Error>>
. - Allow attaching extra context to an error with anyhow like functions:
context
,with_context
,status
,with_status
,header
,with_header
. - Remove
StartupError::NoState
error. - Make
ForceLockMutex
,ForceLockRwLock
, andSingleBarrier
public through theinternal::sync
module.- The force lock traits are used to lock a
Mutex
orRwLock
even if it is poisoned. - The
SingleBarrier
is used to have a thread wait until another thread unlocks the barrier.
The difference from a normal Barrier is that it does not block on both sides, only the waiting side.
- The force lock traits are used to lock a
- Replace the
TcpStream
inRequest
withSocket
, a wrapper struct.
Its used to allow automatically the barrier with a response is sent.
In the future it might also be used for optional TLS support. - Move path parameters into Context and use a HashMap instead of a Vec.
- Parse the HTTP version into an enum instead of a string.
- Properly determine weather to use keep-alive or not.
In HTTP/1.1 keep-alive is opt-out, but previous versions of afire assumed it was opt-in.
Fixing this produced a 2x performance increase in the benchmarks I ran.
Now, this is still only a ~500us improvement but hey. - Filter CLRF characters from headers. This prevents a potential response splitting attack.
- Properly disallow HTTP/1.1 requests with no Host header.
- Added a new ResponseBody type of Empty.
- Added a
current_thread
function to the threadpool. - Catch panics at the thread-pool level, not the route handler level.
This will ensure that a worker will not die, even if internal afire code panics.
What's Changed
- Fix #46 by @Basicprogrammer10 in #47
Full Changelog: v2.1.0...v3.0.0-alpha.1
v3.0.0-alpha.2
- Use an Arc instead of a Rc for
HandleError::Panic
- Add
with_response
function on Context to overwrite the response. - Finish implementing Websockets. 🎉
- Add chat app example application.
- Rename
Server::start
toServer::run
to emphasize that it blocks. - Pass
Arguments
to trace formatters instead of a String.
This can be more efficient if the formatter decides not to format the trace. - Attach a unique ID to each socket.
- Disallow forbidden headers as default headers.
- Rename
extension
module toextensions
. - Added a RouteShorthand extension.
It allows you to useserver.get(...)
instead ofserver.route(Method::GET, ...)
. - Added Redirect shorthand extension.
It allows you to usectx.redirect("...")
instead ofctx.status(Status::Found).header(HeaderType::Location, "...")
. - Rewrote the router to allow for more compacted routes.
Parameters and wildcards no longer have to be separated by a slash, they can be separated by any literal.
This was not implemented before because it it significantly more complicated to implement.
Here are some examples of what you can do now:/file/{name}.{ext}
/hello*world
- Internal
url::decode
will not hard fail in the case of invalid url encoded strings. - Add
PathNormalizer
middleware that removes trailing and repeating slashes from paths. - Optimize router. Benchmarking is kinda hard but I think this new router is faster even though it is significantly more flexible.
- Rename HeaderType to HeaderName as that is the correct name.
- Accept
Into<Header>
inContext::header
andResponse::header
. - Create 'header structs' that can be converted into a
Header
and simplify working with headers in responses.
What's Changed
- afire 2.2.0 by @Basicprogrammer10 in #45
- Fix #46 by @Basicprogrammer10 in #47
Full Changelog: v2.1.0...v3.0.0-alpha.2
v2.2.1
This is just a small patch release to fix a bug with streaming responses where interrupted type errors wouldn't be handled properly.
More information about this release at https://connorcode.com/writing/afire/update-8.
What's Changed
- Fix Support interrupted streams in response #46 by @Basicprogrammer10 in #47
Full Changelog: v2.1.0...v2.2.1
v2.2.0
More information about this release at https://connorcode.com/writing/afire/update-7.
Changelog
- Use binary search on ServeStatic MMIE types (save those clock cycles)
- Some optimizations throughout afire
- Logger can now make use of the
RealIp
extension and log the real ip of the client - Logger now holds a persistent file handle instead of opening and closing it every time
- In ServeStatic, when paths have the '..', they will now go up a directory instead of being ignored
Note: The highest you can can go is the data directory that you define, so there is no path traversal vulnerability - Accept
impl Into<HeaderType>
inRequestId::new
instead of justAsRef<str>
.
This allows for usingHeaderType
s as well as strings to set the header. - Add a
HEAD
middleware that adds support for the HTTP HEAD method. - Update
ServeStatic
to send a Content-Length header when streaming a file. - Build extension docs on docs.rs
- Add a
TRACE
middleware that adds support for the HTTP TRACE method. - Add support for Server-Sent Events (SSE).
- Progress on Websocket support
Full Changelog: v2.1.0...v2.2.0
v2.1.0
More information about this release at https://connorcode.com/writing/afire/update-6.
Changelog
- Added a get_query method on Query
- Changed default log level back to Error
- Response flags (Close & End)
- More built-in encoding systems (base64 & sha-1)
- Change encoding system module format
- Multipart request parsing
- CookieJar struct for holding Cookies in the request
- RealIp extension
- Allow serving an IPv6 addr
- Use a
Headers
struct to hold default headers - Added a HeaderParams struct
- Impl ToHostAddress for &String
- Add Server::app to get a reference to the app
- Increase ServeStatic compatibility with other middleware
- Custom log formatter support
- Optional emoji in logging
- Fix the Display impl on Query
- Add body_str method to Request
- Impl std::error::Error for afire::Error
- Impl Display for error types
- Don't execute format on lower log-levels
- Fix spelling errors
- Fix Logger middleware always appending
?
to the path - Don't consider sockets closing to be an error (only printed in debug tracing)
- Mild performance improvements in the path matcher with catch-all routes
Full Changelog: v2.0.0...v2.1.0
v2.0.0
More information about this release at https://connorcode.com/writing/afire/update-5.
Changelog
- Fix improper URL decoding behavior
- Improve Memory Usage On
Request
s - Internal code cleanup
- More clear info on IO errors
- Make SocketAddr accessible from Request
- Remade social share image
- Let ServeStatic::new take in strings and paths (previously only strings)
- Remove unnecessary feature flags (cookies, path_patterns, dynamic_resize, path_decode_url)
- More clear info on IO errors
- Improve Memory Usage On
Request
s - Less cloning internally
- Make SocketAddr accessible from Request
- New error types: Startup / Stream
- Date middleware in extensions
- Another middleware rewrite
- Util module
- All Content variants use charset=utf-8 by default
- HeaderType enum
- Status enum
- New Header methods
- New Query methods
- Encoding module
- Server::new accepts ToHostAddress (Ipv4Addr, String, &str, [u8; 4])
- Rewrote socket handler (this is a big one)
- Trace system
- Streaming response
- Socket keep-alive!
- Request modifier
- Error handler has app state
- Panic if no app state and stateful routes
- Documentation of internal structs
- Fix improper URL decoding behavior
- Internal code cleanup
- Remade social share image
- Let ServeStatic::new take in strings and paths (previously only strings)
- Rewrote lots of documentation with spelling fixes and better code examples
- Remove unnecessary feature flags (cookies, path_patterns, dynamic_resize, path_decode_url)
- Removed cache extension
- Removed socket handler struct (don't think it was ever used)
- Removed the buff_size field from server, its handled automatically now
- Removed
set_run
on the server, its no longer needed internally
Full Changelog: v1.2.0...v2.0.0
v1.2.0
Changelog
- oh windows,,,
- Fix Path Traversal on windows
- Use AsRef more instead of Display
- Add a serve path to Serve Static
- Serve index from serve path
- Remove the
ignore_trailing_path_slash
feature - Redo Internal Error handling system
- Middleware use references to Requests and Responses and stuff
- Improve built-in serve_static middleware
- Re organize extension stuff
- RateLimit use RwLock
- Add Request ID Middleware
- Server Wide State
- Add Cache Middleware
- Remove insane build script
- When building http response only add Content-Length and default headers if they are not already present
- Add server state syste
- Improved Request Parsing
- Redo Error system
- Remove the requests raw_data feild
- Remove Request::body_string in favor of String::from_utf8()
- Fix HTTP parseing and genatation issues
What's Changed
- 🔮 State by @Basicprogrammer10 in #14
- ✨ afire 1.2.0 by @Basicprogrammer10 in #15
Full Changelog: v1.1.0...v1.2.0
Change Outline: https://connorcode.com/writing/afire/update-4
v1.1.0
Changelog
- Update Path Matcher to support AnyAfter segments (**)
- Remove Test Example
- Add Paste Bin App Example
- Add SocketHandler struct to hold socket ineracting functions
- Fix Path Traversal Exploit O_O
Full Changelog: v1.0.0...v1.1.0
v1.0.0
Changelog
- Add ThreadPool Back!
- Tracing Feature
- Remove Middleware Interior Mutability by Default
- Make remove_address_port usable without Feature
- Add end middleware to run after sending a request
- Make use of end middleware on logger
Full Changelog: 0.4.0...v1.0.0