Changeset 230467 in webkit


Ignore:
Timestamp:
Apr 9, 2018 8:43:46 PM (6 years ago)
Author:
wilander@apple.com
Message:

Refactor Ignore HSTS code
https://bugs.webkit.org/show_bug.cgi?id=184433
<rdar://problem/39298238>

Reviewed by Darin Adler.

This patch refactors our ignore HSTS code. The convenience functions are moved
out of CFNetwork SPI in PAL, and into where they are used. It also switches
from performSelector: calls to straight function calls, after checking that
there is a responder.

Source/WebCore:

  • platform/network/mac/WebCoreURLResponse.mm:

(WebCore::schemeWasUpgradedDueToDynamicHSTS):

Add convenience function here since it was moved out of
CFNetworkSPI.h.

Source/WebCore/PAL:

  • pal/spi/cf/CFNetworkSPI.h:

(schemeWasUpgradedDueToDynamicHSTS): Deleted.
(setIgnoreHSTS): Deleted.
(ignoreHSTS): Deleted.

Source/WebKit:

  • NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(schemeWasUpgradedDueToDynamicHSTS):
(setIgnoreHSTS):
(ignoreHSTS):

Add convenience functions here since they were moved out of
CFNetworkSPI.h.

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r230458 r230467  
     12018-04-09  John Wilander  <wilander@apple.com>
     2
     3        Refactor Ignore HSTS code
     4        https://bugs.webkit.org/show_bug.cgi?id=184433
     5        <rdar://problem/39298238>
     6
     7        Reviewed by Darin Adler.
     8
     9        This patch refactors our ignore HSTS code. The convenience functions are moved
     10        out of CFNetwork SPI in PAL, and into where they are used. It also switches
     11        from performSelector: calls to straight function calls, after checking that
     12        there is a responder.
     13
     14        * platform/network/mac/WebCoreURLResponse.mm:
     15        (WebCore::schemeWasUpgradedDueToDynamicHSTS):
     16            Add convenience function here since it was moved out of
     17            CFNetworkSPI.h.
     18
    1192018-04-09  Brady Eidson  <beidson@apple.com>
    220
  • trunk/Source/WebCore/PAL/ChangeLog

    r230368 r230467  
     12018-04-09  John Wilander  <wilander@apple.com>
     2
     3        Refactor Ignore HSTS code
     4        https://bugs.webkit.org/show_bug.cgi?id=184433
     5        <rdar://problem/39298238>
     6
     7        Reviewed by Darin Adler.
     8
     9        This patch refactors our ignore HSTS code. The convenience functions are moved
     10        out of CFNetwork SPI in PAL, and into where they are used. It also switches
     11        from performSelector: calls to straight function calls, after checking that
     12        there is a responder.
     13
     14        * pal/spi/cf/CFNetworkSPI.h:
     15        (schemeWasUpgradedDueToDynamicHSTS): Deleted.
     16        (setIgnoreHSTS): Deleted.
     17        (ignoreHSTS): Deleted.
     18
    1192018-04-07  Timothy Hatcher  <timothy@apple.com>
    220
  • trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h

    r230311 r230467  
    338338@end
    339339
    340 static bool schemeWasUpgradedDueToDynamicHSTS(NSURLRequest *request)
    341 {
    342     if ([request respondsToSelector:@selector(_schemeWasUpgradedDueToDynamicHSTS)])
    343         return [request performSelector:@selector(_schemeWasUpgradedDueToDynamicHSTS)];
    344     return false;
    345 }
    346 
    347 static void setIgnoreHSTS(NSMutableURLRequest *request, bool ignoreHSTS)
    348 {
    349     if ([request respondsToSelector:@selector(_setIgnoreHSTS:)])
    350         [request performSelector:@selector(_setIgnoreHSTS:) withObject:[NSNumber numberWithBool:ignoreHSTS]];
    351 }
    352 
    353 static bool ignoreHSTS(NSURLRequest *request)
    354 {
    355     if ([request respondsToSelector:@selector(_ignoreHSTS)])
    356         return [request performSelector:@selector(_ignoreHSTS)];
    357     return false;
    358 }
    359 
    360340#endif // defined(__OBJC__)
  • trunk/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm

    r224846 r230467  
    328328#endif
    329329
     330static bool schemeWasUpgradedDueToDynamicHSTS(NSURLRequest *request)
     331{
     332#if !USE(CFNETWORK_IGNORE_HSTS)
     333    UNUSED_PARAM(request);
     334    return false;
     335#else
     336    return [request respondsToSelector:@selector(_schemeWasUpgradedDueToDynamicHSTS)]
     337        && [request _schemeWasUpgradedDueToDynamicHSTS];
     338#endif
     339}
     340
    330341NSURLResponse *synthesizeRedirectResponseIfNecessary(NSURLRequest *currentRequest, NSURLRequest *newRequest, NSURLResponse *redirectResponse)
    331342{
  • trunk/Source/WebKit/ChangeLog

    r230463 r230467  
     12018-04-09  John Wilander  <wilander@apple.com>
     2
     3        Refactor Ignore HSTS code
     4        https://bugs.webkit.org/show_bug.cgi?id=184433
     5        <rdar://problem/39298238>
     6
     7        Reviewed by Darin Adler.
     8
     9        This patch refactors our ignore HSTS code. The convenience functions are moved
     10        out of CFNetwork SPI in PAL, and into where they are used. It also switches
     11        from performSelector: calls to straight function calls, after checking that
     12        there is a responder.
     13
     14        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     15        (schemeWasUpgradedDueToDynamicHSTS):
     16        (setIgnoreHSTS):
     17        (ignoreHSTS):
     18            Add convenience functions here since they were moved out of
     19            CFNetworkSPI.h.
     20
    1212018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
    222
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r230280 r230467  
    183183    return request;
    184184}
     185
     186static bool schemeWasUpgradedDueToDynamicHSTS(NSURLRequest *request)
     187{
     188    return [request respondsToSelector:@selector(_schemeWasUpgradedDueToDynamicHSTS)]
     189        && [request _schemeWasUpgradedDueToDynamicHSTS];
     190}
     191
     192static void setIgnoreHSTS(NSMutableURLRequest *request, bool ignoreHSTS)
     193{
     194    if ([request respondsToSelector:@selector(_setIgnoreHSTS:)])
     195        [request _setIgnoreHSTS:ignoreHSTS];
     196}
     197
     198static bool ignoreHSTS(NSURLRequest *request)
     199{
     200    return [request respondsToSelector:@selector(_ignoreHSTS)]
     201        && [request _ignoreHSTS];
     202}
    185203#endif
    186204
Note: See TracChangeset for help on using the changeset viewer.