regarding network request re-ordering

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

regarding network request re-ordering

Kailas-3
Hi,
I am working on a prioritized fetching of resources in a web page by
reordering the network request generated during web page parsing. I know
how to stop a network request in FF add-on.
Could anyone  point out the APIs that I can use in a FF add-on to either
delay any network request or re-initiate cancel HTTP requests.

Thanks,
Kailas
_______________________________________________
dev-tech-network mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-network
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: regarding network request re-ordering

Jason Duell-3
On 06/22/2014 11:24 PM, Kailas wrote:
> Hi,
> I am working on a prioritized fetching of resources in a web page by
> reordering the network request generated during web page parsing. I
> know how to stop a network request in FF add-on.
> Could anyone  point out the APIs that I can use in a FF add-on to
> either delay any network request or re-initiate cancel HTTP requests.
>

You may want to consider setting nsISupportsPriority.priority on
requests.   In HTTP/1.1 (the common case on the web right now) this
doesn't re-prioritize requests that are already connected to servers
(those just complete as normal), but it does order all requests that are
still in a waiting state (i..e don't have an HTTP connection yet).  
Requests with higher priority will get connections sooner.

You can also call suspend() on a channel--that stops OnDataAvailable
from getting called.  In practice that means that the TCP/HTTP
connection will still download data until the OS's TCP buffer is full,
but at that point network traffic for it will be completely stopped
until you call resume().

Other than that, there's always cancel(), which cancels things,
obviously.  You can try to re-initiate with an AsyncOpen that has a
Range: request header to get only the bytes you didn't receive yet (but
the server may not support it, in which case it will simply reply with
the full bytestream).

Can you say more about your use case?

Jason

_______________________________________________
dev-tech-network mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-network
Loading...