Heading host on request for non-standard port



  • When asked for the server, would it be in the headline? host Do you want a port number?

    Looks like Download Master's sending this request:

    GET http://localhost:8080/ HTTP/1.1
    User-Agent: Download Master
    Accept: */*
    Accept-Encoding: identity
    Referer: http://localhost:8080/
    Host: localhost
    

    And before I do my nodejs, it doesn't work.

    If you put it in the heading host Port number, it's working.

    GET http://localhost:8080/ HTTP/1.1
    User-Agent: Download Master
    Accept: */*
    Accept-Encoding: identity
    Referer: http://localhost:8080/
    Host: localhost:8080
    

    If you remove the title hostit works, too.

    As far as I'm concerned, it's not right to clean up. He's supposed to be here.
    What about the port number, is it supposed to be there?


    Turns out Download Master is actually sending a request for a relative url at port 8080:

    GET / HTTP/1.1
    User-Agent: Download Master
    Accept: */*
    Accept-Encoding: identity
    Referer: http://localhost:8080/
    Cache-Control: no-cache
    Host: localhost
    


  • Contemporary (05.01.2016) HTTP protocol is described in https://www.rfc-editor.org/rfc/rfc7230 ♪

    Excerpt from paragraph 5.4., describing the title HOSTthis standard:

    1. Send the headline Host in all HTTP/1.1 requests 2. If URI contains the authority component, the client of JOLEN shall send the Host value identical authority component, with the exception of the user name (separated @). 3. The earring will answer code 400 (Bad Request) to any HTTP/1.1 request with a missing or incorrect heading Host.

    Para. 2.7.1. authority component as consisting of Hosta name And, alternatively, TCP port https://www.rfc-editor.org/rfc/rfc3986#section-3.2.3 )

    There is a phrase further in paragraph 2.7.1.:

    If the port is empty or not, TCP port 80 (reserved for WWW) shall be default.

    So Download Master violates the HTTP standard by pointing out in the heading Host value different from authority component indicated in URI (i.e., without port number, with URI indicating it). What server should I'll tell him no code 400.

    I will note that the standard for HTTP/1.0 was less demanding and allowed HTTP requests free heading HOST♪ Following this, most web servers are allowed without a title for any reason. HOST and for HTTP/1.1 (which in principle does not conform to standard 1.1)

    Total: Yes, in the headline of the Host Port, which is different from 80, the absence of a port in URI, according to paragraph 2.7.1. of the standard, implies port 80 and, according to paragraph 5.4., Host shall contain the same definition of the server as URI.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2