<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Fast sloth</title>
    <description>The latest articles on DEV Community by Fast sloth (@msgbsm).</description>
    <link>https://dev.to/msgbsm</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F628258%2Fc0155e05-df18-4844-94cd-b791d7e4a2c1.png</url>
      <title>DEV Community: Fast sloth</title>
      <link>https://dev.to/msgbsm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/msgbsm"/>
    <language>en</language>
    <item>
      <title>Deal with the *Host* header field</title>
      <dc:creator>Fast sloth</dc:creator>
      <pubDate>Wed, 14 Jul 2021 12:45:00 +0000</pubDate>
      <link>https://dev.to/msgbsm/deal-with-the-host-header-field-30g4</link>
      <guid>https://dev.to/msgbsm/deal-with-the-host-header-field-30g4</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ta12ews6aaxhzc40mwo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ta12ews6aaxhzc40mwo.png" alt="http_request"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Performing HTTP requests is a routine task for a web developer nowadays.&lt;/p&gt;

&lt;p&gt;This action contains, though, a number of things that are not necessarily well understood.&lt;/p&gt;

&lt;h2&gt;
  
  
  The &lt;strong&gt;Host&lt;/strong&gt; header
&lt;/h2&gt;

&lt;p&gt;One of these things is the &lt;a href="https://datatracker.ietf.org/doc/html/rfc7230#section-5.4" rel="noopener noreferrer"&gt;Host header&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;Host&lt;/code&gt; header is a required one in &lt;code&gt;HTTP&lt;/code&gt; requests:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A client MUST send a Host header field in an HTTP/1.1 request even if&lt;br&gt;
   the request-target is in the absolute-form, since this allows the&lt;br&gt;
   Host information to be forwarded through ancient HTTP/1.0 proxies&lt;br&gt;
   that might not have implemented Host.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Wait a moment! How come I've never needed to deal with it ? How come it does not ring a bell with me ?&lt;/p&gt;

&lt;p&gt;These questions are absolutely legit.&lt;br&gt;
Since &lt;code&gt;Host&lt;/code&gt; is required, browsers and even &lt;a href="https://curl.se/" rel="noopener noreferrer"&gt;curl&lt;/a&gt; set it by default to the provided hostname.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Try to run these commands from your terminal:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;request with hostname ✅
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ curl -vvvI stackoverflow.com

&amp;gt; HEAD / HTTP/1.1
&amp;gt; Host: stackoverflow.com
&amp;gt; User-Agent: curl/7.64.1
&amp;gt; Accept: */*
&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;request with ip address ❌
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ curl -vvvI 151.101.65.69

&amp;gt; HEAD / HTTP/1.1
&amp;gt; Host: 151.101.65.69
&amp;gt; User-Agent: curl/7.64.1
&amp;gt; Accept: */*
&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please notice the line &lt;code&gt;&amp;gt; Host:&lt;/code&gt; for each command 💡. Got it?&lt;/p&gt;

&lt;p&gt;Let's talk about the wrong request.&lt;br&gt;
If you execute the command number 2, you will notice that the response is an error.&lt;br&gt;
This is due to the fact that when the request arrives til &lt;code&gt;stackoverflow&lt;/code&gt; server, it cannot go any further as one IP address can host many websites.&lt;br&gt;
So the web server gets confused and most likely returns &lt;code&gt;500 Domain Not Found&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Knowing how to deal with the &lt;code&gt;Host&lt;/code&gt; header comes in handy when one needs to connect to a website through an ssh tunnel for instance.&lt;/p&gt;

&lt;p&gt;A Post is coming soon to explain how this can be done 🚀.&lt;/p&gt;

</description>
      <category>http</category>
      <category>headers</category>
      <category>web</category>
    </item>
    <item>
      <title>Vim that!!</title>
      <dc:creator>Fast sloth</dc:creator>
      <pubDate>Sun, 27 Jun 2021 17:17:06 +0000</pubDate>
      <link>https://dev.to/msgbsm/vim-that-3d2c</link>
      <guid>https://dev.to/msgbsm/vim-that-3d2c</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;I vim&lt;br&gt;
You vim&lt;br&gt;
He/She vims&lt;br&gt;
we vim&lt;br&gt;
You vim&lt;br&gt;
they vim&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Vim's powerful. (I love &lt;code&gt;vim&lt;/code&gt;)&lt;br&gt;
Vim's easy. (I use &lt;code&gt;vim&lt;/code&gt; on daily basis)&lt;/p&gt;

&lt;p&gt;I bet you agree &lt;strong&gt;JUST&lt;/strong&gt; with the first statement, don't you?&lt;/p&gt;

&lt;p&gt;Well, let me just explain something and we'll talk about &lt;code&gt;vim&lt;/code&gt; being easy or hard.&lt;/p&gt;
&lt;h1&gt;
  
  
  It's all about understanding the key-parts
&lt;/h1&gt;

&lt;p&gt;In order to leverage the most of &lt;code&gt;vim&lt;/code&gt; without spending a lot of time, we need to be smart.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to talk to vim
&lt;/h2&gt;

&lt;p&gt;Let's get started with an extremely important part.&lt;br&gt;
&lt;code&gt;vim&lt;/code&gt; has three important things that are surely required steps to master it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Verbs&lt;/li&gt;
&lt;li&gt;Modifiers&lt;/li&gt;
&lt;li&gt;Nouns
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# sample.txt

Line 1 before comma, after comma.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;I open the file &lt;code&gt;sample.txt&lt;/code&gt; and I put my cursor on the &lt;code&gt;f&lt;/code&gt; of &lt;code&gt;before&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If I type &lt;code&gt;dt,&lt;/code&gt;, &lt;code&gt;sample.txt&lt;/code&gt; will turn into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# sample.txt

Line 1 be, after comma.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break &lt;code&gt;dt,&lt;/code&gt; down:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;d&lt;/code&gt; (verb): &lt;code&gt;d&lt;/code&gt;elete&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;t&lt;/code&gt; (modifier): un&lt;code&gt;t&lt;/code&gt;il&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;,&lt;/code&gt; (noun): comma&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It makes a lot more sense now!&lt;br&gt;
&lt;code&gt;dt,&lt;/code&gt; -&amp;gt; &lt;code&gt;d&lt;/code&gt;elete un&lt;code&gt;t&lt;/code&gt;il the next &lt;code&gt;,&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next ?
&lt;/h2&gt;

&lt;p&gt;I'll leave it there.&lt;/p&gt;

&lt;p&gt;You can easily look for vim verbs/modifiers/nouns on google.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;vim&lt;/code&gt; is about continuous learning on a daily basis, at least from my point of view.&lt;/p&gt;

</description>
      <category>vim</category>
    </item>
  </channel>
</rss>
