What is Special in HTTP 2.0?

Useful Points: Unlike text protocol HTTP/1.0 & HTTP/1.1, HTTP/2.0 is binary based protocol. So tools like curl are needed to make requests instead of plain telnet. The TCP connection is now multiplexed for multiple requests. So a client should open only one connection. Few browsers support HTTP/2.0 with only TLS. The compression of data is…

HTTP Accelerator Cache: Varnish

HTTP Accelerator Cache: Varnish The Varnish is an open-source reverse proxy server. Its primary purpose is to cache HTTP responses. Besides it also enables modifying HTTP requests/ response to the origin. The Varnish documentation highlights that the server is highly scalable on a multi-core system, efficient (uses mostly kernel services such as kqueue, epoll, memory…

Supershort Intro to TLS

Transport Layer Security Client & Server use a stateful connection over TCP The connection is secured using a symmetric encryption Client indicates to server to use TLS Client usually use a different port (e.g.443) A primary use of TLS is to secure World Wide Web traffic between a website and a web browser encoded with…

curl: (55) Failed sending HTTP POST request

Synopsis I got the curl: (55) Failed sending HTTP POST request error while trying to make a POST call to a pingable URL. The error is misleading. It does not inform about the error cause of the error. Solution Revisit the request carefully. Make sure that all headers are in proper syntax (Key: value) URL…

Dummies Guide to HTTP Cache Control

All modern browsers cache response for a request (HEAD/GET). Cache-Control is primarily meant for browser cache and how & where the server-side caches a response. Max Cache Time Browsers cache a response for the value of max-age response header If the response is expired, the browser can use the previous response Etag and re-request the…

Adding Query Params to a URL in Ruby with HTTP

The clearest example was in a StackOverflow post require 'uri' def add_param(url, param_name, param_value) uri = URI(url) params = URI.decode_www_form(uri.query || "") << [param_name, param_value] uri.query = URI.encode_www_form(params) uri.to_s end You can pass a map of params key & values and get expected URL. Another example # prepare params. params = { 'id' => '12'…

A Resilient Web API Client in Ruby

Ruby HTTP client is not sophisticated enough to handle errors gracefully. I came across a well-designed client for a web service at [AppSignal]. (https://blog.appsignal.com/2018/05/16/ensure-retry-and-reraise-exceptions-in-ruby.html) The code for the client is as following: The code has the following logic: Try to establish a connection with the server. The request has a timeout and connection refused exceptions.…

%d bloggers like this: