Project

General

Profile

Actions

Bug #8972

closed

WResource::setInternalPath does not work

Added by Geert Verbruggen over 2 years ago. Updated over 2 years ago.

Status:
Closed
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


Related issues 1 (0 open1 closed)

Related to Bug #9523: Wt 4.6.0 regression: possible null dereference in WebSession::resourceRequestClosedKorneel Dumon12/20/2021

Actions
Actions #1

Updated by Geert Verbruggen over 2 years ago

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

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

Actions #2

Updated by Geert Verbruggen over 2 years 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;
}
Actions #3

Updated by Korneel Dumon over 2 years 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

Actions #4

Updated by Korneel Dumon over 2 years ago

  • Status changed from InProgress to Review
Actions #5

Updated by Korneel Dumon over 2 years ago

  • Target version set to 4.7.0
Actions #6

Updated by Roel Standaert over 2 years ago

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

Updated by Roel Standaert over 2 years ago

  • Status changed from Implemented @Emweb to InProgress
Actions #8

Updated by Roel Standaert over 2 years ago

  • Status changed from InProgress to Resolved
Actions #9

Updated by Roel Standaert over 2 years ago

  • % Done changed from 0 to 100
Actions #10

Updated by Roel Standaert over 2 years ago

  • Status changed from Resolved to Closed
Actions #11

Updated by Roel Standaert over 2 years ago

  • Related to Bug #9523: Wt 4.6.0 regression: possible null dereference in WebSession::resourceRequest added
Actions

Also available in: Atom PDF