Archive for the 'proxy' Category

Sample solution to the proxy lab

On the lab page you can find a sample solution to the filesystem lab.

 

Possible problem with parse_uri if the URL is malformed

If the URL that is passed to parse_uri just contains a hostname withouy any path (e.g. http://www.foo.bar) then the function might cause a core dump because there is a small bug in the parse_uri function…

The diff for the parse_uri function looks as follows:

/* Extract the host name */
hostbegin = uri + 7;
- hostend = strpbrk(hostbegin, ” :/\r\n\0″);
+ /* does not work because it maps to the end-of-string and strpbrk
+ * will return NULL
+ */
+ //hostend = strpbrk(hostbegin, ” :/\r\n\0″);
+ hostend = strpbrk(hostbegin, ” :/\r\n”);
+ if (hostend == NULL) hostend = hostbegin+strlen(hostbegin);
len = hostend – hostbegin;
strncpy(hostname, hostbegin, len);
hostname[len] = ‘\0′;

Of course you can download the corrected handout at http://www.lst.inf.ethz.ch/teaching/lectures/ss07/2100/proxy_lab/proxylab-handout.tar

Programming language of choice for proxy-lab

As Matteo said in the lecture you can choose your programming language for this lab. But keep in mind that the exercise should not be made simpler than it is in C. So you should not use any high-level functions to program sockets and use high-level objects for String manipulation or URL-handling.

Also dont use any uncommon or unusual languages. If you are in doubt, check back with Mathias.

Deadline extension for proxy lab & information for HTTP/1.1

Some of you told me that you don’t have enough time to complete the proxy lab, so the deadline is postponed to June, 10.

Also you have to take care for some special hickups if you use HTTP/1.1 because the connection is not closed when all data is transfered.

You can use the following procedure to avaid a (forever) blocking read:

  • Read the header line based and parse the content-length field (if present)
  • If the content-length is present, then read the given bytes and pass them to the client
  • Otherwise continue reading until you read

Also keep in mind that you might need to reformat “GET http://server/path/ HTTP/1.1″ to “GET path/ HTTP/1.1\nHost: server” depending on the server implementation of HTTP/1.1.

New exercise sheet for the proxy_lab available

I was told that there was a mistake in the proxy_lab and filesystem_lab exercise sheets. They stated that groups up to three people could be formed, but the course homepage itself says that only groups up to two people are allowed.

So I wanted to clarify that only groups up to TWO people are allowed to work together.

I hope that this does not cause any inconveniences to you. If there are any problems, step by at my office and we’ll try to solve them!

Proxy Lab

The new assignment is out, check the website at http://www.lst.inf.ethz.ch/teaching/lectures/ss07/2100/proxy_lab/index.html