[erlang-questions] httprequest using erlang

Hynek Vychodil vychodil.hynek@REDACTED
Fri Feb 13 11:20:09 CET 2009


You should make HTTP response but you have made raw response directly to
socket.

Try this

gen_tcp:send(Socket, ["HTTP/1.0 200 OK\r\nContent-Type:text/plain\r\n\r\nI
Received ", Data]),

On Fri, Feb 13, 2009 at 10:22 AM, prasantha kumara <jlprasantha@REDACTED>wrote:

> Hi all!
> I am dealing with a erlang server which is accept http request from
> other frramework.i have sent a request to the server. following is the
> some code which i have used to do it.
>
> inet:setopts(Socket, [{active, once}]),
> receive
> % do something with the data you receive
> {tcp, Socket, Data} ->
> gen_tcp:send(Socket, "I Received " ++ Data),
>
>  but when it is recieved from the java it gives following error.
>
>
> The server 127.0.0.1 failed to respond with a valid HTTP response
>        at
> org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1846)
>        at
> org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
>        at
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
>        at
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
>        at
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
>        at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
>        at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
>        at httpRequest.Test.main(Test.java:24)
>
>
> Can any body help me to format the response correctly using erlang ?
>
> thanks
> prasantha.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



-- 
--Hynek (Pichi) Vychodil

Analyze your data in minutes. Share your insights instantly. Thrill your
boss.  Be a data hero!
Try Good Data now for free: www.gooddata.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090213/fa7d91a6/attachment.htm>


More information about the erlang-questions mailing list