Second assignment is out

Second assignment is about coding a simple web proxy. No local storage (no cache handling). Just a simple iterative server but with a twist: As you need to read from two streams (request and response) you have to figure out the best way of doing it.

Only GET method is permitted, so you can safely reject any other method coming from the browser (to keep things as simple as possible).

You can click on this entry title to get the assignment text. Second assignment due date is December 23rd, 2009.

Advertisements

One Comment

  1. Posted November 30, 2009 at 12:17 pm | Permalink | Reply

    The idea of using threads is to make your life easier not more difficult. I've made my implementation (binary on file repository) using a single thread.

    The problem when reading from two sockets is the possible deadlock. That is why I suggested two threads. However there is no real need for them. The good thing about threads is they can be waiting forever happily without your server getting stuck.

    That said, the truth is that if you have paid attention in class, HTTP is a client/server protocol, so a request is sent at the beginning and then you get the response from the server. So you could have your code to:

    1) read request from web browser
    2) forward a somehow modified request to the server
    3) read the response from the server
    4) forward (maybe while reading in 3) the response to the web browser

    Anyway you can create a class that takes two socket parameters and just copies data from input to output till there is no more data.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: