C
C
Coder 14482021-12-08 15:23:58
Computer networks
Coder 1448, 2021-12-08 15:23:58

How to get part of the response to an http request?

The server sends 200kb of data via http to a get request. How can I get 20kb of answer? I don't need the whole answer, but I need to save traffic.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Karabanov, 2021-12-08
@wows15

Write a script that will open the socket on its own, write request headers to it, read the response headers and the first 20 kilobytes, and then close the socket.

V
vreitech, 2021-12-08
@fzfx

in general, no way. the HTTP protocol as such does not provide for reducing the amount of transmitted data if the recipient does not need something.
on the other hand, CURL supports requesting a specific range of bytes via URL, read about the --range.

P
pfg21, 2021-12-08
@pfg21

send after 20 kb
GET / HTTP/1.1
Connection: close
or close TCP connection ??

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question