Hello everyone, I am Feiying.
The recruitment process at Huawei consists of one written test, three technical interviews, and one HR interview. Compared to other major internet companies, Huawei’s interview difficulty is generally lower.
Today, I will share two classic questions encountered by a student during Huawei’s technical interview: Introduce the HTTP protocol and What are the differences between HTTP and HTTPS?.
Since HTTP and HTTPS protocols are commonly used in APP development and website development, their differences have become high-frequency exam questions for programmer positions, especially during campus recruitment interviews.
Let’s first look at the first classic question:
HTTP Protocol: A Casual “Chat” Between You and the Server
Now let’s talk about this particularly common interview topic — the HTTP protocol! Don’t be intimidated by the term “protocol”; it’s really just a casual “chat” between you and the server.
1. The HTTP Protocol is Just a “Chat”
Imagine you are sitting in front of your computer, wanting to open a webpage.
At this moment, your browser acts like a “chatty person”, starting to “chat” with the server. The HTTP protocol, is the “rules” of their conversation.
The browser says: “Hey, server, show me that webpage!” The server replies: “Sure, here you go!”
2. The Content of the Chat is the “Request” and “Response”
Request:
When the browser chats with the server, it first says: “I want to see this webpage!”
This is the “request”. The request will also tell the server some extra information, such as: “Which webpage do I want to see?” (URI), “Which version of HTTP am I using?” (e.g., HTTP/1.1).
Sometimes, the browser will also send the server a little “gift”, such as form data or files, at which point it will use the POST method to say: “Hey, server, here’s my little gift for you, please take it!”
Response:
After the server hears the browser’s request, it will respond: “Sure, here is the webpage you wanted!”
This is the “response”. The response will also tell the browser some information, such as: “The webpage was found!” (Status code 200), “The webpage was not found!” (Status code 404).
The server will also package the content of the webpage or other requested items and send them back to the browser.
3. The “Ways” of Chatting are the Request Methods
Did you know? When the browser and server chat, there are several fixed “ways”, which are the request methods.
GET means: “Hey, server, show me that webpage!”
POST means: “Hey, server, here’s the file I’m giving you!”
There are also methods like PUT and DELETE, which are like saying: “Hey, server, put this thing there!” and “Hey, server, help me delete that thing!”
4. The “Codes” of the Chat are the Status Codes
When the server responds to the browser, it uses some numbers as “codes” to tell the browser the result of the response.
For example, 200 means: “Hey, browser, the request was successful, here’s what you wanted!”
404 means: “Hey, browser, the item you are looking for does not exist!”
There are also codes starting with 500, which indicate that the server has problems and cannot process the browser’s request.
5. The “Upgrade” of the Chat is the HTTP Version Upgrade
Your chatting style with friends may evolve over time, and the HTTP protocol does the same.
The first version was HTTP/0.9, where chatting was very simple, allowing only GET requests without any extra information.
Then came HTTP/1.0, where chatting became slightly more complex, allowing some extra information, but each chat had to start anew.
Next was HTTP/1.1, which was very convenient, allowing continuous chatting without needing to restart each time, greatly improving efficiency.
Now we also have HTTP/2 and HTTP/3, making chatting faster and more secure, just like using an “encrypted chat app”.
6. Conclusion: The HTTP Protocol is Surprisingly “Simple” to Use
After reading this article, don’t you think using the HTTP protocol is actually quite simple?
It’s like a casual “chat” between you and the server, with questions and answers, and rules to follow.
Author’s Biography
Having transitioned from materials science, I deeply understand the importance of computer fundamentals, so I often share this knowledge, looking forward to your attention and learning together with me.
I have prepared some certification materials, resume templates, etc., for you to use during your studies. Follow me and reply with “ certification” to download.
I have also compiled free computer job search materials; follow me and reply with “ job search” to get the download link.