WEBVTT

00:00.260 --> 00:04.130
Hey, everyone, and welcome back to the Knowledge Portal Video series.

00:04.160 --> 00:09.020
Now, in the earlier lecture we were discussing about the Http protocol.

00:09.020 --> 00:15.080
So continuing our journey with it today, we'll be understanding our first Http protocol method, which

00:15.080 --> 00:15.820
is get.

00:16.010 --> 00:18.770
So let's go ahead and understand more about it.

00:20.590 --> 00:28.750
So Http get request is a very simple method which is generally used to fetch the information which is

00:28.750 --> 00:30.160
specified in the request.

00:30.190 --> 00:30.640
Uri.

00:31.270 --> 00:35.710
So the syntax is get followed by the request uri.

00:35.740 --> 00:41.170
So if you're not aware what a request Uri is all about, let's take a very simple example for this.

00:42.010 --> 00:47.800
So I'll open up my atom editor and there are three URLs which are present over here.

00:47.830 --> 00:51.760
One is Dexter's labs in slash sample dot HTML.

00:51.790 --> 00:58.990
Then you have Dexter's labs in slash index.html and Dexter labs in slash video dot mp4.

00:59.290 --> 01:02.500
Now in all of these the first.

01:04.100 --> 01:07.340
Entity remains the same, which is Dexter Labs.

01:07.560 --> 01:14.510
And so you find that the server is the same and then you have a unique resource which you are mentioning

01:14.510 --> 01:14.930
over here.

01:15.140 --> 01:19.940
So this is the unique resource or a unique file is sample dot HTML.

01:20.060 --> 01:25.310
In the second request you have index dot HTML and the third request that is video dot mp4.

01:25.670 --> 01:33.590
So this specific parameter which signifies the unique file within the server is called as the request

01:33.620 --> 01:34.190
uri.

01:34.490 --> 01:36.290
So let's try this out.

01:36.290 --> 01:40.250
So I'll copy this and I'll paste it here.

01:40.610 --> 01:44.690
So now you have a sample dot HTML file.

01:44.840 --> 01:52.370
Let's modify this and put index dot HTML and you have a different page load altogether.

01:52.370 --> 01:54.220
So you have a different page over here.

01:54.230 --> 01:55.730
You have a different page over here.

01:55.880 --> 02:01.730
The reason is because here you are calling a file or a resource called a sample dot HTML.

02:01.760 --> 02:05.010
And here you are calling a resource called as index dot HTML.

02:05.970 --> 02:14.250
So the parameter which calls the unique resource within the server, in this case it is slash sample

02:14.250 --> 02:17.640
dot HTML is called as the request Uri.

02:19.080 --> 02:19.820
Perfect.

02:19.830 --> 02:23.340
So going back to our presentation.

02:23.430 --> 02:27.630
Get method is used along with the request uri.

02:27.810 --> 02:36.720
So when you talk about one of the example you have get slash admin followed by the http 1.1.

02:36.720 --> 02:40.400
So there are various Http protocols like 0.9.

02:40.410 --> 02:46.350
It all started with then you have 1.0, you have 1.1, and now even 2.0 is present.

02:46.440 --> 02:53.220
So depending upon the protocol language, which your browser is speaking, the protocol version might

02:53.220 --> 02:53.820
change one.

02:53.820 --> 03:01.410
Point one is a fairly common protocol version which is being used and in the next line you have host

03:01.410 --> 03:04.700
followed by Dexter dot CPU Labs dot n.

03:04.710 --> 03:12.840
So this entire request is interpreted as Dexter dot Labs dot n slash admin.

03:12.840 --> 03:15.270
So this is what it signifies.

03:15.540 --> 03:16.230
Perfect.

03:16.230 --> 03:18.440
So this is a very simple get request.

03:18.450 --> 03:25.020
There are various type of other get requests which is being used and one is called as the conditional

03:25.020 --> 03:25.780
get request.

03:25.800 --> 03:33.030
So conditional get method is generally used to fetch information with a specific condition.

03:33.030 --> 03:34.950
So let's take an example.

03:35.040 --> 03:39.270
You have get slash sample dot HTML.

03:39.300 --> 03:44.040
You have the Http protocol version, which is Http 1.1.

03:44.250 --> 03:55.620
Host this Dexter labs in and the condition here is if modified since Saturday 29th October 2017, followed

03:55.620 --> 03:57.210
by the time in GMT.

03:57.600 --> 04:07.920
So what is basically means get me sample dot HTML file from Dexter labs dot in server only if it is

04:07.920 --> 04:11.250
modified after this specific time.

04:11.460 --> 04:21.000
If it is if sample dot HTML is not modified after this specific amount of time, then the web server

04:21.000 --> 04:22.320
will send a 304.

04:22.350 --> 04:25.170
It will not fetch this specific resource.

04:25.170 --> 04:32.280
If it is modified, then the web server will send the entire sample dot HTML files content back to the

04:32.280 --> 04:32.940
client.

04:33.090 --> 04:35.430
So this is the conditional get.

04:35.730 --> 04:41.250
Let's talk about one more method which is partial get.

04:41.460 --> 04:49.680
So a partial get method is used to retrieve only specific content instead of everything by default.

04:50.130 --> 04:52.260
So let's take an example.

04:52.260 --> 05:02.160
You have get followed by the request url slash movie dot mp4, then http 1.1 and the host is Dexter

05:02.730 --> 05:03.480
Labs dot in.

05:03.480 --> 05:09.930
And in the third line there is one header which is added, which is range followed by bytes which is

05:09.930 --> 05:12.390
0/1 0 to 4.

05:12.600 --> 05:19.950
So what this basically means that I don't really need the entire movie dot mp4 file because it might

05:19.950 --> 05:21.450
be very big as well.

05:21.540 --> 05:29.370
I only need the first one 0 to 4 bytes of this specific movie dot mp4 file.

05:29.820 --> 05:32.970
And this is what a partial get means.

05:32.970 --> 05:38.070
It means give me only partial information instead of the entire file.

05:38.850 --> 05:40.710
So this is very useful.

05:40.710 --> 05:48.330
And in youtube.com you will see whenever you load a video, entire video is not streamed, only a specific

05:48.330 --> 05:50.670
information is streamed at the start.

05:50.730 --> 05:56.310
And when you complete it, then next range of information gets streamed.

05:56.640 --> 06:01.620
So we'll understand this with an example in the upcoming lecture.

06:01.620 --> 06:03.330
And let's do one thing.

06:03.370 --> 06:13.780
Let's write our first get request, not with the web browser, but with a manual handwritten request.

06:13.780 --> 06:20.410
So when you manually write things, it gives you a lot of satisfaction and it will help you understand

06:20.470 --> 06:22.540
things in more detail.

06:23.500 --> 06:26.320
So let's try this out.

06:28.360 --> 06:35.290
Let me check if I can zoom this more so that it will become much more visible.

06:35.530 --> 06:38.380
I hope this is much more visible now.

06:38.740 --> 06:47.000
So let's do a telnet on Dexter Labs dot in followed by the port.

06:47.020 --> 06:48.010
Port is 80.

06:48.040 --> 06:51.700
So 80 is the port in which the web server is listening.

06:52.630 --> 06:57.430
I'll press enter so it stays connected.

06:57.430 --> 07:04.630
And now since we are connected, we can write our first Http based request.

07:04.810 --> 07:16.210
So our request will be get slash sample dot HTML followed by the http 1.1.

07:16.840 --> 07:30.250
So we'll write this and now in the host we'll say Dexter dot Labs dot in, I'll press enter twice.

07:30.250 --> 07:37.180
And now you see the web server gave us a response saying that 200.

07:37.180 --> 07:37.450
Okay.

07:37.480 --> 07:38.050
200.

07:38.050 --> 07:38.400
Okay.

07:38.440 --> 07:46.120
Means that this request is successfully processed and it gave us range of headers.

07:46.570 --> 07:52.930
After giving the range of headers, it gave us the actual file, which is this is sample file.

07:52.930 --> 07:57.760
And then it states specially designed for your handwritten get request.

07:57.760 --> 08:04.190
And whenever you open this in the browser, you directly get this specific file.

08:04.190 --> 08:11.600
Browser in turn creates this specific Http request and sends it to the server.

08:11.630 --> 08:18.410
Now, instead of browsing, instead of browser formulating this request, we have actually written it

08:18.410 --> 08:20.480
in a handwritten format.

08:20.690 --> 08:31.100
So I hope you got the basic idea on how exactly the request is sent to the server and the response is

08:31.100 --> 08:32.000
received.

08:32.120 --> 08:41.180
So go ahead and try this out in your site as well so that it will give you a much more better understanding

08:41.180 --> 08:43.220
on how things would really work.

08:43.250 --> 08:46.460
So I hope this has been informative for you.

08:46.460 --> 08:53.420
And in the next lecture we will be speaking more about the conditional get and the partial get, and

08:53.420 --> 08:55.940
we'll look into how that would really work.

08:56.270 --> 08:58.100
So this is it about this lecture.

08:58.100 --> 09:02.750
I hope this has been informative for you and if you have any doubts, questions, suggestions, feel

09:02.750 --> 09:08.780
free to connect us at Twitter, Facebook or LinkedIn or email us at instructors at the Labs dot n.

09:08.870 --> 09:10.130
Thanks for watching.
