Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39408 > unrolled thread

Re: emulating browser cgi get in java

Started byLothar Kimmeringer <news201705@kimmeringer.de>
First post2020-03-28 20:03 +0100
Last post2020-03-30 07:08 +0000
Articles 7 — 3 participants

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: emulating browser cgi get in java Lothar Kimmeringer <news201705@kimmeringer.de> - 2020-03-28 20:03 +0100
    Re: emulating browser cgi get in java Martin Gregorie <martin@mydomain.invalid> - 2020-03-28 21:18 +0000
      Re: emulating browser cgi get in java Lothar Kimmeringer <news201705@kimmeringer.de> - 2020-03-29 16:37 +0200
        Re: emulating browser cgi get in java Martin Gregorie <martin@mydomain.invalid> - 2020-03-29 17:30 +0000
          Re: emulating browser cgi get in java Lothar Kimmeringer <news201705@kimmeringer.de> - 2020-03-29 20:28 +0200
    Re: emulating browser cgi get in java Andreas Leitgeb <avl@logic.at> - 2020-03-30 06:44 +0000
      Re: emulating browser cgi get in java Martin Gregorie <martin@mydomain.invalid> - 2020-03-30 07:08 +0000

#39408 — Re: emulating browser cgi get in java

FromLothar Kimmeringer <news201705@kimmeringer.de>
Date2020-03-28 20:03 +0100
SubjectRe: emulating browser cgi get in java
Message-ID<810d0qz89jmy.dlg@kimmeringer.de>
maxmikes001@gmail.com wrote:

> This should be simple, but it's really foiling me; I can send the browser this command: 
> http://192.168.1.66/man.cgi?redirect=&faulure=&type=door_on&securitystate=1
> 
> and it does exactly what it's supposed to. But in Java when I try:
> 
> URL url = new URL("http:/" + clientid + "/man.cgi?redirect=&faulure=&type=door_on&securitystate=1");
> 
> it fails. Any hints please?

How does it fail. A browser send a couple of request headers
that might be expected by the server. URL doesn't do that
so that might be a reason for the failure.

Without knowing the failure (exception, etc.) you see, this
is only guessing, though.


Cheers, Lothar
-- 
Lothar Kimmeringer                E-Mail: spamfang@kimmeringer.de
               PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
                 questions!

[toc] | [next] | [standalone]


#39409

FromMartin Gregorie <martin@mydomain.invalid>
Date2020-03-28 21:18 +0000
Message-ID<r5oevo$loj$1@dont-email.me>
In reply to#39408
On Sat, 28 Mar 2020 20:03:02 +0100, Lothar Kimmeringer wrote:

> maxmikes001@gmail.com wrote:
> 
>> This should be simple, but it's really foiling me; I can send the
>> browser this command:
>> http://192.168.1.66/man.cgi?
redirect=&faulure=&type=door_on&securitystate=1
>> 
>> and it does exactly what it's supposed to. But in Java when I try:
>> 
>> URL url = new URL("http:/" + clientid +
>> "/man.cgi?redirect=&faulure=&type=door_on&securitystate=1");
>> 
>> it fails. Any hints please?
> 
> How does it fail. A browser send a couple of request headers that might
> be expected by the server. URL doesn't do that so that might be a reason
> for the failure.
> 
Better yet, post an SSCCE that demonstrates the problem:

http://sscce.org/


-- 
Martin    | martin at
Gregorie  | gregorie dot org

[toc] | [prev] | [next] | [standalone]


#39410

FromLothar Kimmeringer <news201705@kimmeringer.de>
Date2020-03-29 16:37 +0200
Message-ID<1m76opf8rcm1w$.dlg@kimmeringer.de>
In reply to#39409
Martin Gregorie wrote:

> On Sat, 28 Mar 2020 20:03:02 +0100, Lothar Kimmeringer wrote:
> 
>> maxmikes001@gmail.com wrote:
>>>
>>> http://192.168.1.66/man.cgi?
[...]
>> 
> Better yet, post an SSCCE that demonstrates the problem:

How should that help if the problem is an interop-problem
and the server in question is in a private network?


Cheers, Lothar
-- 
Lothar Kimmeringer                E-Mail: spamfang@kimmeringer.de
               PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
                 questions!

[toc] | [prev] | [next] | [standalone]


#39411

FromMartin Gregorie <martin@mydomain.invalid>
Date2020-03-29 17:30 +0000
Message-ID<r5qlvb$1re$1@dont-email.me>
In reply to#39410
On Sun, 29 Mar 2020 16:37:09 +0200, Lothar Kimmeringer wrote:

> Martin Gregorie wrote:
> 
>> On Sat, 28 Mar 2020 20:03:02 +0100, Lothar Kimmeringer wrote:
>> 
>>> maxmikes001@gmail.com wrote:
>>>>
>>>> http://192.168.1.66/man.cgi?
> [...]
>>> 
>> Better yet, post an SSCCE that demonstrates the problem:
> 
> How should that help if the problem is an interop-problem and the server
> in question is in a private network?
>
Don't get me wrong, but since you haven't said where the problem is, only 
showed us a code fragment that apparently doesn't work, its possible that 
you haven't yet localised the problem. Producing an SSCCE will help to do 
that. 

So approaches:

(a) Have you confirmed that 'clientid' contains what you think it does?

(b) An SSCE which accepts 'clientid' as a command line argument and 
displays the assembled URL parameter before creating the new URL instance 
will let you see the effect of changing 'clientid' contents and whether 
the URL it assembled is valid. Both will go some way to showing where the 
problem actually is. Creating the URL can throw an Exception, so your SSCE 
*must* catch it and display its content. 

The above are a couple of the hints you asked for. 


-- 
Martin    | martin at
Gregorie  | gregorie dot org

[toc] | [prev] | [next] | [standalone]


#39412

FromLothar Kimmeringer <news201705@kimmeringer.de>
Date2020-03-29 20:28 +0200
Message-ID<1o2kw5u6ipagn$.dlg@kimmeringer.de>
In reply to#39411
Martin Gregorie wrote:

> On Sun, 29 Mar 2020 16:37:09 +0200, Lothar Kimmeringer wrote:
> 
>> Martin Gregorie wrote:
>>
>>> Better yet, post an SSCCE that demonstrates the problem:
>> 
>> How should that help if the problem is an interop-problem and the server
>> in question is in a private network?
>>
> Don't get me wrong, but since you haven't said where the problem is,

How could I? I'm not the OP.


Cheers, Lothar
-- 
Lothar Kimmeringer                E-Mail: spamfang@kimmeringer.de
               PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
                 questions!

[toc] | [prev] | [next] | [standalone]


#39413

FromAndreas Leitgeb <avl@logic.at>
Date2020-03-30 06:44 +0000
Message-ID<slrnr8359r.p7n.avl@logic.at>
In reply to#39408
Lothar Kimmeringer <news201705@kimmeringer.de> wrote:
> maxmikes001@gmail.com wrote:
>> This should be simple, but it's really foiling me; I can send the browser this command: 
>> http://192.168.1.66/man.cgi?redirect=&faulure=&type=door_on&securitystate=1
>> and it does exactly what it's supposed to. But in Java when I try:
>> URL url = new URL("http:/" + clientid + "/man.cgi?redirect=&faulure=&type=door_on&securitystate=1");
>> it fails. Any hints please?

My newsserver didn't even show maxmikes' post. I was curious, and looked
it up on groups.google.com, and there I saw it from March 12th, answered
the very next day by Silvio, and his answer seemed pretty plausible.

Since no one seems to have seen the answer (maybe except the OP, as he
didn't come back), this was it:  "A missing slash in there somewhere?"

[toc] | [prev] | [next] | [standalone]


#39414

FromMartin Gregorie <martin@mydomain.invalid>
Date2020-03-30 07:08 +0000
Message-ID<r5s5u4$vdl$1@dont-email.me>
In reply to#39413
On Mon, 30 Mar 2020 06:44:11 +0000, Andreas Leitgeb wrote:

> Lothar Kimmeringer <news201705@kimmeringer.de> wrote:
>> maxmikes001@gmail.com wrote:
>>> This should be simple, but it's really foiling me; I can send the
>>> browser this command:
>>> http://192.168.1.66/man.cgi?
redirect=&faulure=&type=door_on&securitystate=1
>>> and it does exactly what it's supposed to. But in Java when I try:
>>> URL url = new URL("http:/" + clientid +
>>> "/man.cgi?redirect=&faulure=&type=door_on&securitystate=1");
>>> it fails. Any hints please?
> 
> My newsserver didn't even show maxmikes' post. I was curious, and looked
> it up on groups.google.com, and there I saw it from March 12th, answered
> the very next day by Silvio, and his answer seemed pretty plausible.
> 
> Since no one seems to have seen the answer (maybe except the OP, as he
> didn't come back), this was it:  "A missing slash in there somewhere?"

I remember seeing the original post, but its since vanished - I thought 
that was because along the way I'd managed to clear and reload 
comp.lang.java.programmer and assumed it had dropped off. I don't recall 
seeing Silvio's post at all and its not visible now.


-- 
Martin    | martin at
Gregorie  | gregorie dot org

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web