Axis-C++
  1. Axis-C++
  2. AXISCPP-1059

HTTPTransport generates duplicate "Authentication: " headers

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current (nightly)
    • Fix Version/s: current (nightly)
    • Component/s: Transport (axis3)
    • Labels:
      None
    • Environment:
      Any

      Description

      Source file "axis/trunk/c/src/transport/axis3/HTTPTransport.cpp", line 360.
      When generateHTTPHeaders() calls setTransportProperty("Authorization", ...), the later does NOT replace existing "Authentication: " header but add another one. My application uses the same stub to call the same service repeatedly. This resulted in increasingly more and more duplicate "Authentication: " header being sent to the service. After a while, the service refuses the request.

      The common practice is that "set" replaces duplicate key/value pairs, while "add" implies the acceptance of duplicate keys. setTransportProperty(const char*, const char*) only remove duplicates of 3 know headers, "Connection", "Content-Length" and "SOAPAction". This is a design flaw. There should be two sibling member functions:

      setTransportProperty(const char*, const char*)
      addTransportProperty(const char*, const char*)

        Activity

        Hide
        nadir amra added a comment -

        I have fixed the setTransportProperty() so that it replaces an existing property with same key.

        I have not added an addTransportProperty() since I do not see the need for such a method.

        Closely related to this issue was the code emitter that checked to see if SOAPAction was already set before setting it. This causes problems when the stub is used to call 2 different operations....the second SOAP request contained the SOAPAction value of the first operation because of the following:

        if (NULL==m_pCall->getTransportProperty("SOAPAction",false))
        m_pCall->setTransportProperty(SOAPACTION_HEADER , "xxxxxx");

        I simply removed the if-check and ensured that setTransportProperty() was always invoked.

        Show
        nadir amra added a comment - I have fixed the setTransportProperty() so that it replaces an existing property with same key. I have not added an addTransportProperty() since I do not see the need for such a method. Closely related to this issue was the code emitter that checked to see if SOAPAction was already set before setting it. This causes problems when the stub is used to call 2 different operations....the second SOAP request contained the SOAPAction value of the first operation because of the following: if (NULL==m_pCall->getTransportProperty("SOAPAction",false)) m_pCall->setTransportProperty(SOAPACTION_HEADER , "xxxxxx"); I simply removed the if-check and ensured that setTransportProperty() was always invoked.
        Hide
        nadir amra added a comment -

        Forgot to mention changes are in revision (1032462): http://svn.apache.org/viewvc?view=revision&revision=1032462

        Show
        nadir amra added a comment - Forgot to mention changes are in revision (1032462): http://svn.apache.org/viewvc?view=revision&revision=1032462

          People

          • Assignee:
            nadir amra
            Reporter:
            Michael Chen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development