Bug 94537 - Setting WebKitEnableHTTPPipelining doesn't work if default is true
Summary: Setting WebKitEnableHTTPPipelining doesn't work if default is true
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Pratik Solanki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-08-20 15:32 PDT by Pratik Solanki
Modified: 2012-08-22 13:56 PDT (History)
3 users (show)

See Also:


Attachments
Patch (2.78 KB, patch)
2012-08-20 15:37 PDT, Pratik Solanki
no flags Details | Formatted Diff | Diff
Patch (2.75 KB, patch)
2012-08-20 15:47 PDT, Pratik Solanki
ddkilzer: review+
ddkilzer: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pratik Solanki 2012-08-20 15:32:09 PDT
The code does

    if (!ResourceRequest::httpPipeliningEnabled() && readBooleanPreference(CFSTR("WebKitEnableHTTPPipelining")))
        ResourceRequest::setHTTPPipeliningEnabled(true);

if ResourceRequest::httpPipeliningEnabled() is set to true by default, then we never read the pref and never enable/disable pipelining per the pref.
Comment 1 Pratik Solanki 2012-08-20 15:32:37 PDT
<rdar://problem/11831396>
Comment 2 Pratik Solanki 2012-08-20 15:37:24 PDT
Created attachment 159542 [details]
Patch
Comment 3 Pratik Solanki 2012-08-20 15:47:54 PDT
Created attachment 159546 [details]
Patch
Comment 4 Alexey Proskuryakov 2012-08-21 12:01:31 PDT
> if ResourceRequest::httpPipeliningEnabled() is set to true by default, then we never read the pref and never enable/disable pipelining per the pref.

Did you mean "if...set to false"?

This code looks like it's intentional, i.e. one should both set the preference, and call an API method to enable pipelining. Do you think that we now want to change that, or that the code was never actually meant to do that?
Comment 5 Pratik Solanki 2012-08-21 14:18:47 PDT
(In reply to comment #4)
> > if ResourceRequest::httpPipeliningEnabled() is set to true by default, then we never read the pref and never enable/disable pipelining per the pref.
> 
> Did you mean "if...set to false"?
> 
> This code looks like it's intentional, i.e. one should both set the preference, and call an API method to enable pipelining. Do you think that we now want to change that, or that the code was never actually meant to do that?

The code, as written, would only check the pref value if ResourceRequest::s_httpPipeliningEnabled was initialized to false. If it was initialized to true (e.g. to enable pipelining by default), then we couldn't use the pref to disable pipelining. The patch ensures that the pref, if present, overrides the default value in the file.

Looking at the code some more, I guess if the pref is not present, there isn't a need to call setHTTPPipeliningEnabled(). It will just use the default in that case.
Comment 6 Alexey Proskuryakov 2012-08-21 14:35:49 PDT
Ah sorry, I didn't notice the lonely "!" sign in the expression.
Comment 7 David Kilzer (:ddkilzer) 2012-08-22 12:06:16 PDT
Comment on attachment 159546 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=159546&action=review

r=me with comments addressed.

> Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp:278
> +    Boolean keyExistsAndHasValidFormat;

Nit:  Initialize to False.

> Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp:281
> +    bool pipeliningEnabled = keyExistsAndHasValidFormat ? prefValue : ResourceRequest::httpPipeliningEnabled();
> +    ResourceRequest::setHTTPPipeliningEnabled(pipeliningEnabled);

This could be simplified to this (as mentioned in Comment #6):

    if (keyExistsAndHasValidFormat)
        ResourceRequest::setHTTPPipeliningEnabled(prefValue);
Comment 8 David Kilzer (:ddkilzer) 2012-08-22 12:06:55 PDT
(In reply to comment #7)
> This could be simplified to this (as mentioned in Comment #6):

Err...Comment #5.
Comment 9 Pratik Solanki 2012-08-22 13:56:51 PDT
Committed r126346: <http://trac.webkit.org/changeset/126346>