Little endian, mime, get vs post

Source: Internet
Author: User
Tags html header

Big endian: A large-bit address stores high-bit bytes, which can be called high-bit priority. The memory is stored sequentially from the lowest address (high-digit numbers are written first ). Put the highest byte at the beginning.

Little endian: The second-bit address stores low-bit bytes, which can be called low-bit priority. The memory is stored sequentially from the lowest address (low-bit numbers are written first ). The forward byte is placed at the top.

The x86 series uses little endian, while Java and network protocols use big endian to store and send data.

 

For example, the storage Order of the number 0x12345678 in two different bytes of CPU is as follows:

Big endian

Low address and high address

----------------------------------------->

+-+

| 12 | 34 | 56 | 78 |

+-+

Little endian

Low address and high address

----------------------------------------->

+-+

| 78 | 56 | 34 | 12 |

+-+

From the above two figures, we can see that using the big endian method to store data is in line with our human thinking habits. And little endian ,! @ # $ % ^ & *, Go to hell-_-|

 

 

Mime was designed to add multimedia data when sending emails. After being supported by HTTP, HTTP not only transmits common text, but also supports multimedia data.

Each MIME type consists of two parts. The front part is the big data category, such as audio, image, and the specific types are defined later.

Common MIME types

Hypertext markup language text. HTML text/html

XML document. XML text/XML

XHTML document. XHTML application/XHTML + XML

Common text. TXT text/plain

RTF text. rtf application/RTF

PDF document. pdf application/PDF

Microsoft Word file. Word application/MSWord

PNG image. PNG Image/PNG

GIF image. GIF image/GIF

JPEG image. jpg image/JPEG

AU audio file. Au audio/basic

MIDI music files mid,. MIDI audio/Midi, audio/X-Midi

RealAudio music file. Ra,. Ram audio/X-PN-RealAudio

MPEG file. mpg,. MPEG Video/MPEG

AVI file. AVI Video/X-msvideo

Gzip file. GZ application/X-Gzip

Tar file. Tar application/X-Tar

Arbitrary binary data application/octet-stream

 

Content-Type indicates the MIME type information.

For HTML documents, the server will first send the following two lines of mime identification information, which is not part of the real data file. Content-Type: text/html note that the second behavior is an empty line, which is required to separate the mime information from the real data content.

 

 

The get method retrieves the information identified by request-Uri. The head method also retrieves the information identified by request-Uri, but does not return the message body during the response. The post method can request the server to receive entity information contained in the request. It can be used to submit forms and send messages to newsgroups, BBS, contact groups, and databases.

 

1xx: Information Response class, indicating that the request is received and processed continuously
2XX: Successful response class, indicating that the action is successfully received, understood, and accepted
3xx: redirect response class. To complete the specified action, you must accept further processing.
4xx: client error. The client request contains a syntax error or cannot be correctly executed.
5xx: server error. The server cannot correctly execute a correct request.

 

Differences between http post and get
1. Http only supports post and get command modes;
2. Post is designed to store up, while get is designed to fetch from the server. Get can also transmit less data to the server, the reason why get can also transmit data is to design and tell the server what data you actually need. post information is used as the content of the HTTP request, while get is transmitted in the HTTP header;
3. The post and get methods are different in HTTP transmission. Get parameters are transmitted in the HTTP header, while post data is transmitted in the HTTP request content;
4. When post is used to transmit data, it does not need to be displayed in the URL, but the get method must be shown in the URL;
5. Because the get method is limited by the URL length, it can only transmit about 1024 bytes. The size of post data transmission can reach 2 MB. According to Microsoft, Microsoft uses request. form () can receive up to 80 KB of data in IIS 4 and 100 kb in IIS 5;
6. Soap is implemented in the http post mode;
1) Get: The request parameter is appended to the URL as a sequence (query string) of a key/value pair.
The length of the query string is limited by the web browser and web server (for example, ie supports a maximum of 2048 characters), and is not suitable for transmitting large datasets.
At the same time, it is not safe
2) post: Request Parameters are transmitted in a different part of the HTTP header (Named Entity body). This part is used to transmit form information, so you must
Set Content-Type to application/X-WWW-form-urlencoded.
Post is designed to support user fields on web forms. Its parameters are also transmitted as key/value pairs.
However, it does not support complex data types, because post does not define the semantics and rules of the transmitted data structure.

 

3. Differences between get and post methods in Form submission are summarized as follows:
(1) get is to get data from the server, and post is to send data to the server.
(2) For the form submission method, the server can only use request. querystring to obtain the data submitted in get mode, and the data submitted in post mode can only be obtained using request. form.
(3) In general, do not use the get method to submit a form because it may cause security problems. For example, if you use the get method in the login form, the user name and password entered by the user will be exposed in the address bar. But on the pageProgramThe get method is better than the POST method.
The get and post methods have the following differences:
(1) on the client side, the get method submits data through the URL, and the data can be seen in the URL. In the post mode, the data is placed in the HTML header for submission.
(2) data submitted in get mode can contain a maximum of 1024 bytes, whereas post mode does not.
(3) security issues. As mentioned in (1), when get is used, the parameter is displayed in the address bar, but post is not. Therefore, if the data is Chinese and non-sensitive, use get. If the data you enter is not Chinese characters and contains sensitive data, use post as well.
(4) Safe and idempotent. The so-called security means that this operation is used to obtain information instead of modifying information. Idempotence means that multiple requests to the same URL should return the same result. The complete definition is not as strict as it looks. In other words, get requests generally do not have side effects. Basically, the goal is that when a user opens a link, she can be confident that the resource has not changed from her own perspective. For example, the front pages of news sites are constantly updated. Although the second request will return a different batch of news, this operation is still considered safe and idempotent because it always returns the current news. And vice versa. POST requests are not that easy. Post indicates a request that may change resources on the server. Take news sites as an example.ArticleThe annotation should be implemented through the POST request, because the site is different after the annotation is submitted (for example, an annotation appears below the article ).

The simple difference between HTTP request methods get and post:

1. Get Method
The data submitted by the get method is insecure. The data is placed in the request line, which is visible in the client address bar;
The size of data submitted by the get method is limited to 255 characters.
The get method cannot set bookmarks.
2. Post Method
The post method submits data securely, and the data is placed in the message body, which is invisible to the client.
There is no limit on the size of data submitted by the POST method.
The post method can be used to set bookmarks.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.