Tags:
create new tag
, view all tags

Feature Proposals » TWiki::Func::registerExternalHTTPHandler

Summary

Current State: Developer: Reason: Date: Concerns By: Bug Tracking: Proposed For:
AcceptedProposal MahiroAndo AcceptedByReleaseMeeting 2012-10-24     KampalaRelease

Edit Form

TopicSummary:
CurrentState:
CommittedDeveloper:
ReasonForDecision:
DateOfCommitment:   Format: YYYY-MM-DD
ConcernRaisedBy:
BugTracking:
OutstandingIssues:
RelatedTopics:
InterestedParties:
ProposedFor:
TWikiContributors:
 

Motivation

In order to achieve SingleSignOnForINCLUDE in the form of plugin, we need to have an API to register a hook to customize all HTTP requests to external resources.

Description and Documentation

Proposed interface:

registerExternalHTTPHandler( \&fn );

where \&fn is invoked whenever objects of LWP::UserAgent and HTTP::Request are set up in TWiki::Net.

The registerExternalHTTPHandler should only be invoked from inside initPlugin.

The handler callback ( \&fn) is expected to be written as below:

sub handleExternalHTTPRequest {
    my ($session, $url) = @_;
    my ($headers, $params) = ([], {});
    # set up $headers and $params
    return ($headers, $params);
}

where the returned $headers and $params are added to the HTTP requests for the $url, invoked from %INCLUDE{...}% or getExternalResource().

The semantics of the return values are identical to the optional arguments ($headers, $params) for getExternalResource (discussed here: AddLWPParametersToGetExternalResource).

Examples

registerExternalHTTPHandler( \&handleExternalHTTPRequest );

Impact

Implementation

-- Contributors: MahiroAndo - 2012-10-24

Discussion

Sound spec!

-- PeterThoeny - 2012-10-24

Accepted by JerusalemReleaseMeeting2012x10x26

-- PeterThoeny - 2012-10-26

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2013-10-11 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.