locked
HTTP/1.1 400 Bad Request (Invalid Verb) error

    Question

  • Hello,

     

       I've written a proxy server for transmitting request to destination web server and log the response. But when I input the Url In IE and press [enter], the proxy server really received the request, and I do some modification (pleaes see the following), then send it to the destination web server. I got the following error message ..., is there anyone encountered the problem, how can I solve the problem?
       Thank you,
       Best Regards,
         PolarBear 03/28
      

    Note: Proxy Server is proxy.polarbear.com:60081

              Destination Web Server is polar2003.polarbear.com  
         
    // ================= Error Message ================
      
    HTTP/1.1 400 Bad Request
    Content-Type: text/html
    Date: Wed, 28 Mar 2007 11:13:30 GMT
    Connection: close
    Content-Length: 35

    <h1>Bad Request (Invalid Verb)</h1>

     

    // ================= Original Request ================
    GET /testHttpMethods1/testPostAll.aspx HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
    Accept-Language: zh-tw
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
    Host: proxy.polarbear.com:60081
    Connection: Keep-Alive

     

    // ================= Modified Request ================
    GET http://polar2003.polarbear.com/testHttpMethods1/testPostAll.aspx HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
    Accept-Language: zh-tw
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
    Host: polar2003.polarbear.com
    Connection: Keep-Alive

    Wednesday, March 28, 2007 12:14 PM

All replies

  • The only difference I see is that you have included the host following the GET in the Modified request. Try without it as

    GET /testHttpMethods1/testPostAll.aspx

    Wednesday, March 28, 2007 4:02 PM
    Moderator
  •  

    Hi,

        Thanks for your help. 

        I've modified my proxy server as you said in the previous reply, but is still show me the same error ...

        The following is the related information.  The error message is appended by my original page ....

        Is there any other ideas?
          Thank you,
          Best Regards,
                     PolarBear 03/28
      

    Note: Proxy Server is proxy.polarbear.com:60081

              Destination Web Server is polar2003.polarbear.com 

              IE Input Url is http://proxy.polarbear.com:60081/testHttpMethods1/testPostAll.aspx   

                      
         
    // ================= Error Message ================
      
    HTTP/1.1 400 Bad Request
    Content-Type: text/html
    Date: Wed, 29 Mar 2007 02:12:02 GMT
    Connection: close
    Content-Length: 35

    <h1>Bad Request (Invalid Verb)</h1>

     

    // ================= Original Request ================
    GET /testHttpMethods1/testPostAll.aspx HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
    Accept-Language: zh-tw
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
    Host: proxy.polarbear.com:60081
    Connection: Keep-Alive

     

    // ================= Modified Request ================
    GET /testHttpMethods1/testPostAll.aspx HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
    Accept-Language: zh-tw
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
    Host: polar2003.polarbear.com
    Connection: Keep-Alive

     

    // ================= Returned Response ================

    HTTP/1.1 200 OK
    Date: Thu, 29 Mar 2007 02:12:02 GMT
    Server: Microsoft-IIS/6.0
    MicrosoftOfficeWebServer: 5.0_Pub
    X-Powered-By: ASP.NET
    X-AspNet-Version: 1.1.4322
    UserEmail: RMSAdmin@polarbear.com
    UserRights: 25
    Set-Cookie: ASP.NET_SessionId=gw1h2iirgwkls4455pcas3ej; path=/
    Cache-Control: private
    Content-Type: text/html; charset=utf-8
    Content-Length: 3339

    <h5>Now: 20070329 101202 562</h5>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <title>testPostAll</title>
      <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
      <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
      <meta content="JavaScript" name="vs_defaultClientScript">
      <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
     </HEAD>
     <body MS_POSITIONING="FlowLayout">
      <h2>HTTP-POST TEST</h2>
      <hr>
      <h5>Test for Http Post, submit to the original page</h5>
      <form name="Form1" method="post" action="testPostAll.aspx" id="Form1">
    <input type="hidden" name="__VIEWSTATE" value="dDwxMDU2NzQ3MTI1Ozs+hmlZ+iksC1ubfdj0oUC5Xc3Wcmc=" />

    ...  
    ...

      </form>
     </body>
    </HTML>
    HTTP/1.1 400 Bad Request
    Content-Type: text/html
    Date: Thu, 29 Mar 2007 02:12:02 GMT
    Connection: close
    Content-Length: 35

    <h1>Bad Request (Invalid Verb)</h1>

    Thursday, March 29, 2007 2:31 AM
  • Hi,

     

    Have you solve this problem yet?

    I encounter the problem these days. I wrote an application using win socket to post data to some web page written in VB.Net, running on IIS6. The page works fine on Windows 2000/IIS 5, but appends the "Bad Request" message on IIS 6. What I did is take only take as many characters as Content-Length indicates. @_@

     

     

    Tuesday, September 11, 2007 4:43 PM
  • Hi,

     

    Sorry, as you said, I just use Content-Length to get the response stream to discard the "Bad Request" message ..., I don't have a more better solution up to now.  

    Wednesday, September 19, 2007 6:46 AM
  • In my case, I send POST requst to aspx page. These days I found that if I add 1 to the Content-Length field in my request, the error message disappears. I guess IIS6 expects one byte less than the request Content-Length, and will take the "extra" byte as next request. 

     

    Just a wild guess, if you rip out the byte 0x0A at the end of your GET request, maybe it will work...

     

    Tuesday, October 09, 2007 1:58 PM