G
G
GlowMan2019-02-23 11:33:02
API
GlowMan, 2019-02-23 11:33:02

Why is the request sent incorrectly?

Why is the response coming through the browser and not through telnet? I tried to write my own client (it doesn’t work in C, yes in python, but I need it in C), but does it return the same thing there?5c7104d9aad15784337690.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2019-02-23
@DoYouGot

I started writing a comment about almost 20 years of http/1.1 existence, but everything is a bit simpler:
https://tools.ietf.org/html/rfc2616#section-14.23
You grossly violated the standard. You presented yourself as an HTTP/1.1 client, but did not pass the Host header required by this standard.
Incorrect client request is code 400, the server answers you correctly.
The minimum possible request for HTTP/1.1 is two lines:

GET /... HTTP/1.1
Host: api.vk.com

Some more headers may be required, but this is already necessary. Browsers typically send a lot of extra headers.
One line was allowed a long time ago for HTTP/1.0, where there could be a maximum of 1 site per IP. Most modern servers will listen to you over HTTP/1.0 but are unlikely to return what you want, because they will not know which domain you are asking about and, accordingly, to which handler to transfer the request.

A
Alexander, 2019-02-23
@NeiroNx

Your request is missing the required headers. Make out request as it is necessary on the standard instead of stupidly GET in one line.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question