Bug #8972
WResource::setInternalPath does not work
100%
Description
Following code works fine:
myResource_ = std::make_unique<MyResource>();
//myResource_->setInternalPath("myresource");
root()->addWidget(std::make_unique<WAnchor>(WLink(myResource_->url()), "Resource"));
(with MyResource subclass of WResource)
Clicking on the link displays the content generated by myResource_, as expected
However when the second line is uncommented the clicking on the link returns a 403 forbidden error.
Also entering the url as
http:///myresource or http:///?_=myresource
does not work. Tested with Wt 4.5.0
Related issues
Updated by Geert Verbruggen over 1 year ago
Update: urls at the end are wrong (part was interpreted as markdown)
should be:
http://myserver/myresource or http://myserver/?_=myresource
Updated by Geert Verbruggen over 1 year ago
Cause of the error seems to be that &request=resource
is not added to the url for a WResource with internalPath set.
As a consequence requestForResource
evaluates to false at WebSession.C, line 1328, and request handling ends at WebSession.C line 1385:
if (env_->ajax() && isEqual(request.requestMethod(), "GET") && !requestForResource && conf.reloadIsNewSession() && wtdE && *wtdE == sessionId_) { LOG_SECURE("Unexpected GET request with wtd of existing Ajax session"); serveError(403, handler, "Forbidden"); return; }
Updated by Korneel Dumon over 1 year ago
- Status changed from New to InProgress
- Assignee set to Korneel Dumon
Thanks for reporting. Seems to be a regression because of https://redmine.webtoolkit.eu/issues/7585
Updated by Roel Standaert over 1 year ago
- Status changed from Review to Implemented @Emweb
- Target version changed from 4.7.0 to 4.6.0
Updated by Roel Standaert over 1 year ago
- Related to Bug #9523: Wt 4.6.0 regression: possible null dereference in WebSession::resourceRequest added