You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by wh...@apache.org on 2004/10/12 12:41:44 UTC

cvs commit: ws-axis/c/src/transport/axis2 Axis2Transport.cpp Axis2Transport.h

whitlock    2004/10/12 03:41:44

  Modified:    c/src/transport/axis2 Axis2Transport.cpp Axis2Transport.h
  Log:
  Fix axis2 transport to work on windows by making the storage returned from
  Axis2Transport::getHttpHeaders point to a class field member rather than a
  local variable, which goes out of scope as the method returns. This was a
  bug on all platforms but it only showed up on windows
  
  Revision  Changes    Path
  1.4       +15 -16    ws-axis/c/src/transport/axis2/Axis2Transport.cpp
  
  Index: Axis2Transport.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis2/Axis2Transport.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Axis2Transport.cpp	30 Sep 2004 05:39:51 -0000	1.3
  +++ Axis2Transport.cpp	12 Oct 2004 10:41:44 -0000	1.4
  @@ -114,35 +114,34 @@
   {
       URL& url = m_Channel.getURLObject();
   
  -    std::string strHTTPHeaders = m_strHTTPMethod + " ";
  -    //strHTTPHeaders += std::string(url.getURL()) + " ";
  -    strHTTPHeaders += std::string(url.getResource()) + " ";
  -    strHTTPHeaders += m_strHTTPProtocol + "\r\n";
  +    m_strHeaderToSend = m_strHTTPMethod + " ";
  +    //m_strHeaderToSend += std::string(url.getURL()) + " ";
  +    m_strHeaderToSend += std::string(url.getResource()) + " ";
  +    m_strHeaderToSend += m_strHTTPProtocol + "\r\n";
   
  -    strHTTPHeaders += std::string("Host: ") + url.getHostName();
  +    m_strHeaderToSend += std::string("Host: ") + url.getHostName();
   
       unsigned short port = url.getPort ();
       char buff[8];
       sprintf (buff, "%u", port);
  -    strHTTPHeaders += ":";
  -    strHTTPHeaders += buff;
  -    strHTTPHeaders += "\r\n";
  +    m_strHeaderToSend += ":";
  +    m_strHeaderToSend += buff;
  +    m_strHeaderToSend += "\r\n";
   
  -    strHTTPHeaders += "Content-Type: text/xml; charset=UTF-8\r\n";
  +    m_strHeaderToSend += "Content-Type: text/xml; charset=UTF-8\r\n";
   
       // Set other HTTP headers
       for (unsigned int i = 0; i < m_vHTTPHeaders.size (); i++)
       {
   
  -        strHTTPHeaders += m_vHTTPHeaders[i].first;
  -        strHTTPHeaders += ": ";
  -        strHTTPHeaders += m_vHTTPHeaders[i].second;
  -        strHTTPHeaders += "\r\n";
  +        m_strHeaderToSend += m_vHTTPHeaders[i].first;
  +        m_strHeaderToSend += ": ";
  +        m_strHeaderToSend += m_vHTTPHeaders[i].second;
  +        m_strHeaderToSend += "\r\n";
       }
   
  -    strHTTPHeaders += "\r\n";
  -
  -    return strHTTPHeaders.c_str();
  +    m_strHeaderToSend += "\r\n";
  +    return m_strHeaderToSend.c_str();
   }
   
   const char* Axis2Transport::getHTTPMethod()
  
  
  
  1.4       +5 -0      ws-axis/c/src/transport/axis2/Axis2Transport.h
  
  Index: Axis2Transport.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis2/Axis2Transport.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Axis2Transport.h	30 Sep 2004 05:39:51 -0000	1.3
  +++ Axis2Transport.h	12 Oct 2004 10:41:44 -0000	1.4
  @@ -150,6 +150,11 @@
       std::string m_strBytesToSend;
   
     /**
  +    * Message header to be sent.
  +    */
  +    std::string m_strHeaderToSend;
  +
  +  /**
       * Vector to hold HTTP header key/value pairs
       */
       std::vector < std::pair < std::string, std::string > >m_vHTTPHeaders;