Dubstep
Dubstep

Reputation: 147

How do I limit request data being sent from server?

I'm trying to get a lot of requests, but I only need a part of the data near the start of the webpage html. Since right now I'm requesting for the whole webpage each time I request, it takes a lot of network usage to loop it. Can I request only a section of a website html, with any module?

Upvotes: 1

Views: 159

Answers (1)

Juraj Martinka
Juraj Martinka

Reputation: 4358

If you know the specific number of bytes that is enough, then you can request a partial "range" of the resource:

curl -q http://www.example.com -i -H "Range: bytes=0-50"
HTTP/1.1 206 Partial Content
Accept-Ranges: bytes
Age: 506953
Cache-Control: max-age=604800
Content-Range: bytes 0-50/1256
...
Content-Length: 51

<!doctype html>
<html>
<head>
    <title>Example Do% 

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests

Upvotes: 1

Related Questions