delvedor / delvedor/hpagent

How to proxy without using HTTP CONNECT method

Open
#17 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
192
Forks
40
PR merge metrics
No merged PRs in 30d

Description

I have the following code:

```javascript
const got = require("got");
const { HttpProxyAgent } = require("hpagent");

let stream = await got.stream("http://www.google.com", {
agent: {
http: new HttpProxyAgent({
keepAlive: false,
proxy: "http://localhost:3128",
}),
},
});
```

I can see in my proxy (Squid) logs that it receives the request - and it serves the page fine etc. However, I want Squid to cache the result, but Squid is being called using HTTP CONNECT method, which means that I have no way of caching the results on Squid. For any proxy to cache results, it cannot be called using the CONNECT method.

Essentially Got is tunneling the request to Squid using the HttpProxyAgent.

How can I set it up, so that the request is not tunnelled - I just want to connect to the proxy in a normal way (not using CONNECT).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the HttpProxyAgent configuration in the issue and the got.stream call, then inspect how the agent handles HTTP proxy requests. Done means the request reaches Squid without HTTP CONNECT and can therefore be cached; the issue does not mention any specific files or tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.