[JAVA] HTTP / HTTPS communication

Although I am a beginner, I have summarized it for personal review and deepening understanding.

Basics of HTTP / HTTPS communication

What is HTTP

Abbreviation for * HyperText Transfer Protocol *.

** HyperText ** is a system that embeds references to other documents (location information and identification information) at arbitrary positions and elements in a document and connects multiple documents to each other.

** Protocol ** refers to conventions such as procedures and rules for communicating between computers, and in order to browse web pages, a protocol called HTTP is used for communication between the web browser and the web server. ..

Web server configuration

When browsing the Web using the Internet today, users have a client software called ** Web Browser ** and a ** Web Server ** that stores the Web pages that are the information to be browsed. You will need it. The information that the web browser requests from the web server is called ** HTTP request **, and the information that the web server responds to and replies to is called ** HTTP response **, and it is used to display one content using HTTP. Exchanges this request and response.

HTTP type and HTTP method

What is sent from the browser is not only the request for acquiring the content, but also the sent data such as the data entered in the input form and the uploaded file. Since the processing content requested to the server differs depending on the purpose of the request, the type of request is determined by the ** HTTP method ** in HTTP communication. Commonly used HTTP methods include ** GET method ** to get the resource of the requested URL and ** POST method ** to send the input data to the requested URL.

Difference between GET method and POST method

The intended difference I saw is the URL.

The GET method attaches the value to be passed to the end of the URL. (Example) `` `https://www.google.co.jp/?param1=value1&param2=value2```

The POST method attaches the value you pass to something invisible to the human eye. (Example) `` `https://www.google.co.jp/```

Then, when it comes to whether to use the GET method or the POST method, the POST method is often better.

The reason is

  1. ** The GET method can pass less information than the POST method **
  2. ** GET method keeps the passed value in the history **

From the following, it is better to use the POST method when wondering which one to use.

What is HTTPS

HTTPS is one of the same protocols as HTTP, but HTTPS uses a protocol called ** SSL (Secure Socket Layer) **. SSL is a protocol for transmitting and receiving encrypted, and the main difference between HTTP and HTTPS is whether the communication content by SSL is encrypted or not. Strictly speaking, the protocol ** TLS (Transport Layer Security) ** is currently used instead of SSL, but since the term SSL has been used for a long time, it is still called SSL, or ** SSL. It is in a situation called / TLS **.

Also, in Google Chrome, when you open a homepage that supports HTTPS, ** "protected communication" ** or ** "organization name" ** is displayed on the left side of the URL of the browser.

IMG_20190926_214832.png IMG_20190926_214816.png

Communication is encrypted for both "protected communication" and "organization name", but if the organization name is displayed, not only is the communication encrypted, but the domain owner actually exists. Indicates that it is an organization, and the ** certificate type set on the server is different **. In this case, the type of certificate is "certificate (SSL server certificate)" that guarantees that the server to communicate with belongs to the legitimate owner. ** Confirm the legitimacy of the homepage owner. be able to. ** **

In other words

  1. ** Communication encryption **
  2. ** Legitimacy of server owner **

These two are the differences from HTTP and are important functions of HTTPS.

In recent years, HTTPS has become the standard because it has better security than HTTP.

References

http://e-words.jp/w/SSL.html https://cybersecurity-jp.com/security-measures/25772 https://www.724685.com/word/wd140305.htm https://wa3.i-3-i.info/diff7method.html https://kotobank.jp/word/プロトコル-8535 http://e-words.jp/w/ハイパーテキスト.html http://e-words.jp/w/HTTP.html Yoshio Kono, Tsutomu Harada, Hiroshi Fukasawa, Tomohisa Maruyama, Yu Goto "Web Application Service Construction" SCC (2013/3/1) Koji Higashi, Yoshihiro Yamada "First JSP & Servlet" Shuwa System (2016/10/1)

Recommended Posts

HTTP / HTTPS communication
[Note] http communication related (okhttp3)
ubuntu https communication method (Google Chrome)
Memo when HTTP communication with Java (OkHttp)
Docker × Laravel HTTPS (SSL) communication in local environment
* Android * [HTTP communication_1] Try hitting WebAPI [GET, POST]