[Bug 12607] New: [HTML DOM][XMLHttpRequest object] Ass property so that: Do not follow location headers

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12607

           Summary: [HTML DOM][XMLHttpRequest object] Ass property so
                    that: Do not follow location headers
           Product: HTML WG
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML5 spec (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: brunoaiss@gmail.com
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


I tried to find a better place to file this but I wasn't able to find it.

I'd like to suggest to extend the specification
http://www.w3.org/TR/XMLHttpRequest/
->3. The XMLHttpRequest Interface
and in:
3.6.4. Infrastructure for the send() method
If the response has an HTTP status code of 301, 302, 303, or 307 

Proposal:
Add the an attribute: 
readwrite attribute followRedirects

What does it do?
This attribute states if the browser should follow location headers or not.

This attribute is only writable while state = 0.
This attribute defaults to true (for backwards compatibility and because the
usual use is to work like this).


Why am I asking for this:
I have been writing browser addons for a while and now I'm writing another one
that uses unrestricted cross origin XMLHttpRequest(). The problem is that the
page I want may return: 200, 302 or 304. When it returns 302 (usually) it
redirects to a page that returns 302 and this repeats 2 more times. When there
is a redirection, I'm not interested anymore because it won't have the content
I want.

My solution, for now:
1. Make the XMLHttpRequest()
2. Check the status code (for 200 or 304)
3. If it's 304, abort.
4. Execute a regex to check the responseText for a match.
5. If it's a match, then execute the code it should, else abort.

Problem: With all those redirects, the time the script uses, the CPU it uses
and the number of requests it must make makes this background extension a
really heavy duty for something as small as this is.

If this is approved I can make a much better code:
1. Make the XMLHttpRequest()
2. Check the status code (for 200, 302 or 304)
3. if it's 302 or 304 abort
4. execute the code it should

No regex -> Much faster code
No unecessary redirects -> Does not occupy the connections unecessary -> Much
faster code and more proper background execution.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Thursday, 5 May 2011 12:33:55 UTC