hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sambaiah, Vishwas" <vishwas.samba...@citigroup.com>
Subject Wierd results when writing response headers to browser
Date Mon, 09 May 2005 13:38:00 GMT
Hi,

Sorry to be posting this again but I am in dire need of some suggestions.
 
In a simple request-response sequel between the browser --> HttpClient
--> Host, I read the response headers (prepend it with StatusLine), the
response body as bytes and write it back to the browser (which
originated the requests) in that order. I have ensures per RFC that CRLF
follows each response header and an additional one at the end of
response headers.
 
I continuously get Connection Reset By Peer exception if I write the
response to the browser. If I dont write the response headers,
everything works just fine except that there are some websites I cannot
access which set cookies/ create URLs using Javascripts. I guess I have
hit a dead end thinking on this....Thoughts? Suggestions? Appreciate
your time in advance.
 
--------------------
here 'client' is a class where I instantiate HttpClient, 'out' is
browser socket
    String responseHeaders = client.getResponseHeaders(); (This is
parsed string)
    if(responseHeaders != null)
        out.write(responseHeaders.getBytes());
       System.out.println("CUSTOM LOG :: Response Headers = " +
responseHeaders);
    byte data[] = new byte[2000];
    int count;
    while (( count  = in.read(data)) > 0)
    {
     // Send bytesto client     
      out.write(data,0,count);
     }
        System.out.println("CUSTOM LOG :: Response Body = " +
responseBody);
    }
    String responseFooters = client.getResponseFooters();
       if(responseFooters != null)
        out.write(responseFooters.getBytes());
       System.out.println("CUSTOM LOG :: Response Footers = " +
responseFooters);
------------------
 
Much Thanks,
Vish

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

SOMETIMES YOU NEED TO GO FAR, TO FIND WHAT IS CLOSEST TO YOU



-----Original Message-----
From: Vishwas [mailto:vishwas@savinaya.com]
Sent: Sunday, May 08, 2005 11:31 AM
To: httpclient-user@jakarta.apache.org
Subject: Wierd results when writing response headers to browser


Hi,
 
In a simple request-response sequel between the browser --> HttpClient
--> Host, I read the response headers (prepend it with StatusLine), the
response body as bytes and write it back to the browser (which
originated the requests) in that order. I have ensures per RFC that CRLF
follows each response header and an additional one at the end of
response headers.
 
I continuously get Connection Reset By Peer exception if I write the
response to the browser. If I dont write the response headers,
everything works just fine except that there are some websites I cannot
access which set cookies/ create URLs using Javascripts. I guess I have
hit a dead end thinking on this....Thoughts? Suggestions? Appreciate
your time in advance.
 
--------------------
here 'client' is a class where I instantiate HttpClient, 'out' is
browser socket
    String responseHeaders = client.getResponseHeaders(); (This is
parsed string)
    if(responseHeaders != null)
        out.write(responseHeaders.getBytes());
       System.out.println("CUSTOM LOG :: Response Headers = " +
responseHeaders);
    byte data[] = new byte[2000];
    int count;
    while (( count  = in.read(data)) > 0)
    {
     // Send bytesto client     
      out.write(data,0,count);
     }
        System.out.println("CUSTOM LOG :: Response Body = " +
responseBody);
    }
    String responseFooters = client.getResponseFooters();
       if(responseFooters != null)
        out.write(responseFooters.getBytes());
       System.out.println("CUSTOM LOG :: Response Footers = " +
responseFooters);
------------------
 
Much Thanks,
Vish


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message