<?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>17046</bug_id>
          
          <creation_ts>2012-05-14 13:48:23 +0000</creation_ts>
          <short_desc>Implement redirect audit functionality for XHR</short_desc>
          <delta_ts>2013-02-19 14:05:36 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>XHR</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Windows 3.1</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>12607</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexey Baranov">baranovich</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>julian.reschke</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>67647</commentid>
    <comment_count>0</comment_count>
    <who name="Alexey Baranov">baranovich</who>
    <bug_when>2012-05-14 13:48:23 +0000</bug_when>
    <thetext>Most of the time people talk (e.g. Stackoverflow) about controlling XHR redirect, they don&apos;t mean really _controlling_ redirects, they mean 2 simple things:
 - figure out, whether it was redirect or was not.
 - get final redirect url (or maybe interstitial).

From http://lists.w3.org/Archives/Public/public-webapps/2010JulSep/thread.html#msg474 it is seen that everything is not so simple with implementation of user-controlled redirects. But also, there was a phrase 

&gt; However, if the use case is only
&gt; auditing redirects, then
&gt; ...

So maybe for most of the needs there it will be enough to implement such audit, without touching current redirect behaviour. It may satisfy more than 90% of the requests about &quot;controlling redirects&quot;.

For example XMLHttpRequest object may have a property called &quot;redirects&quot; or smth, containing array of objects:
{url: &quot;whatever-no-matter-relative-or-absolute&quot;, {headers*}?}
Semantically this array will be a linked list, i.e. first element will be initial resource request details and last - final one&apos;s.

Full implementation of XHR redirects is not so straightforward, but implementation of such &quot;redirect audit&quot; is quite simple although very useful, and it will be good to have such thing in XHR standard.

Problem:
As almost always, the problem rose from chrome extensions development. We have to follow redirect and detect that fact as well as the final URL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67705</commentid>
    <comment_count>1</comment_count>
    <who name="Julian Reschke">julian.reschke</who>
    <bug_when>2012-05-15 07:50:37 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; Most of the time people talk (e.g. Stackoverflow) about controlling XHR
&gt; redirect, they don&apos;t mean really _controlling_ redirects, they mean 2 simple
&gt; things:
&gt;  - figure out, whether it was redirect or was not.
&gt;  - get final redirect url (or maybe interstitial).
&gt; 
&gt; From
&gt; http://lists.w3.org/Archives/Public/public-webapps/2010JulSep/thread.html#msg474
&gt; it is seen that everything is not so simple with implementation of
&gt; user-controlled redirects. But also, there was a phrase 
&gt; 
&gt; &gt; However, if the use case is only
&gt; &gt; auditing redirects, then
&gt; &gt; ...
&gt; 
&gt; So maybe for most of the needs there it will be enough to implement such audit,
&gt; without touching current redirect behaviour. It may satisfy more than 90% of
&gt; the requests about &quot;controlling redirects&quot;.
&gt; 
&gt; For example XMLHttpRequest object may have a property called &quot;redirects&quot; or
&gt; smth, containing array of objects:
&gt; {url: &quot;whatever-no-matter-relative-or-absolute&quot;, {headers*}?}

... status code ...

&gt; Semantically this array will be a linked list, i.e. first element will be
&gt; initial resource request details and last - final one&apos;s.
&gt; 
&gt; Full implementation of XHR redirects is not so straightforward, but
&gt; implementation of such &quot;redirect audit&quot; is quite simple although very useful,
&gt; and it will be good to have such thing in XHR standard.
&gt; 
&gt; Problem:
&gt; As almost always, the problem rose from chrome extensions development. We have
&gt; to follow redirect and detect that fact as well as the final URL.

I appreciate the attempt to simplify the problem. However I don&apos;t think it&apos;s sufficient. I really believe we either need the ability to veto a redirect (callback + information similar to what you proposed above), or a simple switch that turns of following redirects completely (that latter would be useful for UAs that still do not get method rewriting in redirects right, such as Opera and Safari.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67707</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-05-15 08:33:59 +0000</bug_when>
    <thetext>Julian, FYI, introducing a new feature to work around a bug is not a valid argument for the new feature.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67711</commentid>
    <comment_count>3</comment_count>
    <who name="Julian Reschke">julian.reschke</who>
    <bug_when>2012-05-15 09:13:10 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Julian, FYI, introducing a new feature to work around a bug is not a valid
&gt; argument for the new feature.

It&apos;s not just to workaround a bug; there are cases where it&apos;s just simpler to tell XHR not to follow redirects (in fact, that should have been the default).

That being said, I&apos;ll remind you of this comment once Opera supports new XHR features but still has broken redirect handling :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83322</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-02-19 14:05:36 +0000</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 12607 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>