You are reading a single comment by @MaBe and its replies. Click here to read the full conversation.
  • Here is the reason why 'close' is helpful when connection via browser

    printing details on Espruino site for calling by browser

    req.headers {
      "Host": "192.168.194.139",
      "Connection": "keep-alive",       <--- reason for sending close
      "Cache-Control": "max-age=0",
      "Upgrade-Insecure-Requests": "1",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
      "Sec-Metadata": "cause=\"forced\", destination=\"document\", site=\"cross-site\"",
      "Accept": "text/html,application/xhtml+xml,applica­tion/xml;q=0.9,image/webp,image/apng,*/*­;q=0.8",
      "Accept-Encoding": "gzip, deflate",
      "Accept-Language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7"
     }
    > 
    

    I realized this when trying to upload the code again and got a port in use error

    this is how curl handles it:

    curl -v  192.168.194.139?led1=1
    * Rebuilt URL to: 192.168.194.139/?led1=1
    *   Trying 192.168.194.139...
    * TCP_NODELAY set
    * Connected to 192.168.194.139 (192.168.194.139) port 80 (#0)
    > GET /?led1=1 HTTP/1.1
    > Host: 192.168.194.139
    > User-Agent: curl/7.54.0
    > Accept: */*
    > 
    < HTTP/1.1 200 OK
    < Server: Espruino 2v00.101
    * no chunk, no close, no size. Assume close to signal end   <----
    < 
    * Closing connection 0
    
    
About

Avatar for MaBe @MaBe started