Socket implementation HttpClient Simple class +CSDN login source

Source: Internet
Author: User

This article I send other forum articles, at the same time published in their own blog.

Background:

write this just for yourself to understand some of the underlying technology, some things have to write their own to better understand. The reason to put on the forum is to let the novice understand the essence of things, do not be confused by some superficial things, or will go a lot of detours.


Introduction:
1: Support post + GET request in fact for what request library is not concerned.
2: Support 302 jump.
3: Simple parsing of the request header + return header.
4: Simple cookie support.

The Fidder of the packet simulator machine is not a supported cookie, this reason is due to the decision of his framework.


principle:
1: Packet sending and receiving are definitely sockets sent and received.
2: Constructs an HTTP packet. (The library provides simple property settings that make it an object-oriented), so it's better to do so.
3: Parse the returned packets, parse the HTTP, and instantiate the corresponding objects.

Example:
the only csdn http login.
1: Gets the serial number of the CSDN login.
2: constructs the corresponding packet.
3: Visit my csdn. (The data is not transcoded, the Chinese will be garbled.) )。

Small Fish

QQ Group: 274301756 (Programming Hobby Group).


Code: http://www.cctry.com/thread-249742-1-1.html

Can leave the mailbox I send you the link

Socket implementation HttpClient Simple class +CSDN login source

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.