The reason I revamped the way the proxy server works is because I was unable to figure out how to solve this problem :-)
Hopefully, someone out there can help you though. -Mike -----Original Message----- From: Viorres Nikos [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 09, 2002 8:31 AM To: '[EMAIL PROTECTED]' Subject: post method and proxy problem ?? Hi, all I have been doing some dev work using jmeters proxy server (I am using the proxy from jmeter beta 2). i have noticed that there is a newer version out, but that one changes completely the way the whole thing works and it is dependent on a lot of other classes as well, which i really dont want to add to my project. so here it is: When trying to do a POST from the browser through the proxy i get an error, which is basically caused by the fact that there are NO bytes in the client's socket.inputsream to read (i can verify that by calling the ClientSocket.getInputStream().available() method. The thing is that i know the browser is posting data e.g the browser sends an intial request such as: POST blah blah ..... CONTENT-LENGTH 254 ..... which means that the browser is supposed to post 254 bytes of data. is it possible that the post bytes are read with the initial request for an uknown reason ? Below you can see (red highlighted code) where i am trying to read the the post bytes from the inputstream. thanx a lot in advance Nick try { // // Read HTTP Request from client // ClientSocket.setSoTimeout(6000); request.parse(ClientSocket.getInputStream()); config.increaseFilesCached(); url = new URL(request.url); requestBuffer.append(url.toString()); config.hasChanged(); config.notifyObservers(); // for debug purposes print the parsed request in text area output.set("\nRequest " + request.toString()); serverName = url.getHost(); config.increaseMisses(); SrvrSocket = new Socket(request.serverName(),request.serverPort()); DataOutputStream srvOut = new DataOutputStream(SrvrSocket.getOutputStream()); request.url = request.serverUrl(); // // Send the url to web server (or father proxy) // srvOut.writeBytes(request.toString(true)); srvOut.flush(); // Send data to server (needed for post method) //**************** Does not work properly******************* StringBuffer buff = new StringBuffer(); int readValue; for (int i = 0; i < request.contentLength; i++) { try { readValue = ClientSocket.getInputStream().read(); buff.append((char)readValue); SrvrSocket.getOutputStream().write(readValue); } catch(InterupptedException e) { output.set(e.getMessage()); break; } } SrvrSocket.getOutputStream().flush(); } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
