Network request http get post 1, getpost

Source: Internet
Author: User
Tags html header

Network request http get post 1, getpost

Http defines different ways to interact with the server. There are four basic methods: Get post put delete, full URL resource descriptor. We can think of a URL address, a URL address, it is used to describe resources on a network, while Get post put delete in HTTP corresponds

1According to the HTTP specification, GET is used for information retrieval, and should be secure and idempotent.

(1). The so-called security means that the operation is used to obtain information rather than modify information. In other words, GET requests generally do not have side effects. That is to say, it only obtains the resource information, just like the database query. It does not modify, add data, and does not affect the resource status.

* Note: security only indicates that the information is not modified.

(2) idempotence means that multiple requests to the same URL should return the same result. Here I will explain it again.IdempotenceThis concept:

Idempotence(Idempotent, idempotence) is a mathematical or computer concept, common in abstract algebra.
Idempotence can be defined as follows:
For a single-object operation, if an operation is performed multiple times for all the numbers in the range, the result is the same as that obtained once, this operation is called idempotent. For example, an absolute value operation is an example. In a real number set, abs (a) = abs (a) is used )).
For binary operations, it is required that when the two values involved in the calculation are equivalent, if the calculation result is equal to the two values involved in the calculation, the operation is called the idempotence, for example, a function that calculates the maximum values of two numbers has the power in the real number set, that is, max (x, x) = x.


  2According to the HTTP specification, POST indicates a request that may modify the resources on the server. Continue to reference the above example: for news websites, readers should POST their comments on news, because the Site Resources are different after the comments are submitted, or the resource is modified.



The above describes some of the principles of GET and POST in the HTTP specification. However, in practice, many people fail to follow the HTTP specification, which leads to many reasons, such:

  1. A lot of people are greedy and convenient. GET is used to update resources, because FORM must be used for POST, which will be a little troublesome.

  2. You can add, DELETE, modify, and query resources through GET/POST without using PUT or DELETE.

  3. In addition, early Web MVC Framework designers did not consciously treat and design URLs as abstract resources, therefore, a serious problem is that the traditional Web MVC framework basically only supports the GET and post http methods, rather than the PUT and DELETE methods.

* MVC: MVC originally exists in the Desktop program, M is the exponential data model, V is the user interface, and C is the controller. The purpose of using MVC is to separate the implementation code of M and V, so that the same program can use different expressions.





What is the difference between Get and Post in HTTP?

Get: obtains the information of the resource specified by the request URI in Entity mode. If the request URI is only a data generation process, in the end, the response object will return the resource to which the result of the processing process points, rather than the description of the processing process.

Post: it is used to send a request to the target server, requiring it to accept the entity attached to the request and treat it as an additional sub-item of the resource specified by the request URI in the Request queue, post is designed to implement the following functions in a uniform way:
1: Explanation of existing resources
2: send messages to bulletin boards, newsgroups, email lists, or similar discussion groups.
3: submit data blocks
4: expand the database through additional operations

As described above, Get is a request to request data from the server, while Post is a request to submit data to the server, the data to be submitted is located in the entity behind the information header.

10. For the http post method, which part of the form data submitted by the user is located in HTTP? B a) starting .....................

Differences between Http Get/Post requests
1. HTTP request format:

<Request line>

<Headers>

<Blank line>

[<Request-body>]

In an HTTP request, the first line must be a request line to describe the request type, resources to be accessed, and the HTTP Version Used. Next is a header section, which describes additional information to be used by the server. After the header is a blank line, you can add any other data [called the body].

1. get is to get data from the server, and post is to send data to the server.
Get and post are just a way to pass data. get can also transmit data to the server. They are essentially sending requests and receiving results. There is only a difference between the organization format and the data size, as described in the http protocol.
2. get is to add the parameter data queue to the URL referred to by the ACTION attribute of the submission form. The values correspond to each field in the form one by one and can be seen in the URL. Post uses the HTTP post mechanism to place fields in the form and their content in the html header and send them to the URL address referred to by the ACTION attribute. You cannot see this process.
Because get is designed to transmit small data, and it is best not to modify the server data, browsers generally can see it in the address bar, but post is generally used to transmit big data, or relatively private data, so you cannot see it in the address bar. Can you see that it is not the protocol, but the browser.
3. For the get method, the server uses Request. QueryString to obtain the value of the variable. For the post method, the server uses Request. Form to obtain the submitted data.
I don't understand. How to obtain the variables is related to your server and has nothing to do with get or post. The server encapsulates these requests.
4. The data volume transmitted by get is small and cannot exceed 2 kb. The amount of data transmitted by post is large, which is generally not restricted by default. Theoretically, the maximum size of IIS4 is 80 KB, and that of IIS5 is 100KB.
There are basically no restrictions on post. I think all the files uploaded are post-based. You only need to modify the type parameter in form.
5. Low get security and high post security.
If there is no encryption, their security levels are the same. Any listener can listen to all the data. Do not believe your next software to listen to network resources,

Get is a type of request to request data from the server, while Post is a type of request to submit data to the server. In FORM, the default Method is "GET". In essence, GET and POST are only different sending mechanisms, not a single sending!
Http defines different methods for interaction with the server. There are four basic methods: GET, POST, PUT, and DELETE. The full name of a URL is a resource descriptor. We can think that a URL address is used to describe resources on a network, while GET, POST, PUT, DELETE corresponds to the query, modify, add, and DELETE operations on this resource. Here, you should have a rough understanding. GET is generally used to obtain/query resource information, while POST is generally used to update resource information.
1. According to HTTP specifications, GET is used for information retrieval, and should be secure and idempotent.

(1). The so-called security means that the operation is used to obtain information rather than modify information. In other words, GET requests generally do not have side effects. That is to say, it only obtains the resource information, just like the database query. It does not modify, add data, and does not affect the resource status.

* Note: security only indicates that the information is not modified.

(2) idempotence means that multiple requests to the same URL should return the same result. Here I will explain the concept of idempotence:

Idempotence (idempote ...... remaining full text>

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.