locked
HTTP 400 Bad Request RRS feed

  • Question

  • I am trying to POST method to server inorder to recevie audio from device

     

    POST /axis-cgi/audio/transmit.cgi HTTP/1.0\r\n
     Content-Type: audio/basic\r\n
     Content-Length: 9999999\r\n
     Connection: Keep-Alive\r\n
     Cache-Control: no-cache\r\n
     \r\n
     <Audio data>
     <Audio data>
     <Audio data>

     

    The above mention data i have to send as a request in order to implement two way audio

     

    The Code is:

     CInternetSession session;

     CHttpConnection *m_pConnection;
     CHttpFile* pHTTP;

    CString strPreFileData;

     

    strPreFileData = "Content-Type: audio/basic\r\n";
     strPreFileData += "Content-Length: 9999999\r\n";
     strPreFileData += "Connection: Keep-Alive\r\n";
     strPreFileData += "Cache-Control: no-cache\r\n";
     strPreFileData += "\r\n";

     

     m_pConnection=session.GetHttpConnection("10.200.11.63", (INTERNET_PORT)80, "root", "root");

      LPCTSTR content="audio/basic";
      pHTTP = m_pConnection->OpenRequest(0, "axis-cgi/audio/transmit.cgi",NULL,1,&content,"HTTP 1.0",INTERNET_FLAG_EXISTING_CONNECT);
        
      pHTTP->AddRequestHeaders(strPreFileData);

      pHTTP->SendRequestEx(dwTotalRequestLength,HSR_INITIATE,0);
      
      if (0 != dwReadLength)
      {
       pHTTP->Write(pBuffer, dwReadLength);///Write the audio data from a wav file
      
      }

      pHTTP->EndRequest();

      char sz[1024];
      pHTTP->Read(sz,1024);
      CString con;
      con.Format("%s",sz);
      AfxMessageBox(con);

     

    When i execute the above code i am getting HTTP 400 Bad Request message when i am trying to read the response

    Can any help me in this

    Friday, March 7, 2008 5:22 AM

Answers

  • Hi,

     

    HTTP Error 400 means your Web server is unable to understand and process the request you send. So I think you should consult the web server administrator or developer on what requests you should send.

     

    Thanks!

     

    Wednesday, March 12, 2008 6:49 AM

All replies

  • Hi,

     

    HTTP Error 400 means your Web server is unable to understand and process the request you send. So I think you should consult the web server administrator or developer on what requests you should send.

     

    Thanks!

     

    Wednesday, March 12, 2008 6:49 AM
  • I consulted the web server adminstrator but they are giving me the example as the format i mentioned before.

    Any One can guide me regarding this

     

    Wednesday, March 12, 2008 12:09 PM