-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTPServerRequest & HTTPServerResponse as task-global objects #432
Comments
I am against making any sort of global objects that are not semantically server-global. Again, you are trying to hack REST module to do what it shouldn't do. I am somewhat satisfied with fact that current design makes it hard. |
Better way would have been to write own module similar to rest that provides |
The signature of |
I'm mostly trying to avoid the garbage associated with wrapping each handler. I'm sure I can come up with something convenient. From the general reaction, what I was suggesting pushes the limits a bit too far but it's a fair try on my end. |
I came up with a good name for compiling with this.
...
... |
I've found this to somewhat of a shortcut in developing a clean server application architecture. I'd like to have those available at all times through the program. My main concern is that it would let me use native D objects and register through REST without losing the session, but it would also help avoid any further issues with data access.
I've tried adding this to server.d
private TaskLocal!(FreeListRef!HTTPServerRequest) req;
private TaskLocal!(FreeListRef!HTTPServerResponse) res;
and then
req = FreeListRef!HTTPServerRequest(reqtime, listen_info.bindPort);
but it fails with
Error: function vibe.core.core.TaskLocal!(FreeListRef!(HTTPServerRequest)).TaskLocal.opAssign (TaskLocal!(FreeListRef!(HTTPServerRequest)) p) is not callable using argument types (FreeListRef!(HTTPServerRequest))
I think the issue is in TaskLocal, it needs to implement a type-safe storage with it's own allocator in m_fls. Any ideas?
The text was updated successfully, but these errors were encountered: