|
skyts
|
 |
« on: July 23, 2007, 03:31:21 AM » |
|
Perk, I don't see where the java section is, I am talking about java, not javascript - But couldn't find a section fit for it, So feel free to move it to where it belongs.
OK, So I developed an application that is working with proxies. Each time I connect to a site with a proxy, And then I hang up the connection. However, When seeing programs like Hreferer for example, It seems that their program stays connected to the proxy, And do not close connection after each request for a page. It seems a lot faster, But still I'm not sure how to do it - Because persoanlly I know that for each request a proxy is connecting to the internet, performing the job it needs to, and then closes connection.
Anybody have a clue how to do it, And if it worth the time investing in it?
|
|
|
|
|
Logged
|
|
|
|
perkiset
Olde World Hacker
Administrator
Lifer
   
Online
Posts: 5324
:sniffle: Humor was so much easier before.
|
 |
« Reply #1 on: July 23, 2007, 08:40:02 AM » |
|
Hey Skyts -
Good eye - didn't have Java listed anywhere - as you can see, I have renamed this board to handle it.
However I do not have an answer for you since I know just .0001% more than squat about Java...
/p
|
|
|
|
|
Logged
|
If I can't be Mr. Root then I don't want to play.
|
|
|
|
skyts
|
 |
« Reply #2 on: July 23, 2007, 11:50:10 AM » |
|
Hey Skyts -
Good eye - didn't have Java listed anywhere - as you can see, I have renamed this board to handle it.
However I do not have an answer for you since I know just .0001% more than squat about Java...
/p
Cheers perk, Maybe someone else will know the answer 
|
|
|
|
|
Logged
|
|
|
|
|
thedarkness
|
 |
« Reply #3 on: July 23, 2007, 05:38:14 PM » |
|
Pretty sure that this is in the underlying proxy connection. Do a search for "Proxy-Connection: Keep-Alive" (actual header) and post back if you need more. We're open all hours  Good on you skyts, good luck. I'll be taking advantage of this in the near future but my rig is built in C++, should be similar in implementation though. Cheers, td
|
|
|
|
|
Logged
|
"I want to be the guy my dog thinks I am." - Unknown
|
|
|
|
arms
|
 |
« Reply #4 on: July 23, 2007, 08:08:35 PM » |
|
if you use this, System.setProperty("http.proxyHost", "127.0.0.1"); System.setProperty("http.proxyPort", "8118");
you only have to set it once. if you're using proxies with authentication i don't remeber what the properties are. if you're using httpclient ( http://jakarta.apache.org/commons/httpclient/ ), HttpClient client = new HttpClient(); client.getHostConfiguration().setProxy("127.0.0.1", 8118);
// if you need authentication add this: client.getState().setProxyCredentials( new AuthScope(null, -1), new UsernamePasswordCredentials("username", "password") );
you can reuse the client so you don't have to reset it
|
|
|
|
|
Logged
|
|
|
|
|
skyts
|
 |
« Reply #5 on: July 24, 2007, 02:38:12 AM » |
|
if you use this, System.setProperty("http.proxyHost", "127.0.0.1"); System.setProperty("http.proxyPort", "8118");
you only have to set it once. if you're using proxies with authentication i don't remeber what the properties are. if you're using httpclient ( http://jakarta.apache.org/commons/httpclient/ ), HttpClient client = new HttpClient(); client.getHostConfiguration().setProxy("127.0.0.1", 8118);
// if you need authentication add this: client.getState().setProxyCredentials( new AuthScope(null, -1), new UsernamePasswordCredentials("username", "password") );
you can reuse the client so you don't have to reset it Globally, My Connector class uses the same mechanism - just without authentication... So as I see it, the client do not make the decision about permanent connection - it is the decision of the proxy server, or do I understand it wrong?
|
|
|
|
|
Logged
|
|
|
|
|
thedarkness
|
 |
« Reply #6 on: July 24, 2007, 03:39:59 AM » |
|
|
|
|
|
|
Logged
|
"I want to be the guy my dog thinks I am." - Unknown
|
|
|
|
arms
|
 |
« Reply #7 on: July 24, 2007, 09:10:23 AM » |
|
all i know is you set it once, whether or not you stay connected i don't know. if your using a URLConnection (or HttpURLConnection) object or HttpClient you can set/get the headers yourself. so i guess you need to set the "Proxy-Connection: Keep-Alive" or "Connection: Keep-Alive" header or both and in the response check for "Connection: close" to see if the server refuses it.
|
|
|
|
|
Logged
|
|
|
|
|
skyts
|
 |
« Reply #8 on: July 24, 2007, 09:20:20 AM » |
|
My client supports it, but I'm not sure a public proxy like I use support this kind of beahviour. But then again, If you've seen Hreferer once, It looks like it is using this mecahnisem (at least visually it looks like it), Like it stays connected to the proxy all the time, And just make different queries in google.
|
|
|
|
|
Logged
|
|
|
|
|
thedarkness
|
 |
« Reply #9 on: July 24, 2007, 02:24:07 PM » |
|
Use something like wireshark to see what headers it's actually sending.
Cheers, td
|
|
|
|
|
Logged
|
"I want to be the guy my dog thinks I am." - Unknown
|
|
|
|