Puma Webserver gives “Http malformed” error when called from Azure IoT Dev Kit HttpClientSinatra app that redirects POST/GET requests with parametersLocal SSL with Ruby / PumaUbuntu development configuration with SSL, Puma, and RailsAzure Mobile App redirecting Http POST calls to GET when Azure Active Directory Authentication is enabledHTTP POST request with JSON payload from react app returns net::ERR_SSL_PROTOCOL_ERROR(chrome)Azure function's http trigger is giving 500 internal server errorMicrosoft iot-devkit: while doing the translator tutorial, I get “sorry I can't hear you” errorAZ3166 MXChip DevKit Azure IoT Hub error: Connection Not Accepted: 0x5: Not AuthorizedSSL with Puma, HTTP parse error, malformed request

What LISP compilers and interpreters were available for 8-bit machines?

Incremental Ranges!

Why does Kathryn say this in 12 Monkeys?

You've spoiled/damaged the card

Deformation of rectangular plot

What risks are there when you clear your cookies instead of logging off?

Avoiding cliches when writing gods

Can a user sell my software (MIT license) without modification?

What is the advantage of carrying a tripod and ND-filters when you could use image stacking instead?

Approximate solutions to non polynomial equations

Building a road to escape Earth's gravity by making a pyramid on Antartica

Why does this sentence use 东西?

Is it recommended against to open-source the code of a webapp?

Etymology of 'calcit(r)are'?

After the loss of Challenger, why weren’t Galileo and Ulysses launched by Centaurs on expendable boosters?

Average spam confidence

Company did not petition for visa in a timely manner. Is asking me to work from overseas, but wants me to take a paycut

What are the words for people who cause trouble believing they know better?

Do the English have an ancient (obsolete) verb for the action of the book opening

What's the correct term for a waitress in the Middle Ages?

Traffic law UK, pedestrians

How hard would it be to convert a glider into an powered electric aircraft?

siunitx error: Invalid numerical input

How were concentration and extermination camp guards recruited?



Puma Webserver gives “Http malformed” error when called from Azure IoT Dev Kit HttpClient


Sinatra app that redirects POST/GET requests with parametersLocal SSL with Ruby / PumaUbuntu development configuration with SSL, Puma, and RailsAzure Mobile App redirecting Http POST calls to GET when Azure Active Directory Authentication is enabledHTTP POST request with JSON payload from react app returns net::ERR_SSL_PROTOCOL_ERROR(chrome)Azure function's http trigger is giving 500 internal server errorMicrosoft iot-devkit: while doing the translator tutorial, I get “sorry I can't hear you” errorAZ3166 MXChip DevKit Azure IoT Hub error: Connection Not Accepted: 0x5: Not AuthorizedSSL with Puma, HTTP parse error, malformed request






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm coding on the MXCHIP and I want to use the HttpClient from the Azure IoT devkit to connect to my own web service.



The code "works", since my endpoint is called, but the server (Sinatra with Puma web server) complains that the http request is malformed, and it seems from my investigations that its because the client seems to request SSL. But nothing in my code does that.



I have this simple Sinatra server:



require 'sinatra'
require 'json'

set :bind, '0.0.0.0'

get '/door' do
puts "X #params['axis_x']"
puts "Y #params['axis_y']"
puts "Z #params['axis_z']"

content_type :text
puts JSON.pretty_generate(request.env)
end


and the client does nothing fancy (some code removed for readability):



HTTPClient *httpClient = new HTTPClient(HTTP_GET, url);
const Http_Response *result = httpClient->send();
if (result == NULL)
/* error handling */

delete httpClient;


the code works and the GET request with some query parameters arrive at the server, but the server always prints:



HTTP parse error, malformed request (): #<Puma::HttpParserError: 
Invalid HTTP format, parsing fails.>


My googling tells me that this is something that I could get if I use an URL that starts with "https://", but I am not doing that. It starts with http://



I get the call, and all query parameters, so why is Puma printing this error?



Also, If I construct the URL in a browser, I don't get this error in Puma. So what is the problems with Azure IoT DevKit HttpClient?










share|improve this question






























    0















    I'm coding on the MXCHIP and I want to use the HttpClient from the Azure IoT devkit to connect to my own web service.



    The code "works", since my endpoint is called, but the server (Sinatra with Puma web server) complains that the http request is malformed, and it seems from my investigations that its because the client seems to request SSL. But nothing in my code does that.



    I have this simple Sinatra server:



    require 'sinatra'
    require 'json'

    set :bind, '0.0.0.0'

    get '/door' do
    puts "X #params['axis_x']"
    puts "Y #params['axis_y']"
    puts "Z #params['axis_z']"

    content_type :text
    puts JSON.pretty_generate(request.env)
    end


    and the client does nothing fancy (some code removed for readability):



    HTTPClient *httpClient = new HTTPClient(HTTP_GET, url);
    const Http_Response *result = httpClient->send();
    if (result == NULL)
    /* error handling */

    delete httpClient;


    the code works and the GET request with some query parameters arrive at the server, but the server always prints:



    HTTP parse error, malformed request (): #<Puma::HttpParserError: 
    Invalid HTTP format, parsing fails.>


    My googling tells me that this is something that I could get if I use an URL that starts with "https://", but I am not doing that. It starts with http://



    I get the call, and all query parameters, so why is Puma printing this error?



    Also, If I construct the URL in a browser, I don't get this error in Puma. So what is the problems with Azure IoT DevKit HttpClient?










    share|improve this question


























      0












      0








      0








      I'm coding on the MXCHIP and I want to use the HttpClient from the Azure IoT devkit to connect to my own web service.



      The code "works", since my endpoint is called, but the server (Sinatra with Puma web server) complains that the http request is malformed, and it seems from my investigations that its because the client seems to request SSL. But nothing in my code does that.



      I have this simple Sinatra server:



      require 'sinatra'
      require 'json'

      set :bind, '0.0.0.0'

      get '/door' do
      puts "X #params['axis_x']"
      puts "Y #params['axis_y']"
      puts "Z #params['axis_z']"

      content_type :text
      puts JSON.pretty_generate(request.env)
      end


      and the client does nothing fancy (some code removed for readability):



      HTTPClient *httpClient = new HTTPClient(HTTP_GET, url);
      const Http_Response *result = httpClient->send();
      if (result == NULL)
      /* error handling */

      delete httpClient;


      the code works and the GET request with some query parameters arrive at the server, but the server always prints:



      HTTP parse error, malformed request (): #<Puma::HttpParserError: 
      Invalid HTTP format, parsing fails.>


      My googling tells me that this is something that I could get if I use an URL that starts with "https://", but I am not doing that. It starts with http://



      I get the call, and all query parameters, so why is Puma printing this error?



      Also, If I construct the URL in a browser, I don't get this error in Puma. So what is the problems with Azure IoT DevKit HttpClient?










      share|improve this question
















      I'm coding on the MXCHIP and I want to use the HttpClient from the Azure IoT devkit to connect to my own web service.



      The code "works", since my endpoint is called, but the server (Sinatra with Puma web server) complains that the http request is malformed, and it seems from my investigations that its because the client seems to request SSL. But nothing in my code does that.



      I have this simple Sinatra server:



      require 'sinatra'
      require 'json'

      set :bind, '0.0.0.0'

      get '/door' do
      puts "X #params['axis_x']"
      puts "Y #params['axis_y']"
      puts "Z #params['axis_z']"

      content_type :text
      puts JSON.pretty_generate(request.env)
      end


      and the client does nothing fancy (some code removed for readability):



      HTTPClient *httpClient = new HTTPClient(HTTP_GET, url);
      const Http_Response *result = httpClient->send();
      if (result == NULL)
      /* error handling */

      delete httpClient;


      the code works and the GET request with some query parameters arrive at the server, but the server always prints:



      HTTP parse error, malformed request (): #<Puma::HttpParserError: 
      Invalid HTTP format, parsing fails.>


      My googling tells me that this is something that I could get if I use an URL that starts with "https://", but I am not doing that. It starts with http://



      I get the call, and all query parameters, so why is Puma printing this error?



      Also, If I construct the URL in a browser, I don't get this error in Puma. So what is the problems with Azure IoT DevKit HttpClient?







      azure sinatra puma azure-iot-sdk iot-devkit






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 19:04









      sergaz

      1437




      1437










      asked Mar 24 at 15:20









      Peter AnderssonPeter Andersson

      1,05911933




      1,05911933






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325290%2fpuma-webserver-gives-http-malformed-error-when-called-from-azure-iot-dev-kit-h%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325290%2fpuma-webserver-gives-http-malformed-error-when-called-from-azure-iot-dev-kit-h%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript