Showing posts with label http. Show all posts
Showing posts with label http. Show all posts

Friday, November 03, 2006

One Alternative down

Out of the two alternatives that I came out with in my last post, the second one is down.
I searched for ways to how to change the url just before it is fetched. But could not find satisfying solutions.
But the first option is still alive. In fact, I got a few promising solutions. This site lists a few http proxy servers that have been made in python that do not need superuser privileges. The one that I downloaded requires python 2.4 and our 200 is still in the old age of 2.3. So I will have to select some other one. Lets see...
And yes FuckProxy is on its way. Its almost complete.

TechnoratiTechnorati: , , , , ,

Thursday, November 02, 2006

Server Side 301, 302 HTTP Response Header Redirect in python

Today while working on my FuckProxy project, I got totally frustrated while writing the code for 301 redirect http response header in python.
PHP has this small and easy to use code for it:-

header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$location);
But for python no such function exists. Moreover I spent 2-3 hrs on net searching for it. But there was no exact answer. Finally by several hit-and-trials and using the information collected from net, I could do it:-
print "Status: 301"
print "Location: " + location
print
sys.exit(1)
Of course, you must include sys using "import sys" statement.
For 302 (temporary redirect) just replace 301 to 302 in above code.
Thats it.
Done!!

TechnoratiTechnorati: , ,