HTTP proxy server
Asked Answered
U

2

6

I am beginning work on a very basic HTTP proxy server written in C (Edit: something that just forwards my requests). At this point I am having difficulty in understanding how to proceed.

Any help would be beneficial.

Undercoating answered 14/11, 2009 at 15:32 Comment(2)
At what point? Where are you stuck?Tolkan
I think the first step is to document requirements.Otocyst
R
13

Take a look at micro_proxy. It implements all the basic features of an HTTP/HTTPS proxy, in only 260 lines of C code.

Another very simple implementation can be found at Proxy.

Rudolfrudolfo answered 14/11, 2009 at 16:11 Comment(1)
Thanx! They are useful links.Undercoating
E
2

A proxy server for what protocol? Before you know that, starting coding is not the most beneficial next step.

After you've decided on what protocol to implement, you (probably) need to read up on the sockets API.

Once that's done, there's three major routes to go, using a poll/select-based loop, forking off per-session processes or using threads to shuffle data.

Endor answered 14/11, 2009 at 15:37 Comment(4)
Its a HTTP proxy and I know sockets API.Rudolfrudolfo
Strange. Are Ankit and Alex Xander in fact the same person?Frieda
@Endor How do your 3 major routes relate to creating a proxy?Toothy
@Toothy A proxy needs to read data and send it on. To do that, you can use poll/select in a loop to gather the data, or you can have a single "read, then write" loop, either in a forked-off process or in a separate thread.Endor

© 2022 - 2024 — McMap. All rights reserved.