hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vasudevan Comandur <vcoman...@gmail.com>
Subject Re: What is the right procedure to setting the User-Agent request header to masquerade HttpClient as a popular browser ?
Date Wed, 15 Sep 2010 14:47:07 GMT
Hi Sveinn,

   I had used the string which I sent to you for request header. I used the
following method to set the user agent in request header.
   Below is the syntax in Clojure Language.

         (.setRequestHeader "User-Agent" +httpc-user-agent+)

Regards
 Vasu


On Wed, Sep 15, 2010 at 8:07 PM, F.Berg <freakzoidberg@me.com> wrote:

> hi Vasu,
>
> Thanks,
>
> But I have not gotten to the stage yet to find out which string works as a
> replacement for the standard Jakarta one, as I have not been able to find
> out which file or files I need to edit in order to insert the right
> string.   We have a good idea as to what arguments need to be inserted, we
> just have not been able to figure out which file or files you need to edit
> to make this work  :(
> I am certain it is simple once you know that to do, but as relatively new
> to this, I am having some troubles finding the right file that needs to be
> edited.
>
> If you know which file or files we are to insert the argument /string  I
> would be most grateful for a heads up.
>
> I will certainly try the string you suggested once I figure out what file
> to insert it in.
>
> cheers,
> Sveinn
>
> Confucius said: "To study and not think is a waste. To think and not study is dangerous."
>
>
>
>
>
> On 15 Sep, 2010,at 09:51 AM, Vasudevan Comandur <vcomandur@gmail.com>
> wrote:
>
> Hi,
> Check if the below string will solve your problem
>
> "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.0.3)
> Gecko/2008092414 Firefox/3.0.3"
>
> Regards
> Vasu
>
> On Wed, Sep 15, 2010 at 6:51 PM, F.Berg <freakzoidberg@me.com> wrote:
>
> > Hi all,
> >
> > We are dealing with the following issue. We are using a tomcat server
> with
> > Vyre to access source material that needs to be streamed, but since the
> > client library / User-agent is identifying it self with the default
> Jakarta
> > Commons-HttpClient/3.1 tag when connecting to the other site, the
> connection
> > gets blocked and will not be unblocked unless we can send alternative
> > User-Agent profile to the source. See relevant message from the the site
> > admin :
> >
> > "The client library your software is using to download the XML is
> > identifying itself as "Jakarta Commons-HttpClient/3.1". This is the
> default
> > User-Agent of a library commonly used with crawlers. You'll need to
> change
> > the User-Agent to get unblocked. "
> >
> > From searching for a solution and from item 5 in the things to try list
> *on
> > the apache.org site*<
> http://hc.apache.org/httpclient-3.x/troubleshooting.html>and other issues
> where this
> > *solution *<
> http://www.mail-archive.com/httpclient-user@jakarta.apache.org/msg04444.html
> >has
> > been used, we know there is a way to do this. But have not found clear
> > instruction on just what you need to do in order to make this change,
> just
> > suggestions that you make the change without explaining how make this
> change
> > in a straightforward manner. There are is a number of hints that I have
> > found as to what text parameters you need to change, such as the one
> below,
> > but have not been able to find exactly which file or scrip needs to be
> > edited in order to make this change. Everything indicates this should be
> a
> > reasonably simple procedure.
> >
> > I would be grateful if someone that has successfully implemented this
> > change could let us know what is the right procedure to do this. Is the
> > only way to do this to edit the
> > org/apache/commons/httpclient/params/HttpMethodParams.class file and
> > recompile the source ? Or is there a simpler way of setting the
> User_Agent
> > request header to masquerde the HttpClient that that ?
> >
> > import orgapache.commons.httpclient.HttpClient;
> > import org.apache.commons.httpclient.params.HttpMethodParams;
> >
> > ...
> >
> > HttpClient httpclient = new HttpClient();
> >
> > httpclient.getParams().setParameter(HttpMethodParams.USER_AGENT,
> > "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
> >
> > ...
> >
> > Cheers,
> >
> > Sveinn
> >
> > Confucius said: "To study and not think is a waste. To think and not
> study is dangerous."
> >
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message