Skip to content
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

Feature: HttpServer plugins #2354

Merged
merged 25 commits into from
Aug 1, 2021
Merged

Conversation

slaff
Copy link
Contributor

@slaff slaff commented Jul 21, 2021

This PR adds plugin support to the HttpServer.
The plugins allow implementation of things like Http Basic Authentication, IP restrictions and content decoding.
See samples/HttpServer_Plugins/app/application.cpp and samples/HttpServer_Plugins/include/ContentDecoderPlugin.h to get an idea how the plugins are working.

@slaff slaff added this to the 4.4.0 milestone Jul 21, 2021
@slaff slaff force-pushed the feature/httpserver-plugins branch from 48f39b5 to d1d673d Compare July 21, 2021 15:07
@slaff slaff requested a review from mikee47 July 22, 2021 11:52
Copy link
Contributor

@mikee47 mikee47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed some suggested changes to your repo.

Copy link
Contributor

@mikee47 mikee47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little concerned about the over-use of delegates in this PR: a virtual event handling class would be simpler and consume less RAM. This class would contain methods corresponding to EventType. Possibly also replace int return value with a strong enum class instead - unless of course the actual value is important.

I'm happy to take a look at this approach if you agree?

*
****/

#include <Data/LinkedObjectList.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`#include "LinkedObjectList.h"

@slaff
Copy link
Contributor Author

slaff commented Jul 27, 2021

I'm happy to take a look at this approach if you agree?

With pleasure. From this PR I will extract the changes related to the linked list classes and move them to a separate PR that should be merged before this one.

@slaff slaff force-pushed the feature/httpserver-plugins branch from 6e263e3 to d4a42e0 Compare July 27, 2021 09:48
@slaff
Copy link
Contributor Author

slaff commented Jul 27, 2021

I'm happy to take a look at this approach if you agree?
.. From this PR I will extract the changes related ...

This PR was updated and ready for your changes :)

@mikee47
Copy link
Contributor

mikee47 commented Jul 28, 2021

@slaff To help me better understand, can you give examples of possible uses where the plugin is called after the resource callback?

@slaff
Copy link
Contributor Author

slaff commented Jul 28, 2021

called after the resource callback?

Yes, a HTML proxy plugin would be a good candidate. Once the response is ready to be sent a Sming HTML proxy plugin will be attached after the resource.onRequestComplete call and will try to rewrite the URL links.

@slaff slaff removed the 3 - Review label Aug 1, 2021
@slaff slaff merged commit 41f3394 into SmingHub:develop Aug 1, 2021
@slaff slaff mentioned this pull request Aug 12, 2021
5 tasks
slaff added a commit that referenced this pull request Sep 27, 2021
Co-authored-by: mikee47 <mike@sillyhouse.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants