Bug 37777

Summary: protocolHostAndPortEquals host check makes a wrong assumption
Product: WebKit Reporter: Julien Chaffraix <jchaffraix>
Component: WebCore Misc.Assignee: Julien Chaffraix <jchaffraix>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Proposed fix: take URLs credential into account ap: review+, jchaffraix: commit-queue-

Description Julien Chaffraix 2010-04-18 15:01:09 PDT
The logic assumes that both the URL starts at the same position. This is right for most URL but is wrong for URL containing credentials: the code will return false for http://foo.example.com and http://user:pass@foo.example.com.
Comment 1 Julien Chaffraix 2010-04-18 15:37:52 PDT
Created attachment 53639 [details]
Proposed fix: take URLs credential into account
Comment 2 Alexey Proskuryakov 2010-04-19 23:13:33 PDT
Comment on attachment 53639 [details]
Proposed fix: take URLs credential into account

+    int lengthHostA = a.hostEnd() - hostStartA;

It's strange that the order of words is different in old and new variables, "host start" vs. "length host".

r=me, good catch!
Comment 3 Julien Chaffraix 2010-04-24 09:47:18 PDT
(In reply to comment #2)
> (From update of attachment 53639 [details])
> +    int lengthHostA = a.hostEnd() - hostStartA;
> 
> It's strange that the order of words is different in old and new variables,
> "host start" vs. "length host".

Landed in r58219 with this correction.