Server request value

I was wondering if anyone could explain to me the meaning of the server request? It may just be terminology that I do not quite understand. For me, this sounds like a request from server to client, but I don't think so.

This applies to PHP PSR7. I'm trying to understand why he has both RequestInterface, and so ServerRequestInterface. I can’t judge that anything about this was anywhere, and I see no reason why these two do not just merge into one interface.

+4
source share
2 answers

I agree that it is unclear what they mean by “server side requests”. It is known that HTTP requests are sent by clients (browsers, bots, REST API users, etc.) and are ultimately received by servers. However, the word server can refer to different things in different contexts.

An HTTP request is accepted by an HTTP server such as Apache, Nginx, and Microsoft IIS. Servers provide a Server Programming Interface (SAPI) , which especially allows you to process information after processing by web servers.

PHP (Zend) SAPI (Server API). : CLI ( ), CGI (Common Gateway Interface), Apache, FPM (FastCGI Process Manager) . PHP ().

HTTP- -. PHP - SAPI , , .

RequestInterface HTTP-, cookie, , GET- POST- .., :

RequestInterface ResponseInterface 1:1 , RFC 7230. , HTTP-, .

, URI, , , .

ServerRequestInterface HTTP- (). , , : , cookie, ..

RequestInterface HTTP-, . ServerRequestInterface =), , (SAPI).

+3

, :

RequestInterface HTTP . - . Common Gateway (CGI) , , PHP- CGI API (SAPI). PHP , :

..

ServerRequestInterface RequestInterface . , .

http://www.php-fig.org/psr/psr-7/

+1

Source: https://habr.com/ru/post/1657568/


All Articles