You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by squeebie <je...@squeebie.com> on 2007/09/17 19:39:00 UTC

HttpURLConnection vs Socket / SocketConnection for HTTP

I'm trying to switch our application from using HttpURLConnection to Mina. 
I've narrowed down my issue to not being a Mina issue, but thought you guys
and gals might know the answer just because of your experience in this area.

I'm having some trouble with "8000" showing up in my response after I read
it in, when I know it wasn't sent by the server.

If I do this, it works right:
  URLConnection connection = url.openConnection();
  InputStreamReader isr = new InputStreamReader(connection.getInputStream(),
"UTF-8");

If I do this, it doesn't:
  Socket socket = new Socket(host, port);
  InputStreamReader isr = new InputStreamReader(socket.getInputStream(),
"UTF-8");

When I do this, I get the same results as I do when I use the Mina using a
SocketConnector.  Mixed in with the XML response I get back is "8000" in a
few places.  It's seemingly random (pseudorandom) where it shows up in the
response, but it shows up in the same places each time.

Where HttpURLConnection returns this:
    xml:lang="en-US"
and 
    MediaId="1000993680"

Socket and SocketConnection return this:
    xml:lang=8000"en-US"
and
    Me8000diaId="1000993680"

Any idea what would cause something like that?  I've narrowed it down to the
2 lines above.  If I use the first one it works well, if I use the second
one, I get these 8000's mixed in.

Again, sorry if this isn't a direct Mina question, but any ideas that anyone
has would be great.

Thanks.
-- 
View this message in context: http://www.nabble.com/HttpURLConnection-vs-Socket---SocketConnection-for-HTTP-tf4468421s16868.html#a12740901
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: HttpURLConnection vs Socket / SocketConnection for HTTP

Posted by Trustin Lee <tr...@gmail.com>.
Thanks for clarification!

Trustn

On 9/18/07, squeebie <je...@squeebie.com> wrote:
>
> I'm not sure what HTTP server is being used, it's not my server, but it's
> definitely not a Mina problem, I can reproduce the problem using just plain
> sockets.  Using Mina and writing out a 1.0 header, it works great.
>
> Thanks.
>
>
>
> Trustin Lee wrote:
> >
> > What HTTP server are you using?  Is it a server problem, or the
> > problem of the MINA HTTP client?
> >
> > Trustin
> >
> > On 9/18/07, squeebie <je...@squeebie.com> wrote:
> >>
> >> Turns out it was the server that returns me the XML.  With sockets, I was
> >> creating the header, and if I sent the server a header with HTTP 1.1, it
> >> returned crap in the response.  Switched to 1.0 and it works.
> >>
> >> Thanks anyway guys, keep up the great work with Mina.
> >> --
> >> View this message in context:
> >> http://www.nabble.com/HttpURLConnection-vs-Socket---SocketConnection-for-HTTP-tf4468421s16868.html#a12743711
> >> Sent from the Apache MINA Support Forum mailing list archive at
> >> Nabble.com.
> >>
> >>
> >
> >
> > --
> > what we call human nature is actually human habit
> > --
> > http://gleamynode.net/
> > --
> > PGP Key ID: 0x0255ECA6
> >
> >
>
> --
> View this message in context: http://www.nabble.com/HttpURLConnection-vs-Socket---SocketConnection-for-HTTP-tf4468421s16868.html#a12755982
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
>
>


-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: HttpURLConnection vs Socket / SocketConnection for HTTP

Posted by squeebie <je...@squeebie.com>.
I'm not sure what HTTP server is being used, it's not my server, but it's
definitely not a Mina problem, I can reproduce the problem using just plain
sockets.  Using Mina and writing out a 1.0 header, it works great.

Thanks.



Trustin Lee wrote:
> 
> What HTTP server are you using?  Is it a server problem, or the
> problem of the MINA HTTP client?
> 
> Trustin
> 
> On 9/18/07, squeebie <je...@squeebie.com> wrote:
>>
>> Turns out it was the server that returns me the XML.  With sockets, I was
>> creating the header, and if I sent the server a header with HTTP 1.1, it
>> returned crap in the response.  Switched to 1.0 and it works.
>>
>> Thanks anyway guys, keep up the great work with Mina.
>> --
>> View this message in context:
>> http://www.nabble.com/HttpURLConnection-vs-Socket---SocketConnection-for-HTTP-tf4468421s16868.html#a12743711
>> Sent from the Apache MINA Support Forum mailing list archive at
>> Nabble.com.
>>
>>
> 
> 
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
> 
> 

-- 
View this message in context: http://www.nabble.com/HttpURLConnection-vs-Socket---SocketConnection-for-HTTP-tf4468421s16868.html#a12755982
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: HttpURLConnection vs Socket / SocketConnection for HTTP

Posted by Trustin Lee <tr...@gmail.com>.
What HTTP server are you using?  Is it a server problem, or the
problem of the MINA HTTP client?

Trustin

On 9/18/07, squeebie <je...@squeebie.com> wrote:
>
> Turns out it was the server that returns me the XML.  With sockets, I was
> creating the header, and if I sent the server a header with HTTP 1.1, it
> returned crap in the response.  Switched to 1.0 and it works.
>
> Thanks anyway guys, keep up the great work with Mina.
> --
> View this message in context: http://www.nabble.com/HttpURLConnection-vs-Socket---SocketConnection-for-HTTP-tf4468421s16868.html#a12743711
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
>
>


-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: HttpURLConnection vs Socket / SocketConnection for HTTP

Posted by squeebie <je...@squeebie.com>.
Turns out it was the server that returns me the XML.  With sockets, I was
creating the header, and if I sent the server a header with HTTP 1.1, it
returned crap in the response.  Switched to 1.0 and it works.  

Thanks anyway guys, keep up the great work with Mina.
-- 
View this message in context: http://www.nabble.com/HttpURLConnection-vs-Socket---SocketConnection-for-HTTP-tf4468421s16868.html#a12743711
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.