A Practical Guide to aiohttp: Building High-Performance HTTP Clients and Servers with Asynchronous Programming

“Requests allows us to elegantly send requests synchronously, while aiohttp opens the door to the asynchronous world.” 🧠 What is aiohttp? <span>aiohttp</span> is the most popular asynchronous HTTP client and server framework in Python, built on top of <span>asyncio</span>. It performs excellently in scenarios involving high concurrency requests, real-time communication, and microservice interfaces. You can … Read more

Forget SimpleHTTPServer! This Emerging Python Library Makes Uploading and Downloading Easier

Introduction whttpserver is a simple HTTP server, similar to <span>python -m http.server</span>, but adds file upload and editing capabilities, thus solving the confusion of its inability to upload files. It can even start the server using the <span>whttpserver</span> command. Why This Tool is Needed Many company services are now accessed through jump servers, making it … Read more

A Guide to Avoiding Pitfalls with Content-Length in HTTP Requests

Scenario Recreation: A Frustrating JSON Parsing Issue Recently, during a project integration process, our team encountered a bizarre JSON parsing issue. Here’s what happened: The frontend team copied a normal cURL request from Chrome Developer Tools: curl -X POST https://api.ourcompany.com/v1/orders \ -H "Content-Type: application/json" \ -H "Content-Length: 187" \ -d '{"order_id":"123456","products":[{"sku":"A001","qty":2}],"remark":"Weekend Delivery"}' This request worked … Read more

Choosing Between HTTP and HTTPS for Website Construction: Should You Use www or Not?

In website construction, the choice of URL needs to be considered from multiple perspectives including security, SEO, and user experience. Here are specific recommendations: 1. HTTP VS HTTPS It is strongly recommended to choose HTTPS for the following reasons: – Security: HTTPS encrypts data transmission through SSL/TLS, preventing information from being stolen or tampered with … Read more

mitmproxy: The Powerful Python Library for HTTP Proxying!

Hello everyone, today I want to introduce a particularly powerful Python library – mitmproxy! It is an intercepting proxy tool that supports HTTP/HTTPS, allowing us to easily monitor and modify network requests. Whether for web scraping or API testing, it can save us a lot of trouble. I have been using it for several years, … Read more

Setting HTTP Request Rate Limiting in Nginx

ngx_http_limit_req_module The ngx_http_limit_req_module module limits the request processing rate based on the defined key value, particularly for rate limiting requests from a single IP. limit_req_zone Directive Sets up a shared memory zone to store state information and the number of exceeded requests based on the key; the key can include text, variables, or a combination … Read more

Httpx: The Future Star of Asynchronous HTTP!

â–² Click the card above to follow me Httpx: Making Asynchronous HTTP Requests Smooth as Silk! The world of network requests in Python has been continuously evolving, and today we are going to talk about this library that excites developers – Httpx. Imagine your network requests no longer crawling like a snail, but flying like … Read more

What are HTTP Long Connections and Pipelining Principles? What is Head-of-Line Blocking? How does HTTP/2 Multiplexing Solve Head-of-Line Blocking? What Optimizations Does HTTP/3’s QUIC Protocol Provide?

This article belongs to the collection: Interviewing the Interviewer Series For more interview questions, feel free to add the assistant’s WeChat at the end of the article! This article overview includes: What are the main differences between HTTP/1.1 and HTTP/1.0? Can you elaborate on how HTTP long connections are implemented, their advantages, and disadvantages? Can … Read more

Stop Using the Antiquated HTTP/1, Upgrade to HTTP/2 with These Two Steps

Recently, while analyzing SSE technology, I briefly mentioned HTTP/2, as the HTTP/1.x protocol has long been considered an “antique”. Reasons for Upgrade Upgrading from HTTP/1.x to HTTP/2 can bring various performance improvements and optimizations: Multiplexing In HTTP/1.x, each TCP connection can only handle one request or response, leading to the so-called head-of-line blocking issue. In … Read more

Detailed Explanation of HTTP Status Codes: Uses and Meanings

This article systematically organizes the status codes in the HTTP protocol, categorizing and analyzing their meanings and applicable scenarios, which can help developers quickly locate request issues and optimize interaction logic. It also designs a standard based on the combination of HTTP methods and status codes. Detailed Explanation of HTTP Status Codes: Uses and Meanings … Read more