-
Notifications
You must be signed in to change notification settings - Fork 457
Custom Handler Proxying #11035
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
base: dev
Are you sure you want to change the base?
Custom Handler Proxying #11035
Conversation
src/WebJobs.Script/Workers/Http/Configuration/HttpWorkerOptions.cs
Outdated
Show resolved
Hide resolved
src/WebJobs.Script/Workers/Http/Configuration/HttpWorkerOptionsSetup.cs
Outdated
Show resolved
Hide resolved
_httpProxyService.StartForwarding(scriptInvocationContext, _destinationPrefix); | ||
|
||
await _httpProxyService.EnsureSuccessfulForwardingAsync(scriptInvocationContext); | ||
scriptInvocationContext.ResultSource.SetResult(_successfulInvocationResult); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the downstream code updates this _successfulInvocationResult
instance? I see we use a shared instance for all invocations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the downstream code does not. This value is set to allow the function invocation to continue, but its value is never used (similar to how http proxying flows). We ignore the function invocation result at this step so that the actual response just flows through.
@@ -289,6 +289,8 @@ public static IHostBuilder AddScriptHostCore(this IHostBuilder builder, ScriptAp | |||
// Core WebJobs/Script Host services | |||
services.AddSingleton<ScriptHost>(); | |||
|
|||
services.AddSingleton<IHttpProxyService, DefaultHttpProxyService>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be conditionally registered? Only when custom handlers is enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the cleanup and refactor, this service will also be used for HTTP Proxying for worker http streaming. Information about streaming support/capabilities won't be known until there is a worker init response (which occurs much later than this stage).
src/WebJobs.Script/Workers/Http/Configuration/HttpWorkerOptions.cs
Outdated
Show resolved
Hide resolved
6043724
to
a05018b
Compare
}; | ||
|
||
_destinationPrefix = new UriBuilder(WorkerConstants.HttpScheme, WorkerConstants.HostName, _httpWorkerOptions.Port).Uri; | ||
_userAgentString = $"{HttpWorkerConstants.UserAgentHeaderValue}/{ScriptHost.Version}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this ever get set outside of the ctor? Could this be a const? It doesnt look like its made up of anything that would require it to be init in here no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't get set outside of the ctor, but ScriptHost.Version
isn't a constant so this can't be init as a constant outside of the ctor at the top of the file.
Issue describing the changes in this PR
resolves #11025
Pull request checklist
IMPORTANT: Currently, changes must be backported to the
in-proc
branch to be included in Core Tools and non-Flex deployments.in-proc
branch is not requiredrelease_notes.md