Project

General

Profile

Bug #8972

WResource::setInternalPath does not work

Added by Geert Verbruggen 4 months ago. Updated 2 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
Start date:
08/17/2021
Due date:
% Done:

100%

Estimated time:

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

#1

Updated by Geert Verbruggen 4 months ago

Update: urls at the end are wrong (part was interpreted as markdown)
should be:

http://myserver/myresource or http://myserver/?_=myresource

#2

Updated by Geert Verbruggen 4 months 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;
}
#3

Updated by Korneel Dumon 3 months 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

#4

Updated by Korneel Dumon 3 months ago

  • Status changed from InProgress to Review
#5

Updated by Korneel Dumon 3 months ago

  • Target version set to 4.7.0
#6

Updated by Roel Standaert 2 months ago

  • Status changed from Review to Implemented @Emweb
  • Target version changed from 4.7.0 to 4.6.0
#7

Updated by Roel Standaert 2 months ago

  • Status changed from Implemented @Emweb to InProgress
#8

Updated by Roel Standaert 2 months ago

  • Status changed from InProgress to Resolved
#9

Updated by Roel Standaert 2 months ago

  • % Done changed from 0 to 100

Also available in: Atom PDF