<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>20752</bug_id>
          
          <creation_ts>2013-01-24 06:45:52 +0000</creation_ts>
          <short_desc>IPv6 parser doesn&apos;t work well</short_desc>
          <delta_ts>2013-02-18 09:25:03 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>URL</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="NARUSE, Yui">naruse</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>mike</cc>
          
          <qa_contact>sideshowbarker+urlspec</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>82031</commentid>
    <comment_count>0</comment_count>
    <who name="NARUSE, Yui">naruse</who>
    <bug_when>2013-01-24 06:45:52 +0000</bug_when>
    <thetext>Specification: http://url.spec.whatwg.org/#concept-ipv6-parser

&gt; Substep 7.2.2.
Before this, &quot;Increase pointer by one&quot; is needed.

&gt; Substep 12.3. &quot;While neither piece pointer nor swaps is zero, replace piece with the piece at pointer compress pointer + swaps and then decrease piece pointer and swaps by one.&quot;

&quot;compress pointer + swaps&quot; must be &quot;compress pointer + swaps - 1&quot;.

And fixed &quot;replace piece with the piece at pointer compress pointer + swaps - 1&quot; is read,
&quot;Set piece to the value of the piece at pointer compress pointer + swaps - 1&quot;.
But correct action is
&quot;Set piece to the value of the piece at pointer compress pointer + swaps - 1, then set the piece at pointer compress pointer + swaps - 1 to 0&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82140</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-01-25 14:47:01 +0000</bug_when>
    <thetext>It does not need to be set to 0 I think, because they&apos;re all initially 0. Am I missing something? Made the other changes:

https://github.com/whatwg/url/commit/a0b00b3d75be2624c14c6b9457c6bc0f93e9a39c</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82162</commentid>
    <comment_count>2</comment_count>
    <who name="NARUSE, Yui">naruse</who>
    <bug_when>2013-01-25 20:35:05 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; It does not need to be set to 0 I think, because they&apos;re all initially 0. Am
&gt; I missing something? Made the other changes:
&gt; 
&gt; https://github.com/whatwg/url/commit/a0b00b3d75be2624c14c6b9457c6bc0f93e9a39c

As far as I understand, the process will run as following, and second piece&apos;s value stays 1.

----
After Step 5.

&quot;::1&quot;
 | pointer

# 0  1  2  3  4  5  6  7
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
  | piece pointer
compress pointer = null

----
After Step 6.3.

&quot;::1&quot;
   | pointer

# 0  1  2  3  4  5  6  7
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
     | piece pointer
     | compress pointer

----
After Step 7.7. (first run of While loop)

&quot;::1&quot;
    | pointer

# 0  1  2  3  4  5  6  7
[ 0, 1, 0, 0, 0, 0, 0, 0 ]
        | piece pointer
     | compress pointer

----
After Step 12.2.

swaps = piece pointer (2) - compress pointer (1) = 1
&quot;::1&quot;
    | pointer

# 0  1  2  3  4  5  6  7
[ 0, 1, 0, 0, 0, 0, 0, 0 ]
                       | piece pointer
     | compress pointer

----
At Step 12.3. (first run)

swaps = 1
&quot;::1&quot;
    | pointer

# 0  1  2  3  4  5  6  7
[ 0, 1, 0, 0, 0, 0, 0, 0 ]
                       | piece pointer
     | compress pointer

% neither piece pointer nor swaps is zero
YES
% replace piece with the piece at pointer compress pointer + swaps − 1
# 0  1  2  3  4  5  6  7
[ 0, 1, 0, 0, 0, 0, 0, 1 ]
                       | piece pointer
     | compress pointer
% decrease piece pointer and swaps by one
swaps = 0
# 0  1  2  3  4  5  6  7
[ 0, 1, 0, 0, 0, 0, 0, 1 ]
                    | piece pointer
	 | compress pointer</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82699</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-02-07 16:25:59 +0000</bug_when>
    <thetext>Thanks for the helpful illustration. My intent with &quot;replace&quot; was &quot;swap&quot;. So effectively you put the 1 where the 0 is, and the 0 where the 1 is. If I use the word &quot;swap&quot;, do you think that&apos;s clear enough?

(Sorry for the late reply, I&apos;ve been moving countries, and overall IPv6 does not make me happy.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83226</commentid>
    <comment_count>4</comment_count>
    <who name="NARUSE, Yui">naruse</who>
    <bug_when>2013-02-16 20:55:25 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Thanks for the helpful illustration. My intent with &quot;replace&quot; was &quot;swap&quot;. So
&gt; effectively you put the 1 where the 0 is, and the 0 where the 1 is. If I use
&gt; the word &quot;swap&quot;, do you think that&apos;s clear enough?

Yes, &quot;swap&quot; is much clear for me.

On programming context, for example,
Java&apos;s and JavaScript&apos;s String.replace, only receiver is changed.
On the other hand, x86&apos;s bswap and C++&apos;s std::swap means exchange.

&gt; (Sorry for the late reply, I&apos;ve been moving countries, and overall IPv6 does
&gt; not make me happy.)

I saw your article, I pray you have a good time in Mozilla.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83255</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-02-18 09:24:38 +0000</bug_when>
    <thetext>https://github.com/whatwg/url/commit/2e081cea56ec12a3fc1bd9d4d7ba1aad93c23859</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83256</commentid>
    <comment_count>6</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-02-18 09:25:03 +0000</bug_when>
    <thetext>Thank you!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>