1991 year 8 month
My name is client , An English name client.
Her name is server , An English name server.
This year , We were born .
Yes , We are all 90 after .
I love her , But she is far away .
In order to talk to her , I also invented HTTP
agreement .
A language that only she and I can understand in the world , A romance that only she and I can understand in the world .
Although I can only send her GET
operation , She can only return HTML
file , But it's enough .
When I send out GET /index.html
when
She'll come back
<html>
<body>Hello World</body>
</html>
Maybe in her opinion , I'm her world, too .
I know I'm not perfect yet , So name yourself 0.9 edition , I look forward to becoming better myself in the future .
1996 year 5 month
This is my second diary .
Forgive me for rarely keeping a diary , After all, a well-known person said :" Normal people who write diaries ?!"
I just shared it with her before HTML
, This is far from satisfying me , Now I also want to share images with her 、 video 、 Binary .
in addition , I also want to have more contact with her , Just like lovers want to hug and kiss besides holding hands , I have nothing but GET
I still want to POST
,HEAD
.
Again , At my strong request , Can you give me a hint every time you communicate , It is always difficult to make complaints about the way out . therefore , Except for the data part , Every communication adds a header message , We all have a mental preparation. What are we going to do this time .
For example, in the request header information , Accept: */*
Will tell her the type of data I can accept , If she returns data Content-Type:image/jpeg
I knew she was going to share her beautiful photos ,
Content-Type:video/mp4
I knew I could see her beautiful video .
Last , alas , Sometimes girls are really a little wordy , So I'm in again HTTP The agreement adds Content-Encoding
, Suggesting that she can compress the data .
such as
I will use Accept-Encoding: gzip, deflate
To tell her the compression type I can accept , and Content-Encoding: gzip
Just tell me her actual compression type .
You can see that now HTTP
The protocol is a lot more complicated , But I want to say it's a special code for both of us , I'd like to record it , Become a good memory .
Another embarrassing problem is that , She doesn't think I'll be long , Every Tcp Links can only send one request , Send data and shut it down , It bothers me a lot , So when some browsers request , Used a nonstandard Connection
Field .
Connection: keep-alive
So she knows , I've really had a long time this time , Don't disconnect easily .
But unfortunately , This is not included in the criteria .
No matter what , I think HTTP
This time, the change is quite decent , So it's called 1.0 Well .
With this milestone , My communication with my server can be more colorful .
After all, long distance love , The most important thing is to be effective 、 Rich communication .
1997 year 1 month
As we learn more about , I think I love her more , So willing to do more .
The greatest dignity of a man , I put it first Connection: keep-alive
Inclusion criteria , That is, it is not closed by default without declaration .
secondly , I can't stand the pattern that I ask and she answers , I want to send out as much love as I can at one time , So I introduced the pipeline mechanism , Allow me to make multiple requests at the same time , Of course, she followed the order , Just respond one after another , At least I have done it in place .
My efforts are also rewarded ,server Also very considerate to me back Content-Length
Field , So that I can easily know how much data she gave me .
But sometimes she has too much to say , I really don't want to wait too long for her to respond when she's finished , So in addition to Content-Length
, I'm here at the same time HTTP
Added
Transfer-Encoding
Field , This means that the response will consist of an indefinite number of data blocks .
such as
Before every nonempty data block , There will be one. 16 The number of decimal places , Represents the length of this block . And finally there's a size of 0 The block , It means that the data of this response has been sent . Here is an example .
HTTP/1.1 200 OK
Content-Type: text/plain
Transfer-Encoding: chunked
25
This is the data in the first chunk
1C
and this is the second one
3
con
8
sequence
0
such , I can get her reply right away , splendid .
Last , except GET
POST
Wait for the operation , I also added PUT
PATCH
All kinds of postures to communicate with her , Do you know .
Although it has been optimized a lot , But be modest as a man , So I named the version 1.1.
well , That's it , I will continue to work hard , For her .
2009 year
I heard that Google made it public SPDY
agreement , It's still for me HTTP1.1
Inefficient problems ? I'm not very happy , I still like my HTTP
agreement .
server And asked if I could also HTTP
Also optimize , speechless , I passed my HTTP
I've talked to her 18 I've been in love for two years .
be it so , I don't want to write. , How I love .
2015 year 5 month
Love a person , It's really going to make you better .
In order to get closer to her , I'm going to give it a good hand HTTP
Optimized the next .
Though it is SPDY
On the basis of , however , Is not important !
About the main points :
1、HTTP/1.1
The header of the version must be text (ASCII
code ), Data body can be text , It can also be binary , Text parsing is certainly not as good as binary , So be direct and thorough , It's all binary .
So we can quickly understand each other's demands .
2、 I said before that I can send multiple requests at the same time ,server Deal with in order , But I don't want to take her responses one by one , So she can also return data to me simultaneously .
3、 The longer you fall in love , The more afraid the other party is of repeating things , So in addition to data bodies , I also compressed the header information this time . On the one hand, you can use gzip/ compress
Compress , In addition, she and I maintain a head information table at the same time , All fields will be stored in this table , Generate a index number , I will not send the same field later , Send only index numbers , This increases the speed .
4、 This is the most important , The server can take the initiative to send resources to the client , Not that I have to make a request first . That is, when I leave 99 After step , The next step is for her to come to me .
There are too many optimizations this time , I decided to name it directly HTTP2.0
, Of course, there will be 3.0,4.0. For her , I want to be better .
Conclusion
Once upon a time, cars and horses were very slow , Letters are far away , Life is enough to love one person .
Now ,HTTP
Can let your love millisecond class convey to each other , But also wish you all like me , Get what you love , Be loved all my life .
BAT Code the agriculture , Transfer programmer ,Bug The little prince , The famous backer .
The wolf in the wind of Xier banner ,211 The God of failing in college , really · Brick carriers , false · Novelist .