[Webkit-unassigned] [Bug 231880] [GTK][WPE] Support setting status code and getting HTTP method in custom URI scheme handlers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 21 03:12:39 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=231880

--- Comment #16 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to liushuyu011 from comment #15)
> (In reply to Carlos Garcia Campos from comment #13)
> > Comment on attachment 441990 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=441990&action=review
> > 
> > Thanks, this goes in the right direction, but we don't really want to
> > duplicate the code to read the stream.
> > 
> > > Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp:262
> > > +    webkitURISchemeResponseSetTask(response, request->priv->task);
> > > +    webkitURISchemeResponseReadStart(response);
> > 
> > We don't want to move/duplicate the code to read the response, just use the
> > new WebKitURISchemeResponse to store the response parameters and get them
> > from here to reuse the existing code. Current
> > webkit_uri_scheme_request_finish should be rewritten to build a response and
> > call this method.
> > 
> > > Source/WebKit/UIProcess/API/glib/WebKitURISchemeResponse.cpp:133
> > > +void webkitURISchemeResponseSetTask(WebKitURISchemeResponse* schemeResponse, RefPtr<WebURLSchemeTask> task)
> > > +{
> > > +    g_return_if_fail(WEBKIT_IS_URI_SCHEME_RESPONSE(schemeResponse));
> > > +    schemeResponse->priv->task = task;
> > > +}
> > 
> > We don't need the task here.
> > 
> 
> Sorry, I have a question here:
> 
> I can think of two approaches to read the input stream from the
> `WebKitURISchemeResponse` in the `WebKitURISchemeRequest` context:
> 
> 1. Add a non-public function to get the `GInputStream` in the
> `WebKitURISchemeResponse`, then assign it to the `stream` field in
> `WebKitURISchemeRequest`;
> 2. Change `webkit_uri_scheme_request_finish_with_response` to accept a
> `GInputStream` parameter so `WebKitURISchemeResponse` only contains
> "metadata"
> 
> I am not sure which one is better in your opinion?
> 
> Thanks

I'm not sure I understand, just keep the current code to read the stream, but instead of using request->priv->stream get the stream from the response. Move the response members to the response object (stream, streamLength and contentType) and add GRefPtr<WebKitURISchemeResponse> as a member of the request instead. In finish_with_response you just need to set the response (request->priv->response = response) and start reading the stream. In current finish implementation, create a response object with the given parameters and call finish_with_response

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211021/5aab9199/attachment.htm>


More information about the webkit-unassigned mailing list