Let's LRun HTTP

Today's Story

Context

  • HTML
  • Python SimpleHTTPServer
  • JAVA Client
  • C Client

HTML

<html>
  <head>
    //Is this comment?
    /*
      nope
    */
    <script>
      //How about this?
      /*Yes You'll be.
      */
    </script>
  </head>
  <body>
    <!--
    Is this comment?
    <div>
    </div>
    -->
    //<div>Joker</div>
    /*
      <div>Why So Serious?</div>
    */
    <span>It's not about the money. It's about sending a message. Everything burns.</span>
  </body>
</html>

Python

$python -m SimpleHTTPServer 8090

CMD

$telnet localhost 8090
/Get

Java

String url = "http://localhost:8000/";
URLConnection connection = new URL(url).openConnection();
InputStream response = connection.getInputStream();

if (charset != null) {
    try (BufferedReader reader = new BufferedReader(new InputStreamReader(response, charset))) {
        for (String line; (line = reader.readLine()) != null;) {
	  System.out.println(line) ;
	}
    }
}

C

CURL *curl;
CURLcode res;

curl = curl_easy_init();
if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "http://localhost:8000/");
    /* example.com is redirected, so we tell libcurl to follow redirection */
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

    /* Perform the request, res will get the return code */
    res = curl_easy_perform(curl);
    /* Check for errors */
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));

    /* always cleanup */
    curl_easy_cleanup(curl);
}

HTTP

Let's LRun HTTP

By Keen Dev

Let's LRun HTTP

  • 824