Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-316

httpc client redirection either malfunctioning or unclear

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 19.1, 19.1.1
    • Fix Version/s: 19.3
    • Component/s: inets
    • Labels:
      None

      Description

      Firefox and Safari behave different from HTTPC

      When a webserver responses with 302, the client gets a new location to redirect the request to.
      The httpc server has autoredirect by default set to true and following the redirects is expected.

      While using an industrial web service, I used httpc to follow a link that was redirected. This did not work. The wireshark indicated that after the second redirect, the port was kind of lost and a request went out to localhost instead of localhost:8090.

      I tried to find out what the reason is, but didn't get the whole way.
      Attached is a little webserver based on httpd. Whenever we request page http://localhost:8090/0, we get "Welcome". If the Path is a digit larger than 0, say 2, then the page is redirected to N-1.
      Thus, localhost:8090/2 is redirected with status 302 to localhost:8090/1 and then to localhost:8090/0, resulting in the "Welcome" page.

      Both Safari and Firefox (both on Mac), do understand this redirection and get to the Welcome page.

      When I use httpc, I get a timeout. This timeout differs from the error message I got originally, viz, getting redirected to localhost/... instead of localhost:8090/...., thus I may be doing something wrong there.

      But even a timeout is weird. Even when I do set

      {autoredirect, false}

      , then I get a timeout.
      Tracing the wire shows differences in TCP, but the response comes back from the webservice.

      The http request is stuck in the receive loop starting at line 621 of httpc.erl

      Appreciated if a Web Server expert can give me some hints to dig deeper into this.

        Attachments

          Activity

            People

            Assignee:
            ingela Ingela Anderton Andin
            Reporter:
            QuickCheck Thomas Arts
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: