Re: i explained my main question in the title, but i have a problem with this code:

39 views
Skip to first unread message

dark knight

unread,
Sep 15, 2012, 1:38:55 PM9/15/12
to nod...@googlegroups.com
Oh my God! Sorry for my mistakes!
my main question is: how to create a HTTP-1.0 request by net.socket or http.request?

Ben Noordhuis

unread,
Sep 15, 2012, 1:44:21 PM9/15/12
to nod...@googlegroups.com
With net.Socket, just write the raw request.

You can't create HTTP/1.0 requests with http.request(), it's always HTTP/1.1.

dark knight

unread,
Sep 15, 2012, 2:01:05 PM9/15/12
to nod...@googlegroups.com
Thank you Ben.

You mean that i can not create http request with net.Socket?
ok got it.

But on things need to be resolve, can you refactoring my code to work correctly in HTTP/1.1? or help to i know what's the problem?

thanks again.

Ben Noordhuis

unread,
Sep 15, 2012, 7:06:23 PM9/15/12
to nod...@googlegroups.com
I see at least one major issue with your code example:

var options = {
host:'google.com',
method: 'CONNECT',
path: 'google.com:80',
port: 80
};

You are making a CONNECT request to a server that doesn't support it.
It's going to respond with a 400 Bad Request and close the connection.
Reply all
Reply to author
Forward
0 new messages