reactphp / http

Event-driven, streaming HTTP client and server implementation for ReactPHP.
https://reactphp.org/http/
MIT License
744 stars 143 forks source link

Should the server params always be defined? #192

Closed gsdevme closed 6 years ago

gsdevme commented 7 years ago

http://www.faqs.org/rfcs/rfc3875.html

4.1.  Request Meta-Variables

   Meta-variables contain data about the request passed from the server
   to the script, and are accessed by the script in a system-defined
   manner.  Meta-variables are identified by case-insensitive names;
   there cannot be two different variables whose names differ in case
   only.  Here they are shown using a canonical representation of
   capitals plus underscore ("_").  A particular system can define a
   different representation.

      meta-variable-name = "AUTH_TYPE" | "CONTENT_LENGTH" |
                           "CONTENT_TYPE" | "GATEWAY_INTERFACE" |
                           "PATH_INFO" | "PATH_TRANSLATED" |
                           "QUERY_STRING" | "REMOTE_ADDR" |
                           "REMOTE_HOST" | "REMOTE_IDENT" |
                           "REMOTE_USER" | "REQUEST_METHOD" |
                           "SCRIPT_NAME" | "SERVER_NAME" |
                           "SERVER_PORT" | "SERVER_PROTOCOL" |
                           "SERVER_SOFTWARE" | scheme |
                           protocol-var-name | extension-var-name
      protocol-var-name  = ( protocol | scheme ) "_" var-name
      scheme             = alpha *( alpha | digit | "+" | "-" | "." )
      var-name           = token
      extension-var-name = token

Figs states the following about getServerParams

     * Retrieves data related to the incoming request environment,
     * typically derived from PHP's $_SERVER superglobal. The data IS NOT
     * REQUIRED to originate from $_SERVER.

Im wondering if in the above they should at least exist or is that not the job of this package?

I've made a PR to the package as they can guard for it also.. but Im wondering whats best also https://github.com/zendframework/zend-expressive/pull/489

clue commented 7 years ago

Thanks for bringing this up! :+1: The first batch of server params has been implemented via #174 and I'm sure there's room for improvement if certain params are missing. May I ask you to file a PR so we can look into this? :shipit:

gsdevme commented 7 years ago

Sure, are you happy with the idea of defining all in the meta variables in RFC3875? Some of them are 'more worth' than others though.. CONTENT-LENGTH for the request and such and AUTH_TYPE like are not used much

clue commented 7 years ago

Not sure what's reasonable here without diving deeper into this tbh. There's no need to implement this according to the CGI specs, but there are certainly a group of parameters not otherwise available or so commonly used that it makes sense to also add them here. I'd suggest going for these first :+1:

clue commented 6 years ago

Closed via #195