From: Francis Cianfrocca Date: 2006-12-30T03:56:14+09:00 Subject: Re: how to properly format data when using TCPSocket.send() On 12/29/06, Nathan Taylor wrote: > Robert Klemme wrote: > > On 29.12.2006 18:44, Nathan Taylor wrote: > >> /puttest.html HTTP/1.0\r\nHost: #{i}\r\nConnection: > >> close\r\nContent-type: text/html\r\nContent-Length: > >> 309\r\nSee Spot Run!See Spot > >> Run!See Spot Run!\r\n\r\n", 0) > > > > You need "\r\n\r\n" to separate the header from the body. Your code > > shows just a single pair. > > > > Btw, why don't you use Net::HTTP? > > > > robert > > I tried using "\r\n\r\n", but I'm still having some problems due to the > way the HTTP protocol uses multiple TCP sessions and my lack of > understanding on how to handle that with Net::TCPSocket. Looks I will > have to use Net:HTTP. I am new to OO programming, and I don't quite > understand this portion of the Net::HTTP::Put documentation. > > Constants > METHOD = 'PUT' > REQUEST_HAS_BODY = true > RESPONSE_HAS_BODY = true > > I know that I should be passing a URI and some content to include in > the "PUT" request but I do not see any explanation of how to do that. > How do I know what parameters this class accepts? > > > -- > Posted via http://www.ruby-forum.com/. > > I think you would do well to do some basic reading on HTTP. To understand how headers work, you might even read RFC-822. HTTP doesn't use multiple TCP connections (not in the sense of relating them to each other, at any rate), and I don't know what you mean when you say that it uses multiple TCP "sessions."