[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Need help with Net::HTTP Post

Sudhi Kulkarni

2/26/2009 7:38:00 AM

Hi,

I am trying do a Net::HTTP post, the post returns with a 201 Created but
still the thread executing the script is stuck until Read Timeout
occurs. Need help to understand how to comeout of the Post when a
response is obtained. The code snippet I am using is as below

fd= File.open("test.xml","rb")
h = Net::HTTP.new("<ip-address>", 8080)
h.post('/test/test1',fd.read)

Thanks for the help in advance

Regards,
Sudhi
--
Posted via http://www.ruby-....

4 Answers

Brian Candler

2/26/2009 1:22:00 PM

0

Sudhi Kulkarni wrote:
> Hi,
>
> I am trying do a Net::HTTP post, the post returns with a 201 Created but
> still the thread executing the script is stuck until Read Timeout
> occurs. Need help to understand how to comeout of the Post when a
> response is obtained. The code snippet I am using is as below
>
> fd= File.open("test.xml","rb")
> h = Net::HTTP.new("<ip-address>", 8080)
> h.post('/test/test1',fd.read)

How do you know the post returns with a 201, if it isn't getting past
the h.post line?

Best way to find out what's going on is with tcpdump or wireshark.

It's possible that there's some HTTP/1.1 nastiness going on, e.g. one
side thinks the connection should remain open whilst the other thinks it
should be closed, possibly combined with a missing Content-Length:
header from one side or the other.
--
Posted via http://www.ruby-....

Sudhi Kulkarni

2/26/2009 1:53:00 PM

0

Brian Candler wrote:
> Sudhi Kulkarni wrote:
>> Hi,
>>
>> I am trying do a Net::HTTP post, the post returns with a 201 Created but
>> still the thread executing the script is stuck until Read Timeout
>> occurs. Need help to understand how to comeout of the Post when a
>> response is obtained. The code snippet I am using is as below
>>
>> fd= File.open("test.xml","rb")
>> h = Net::HTTP.new("<ip-address>", 8080)
>> h.post('/test/test1',fd.read)
>
> How do you know the post returns with a 201, if it isn't getting past
> the h.post line?
>
> Best way to find out what's going on is with tcpdump or wireshark.
>
> It's possible that there's some HTTP/1.1 nastiness going on, e.g. one
> side thinks the connection should remain open whilst the other thinks it
> should be closed, possibly combined with a missing Content-Length:
> header from one side or the other.

Hi,
That is exactly what I had done, Wireshark shows that the response is
obtained as 201 created but then the script still continues to wait...

Thanks,
Sudhi
--
Posted via http://www.ruby-....

Brian Candler

2/26/2009 8:00:00 PM

0

Sudhi Kulkarni wrote:
> That is exactly what I had done, Wireshark shows that the response is
> obtained as 201 created but then the script still continues to wait...

OK, so post the full, exact headers of both the request and the
response.

If the response contains a Content-Length: header, check that the
response body has exactly that many bytes (counting after the \r\n\r\n
which terminates the headers)
--
Posted via http://www.ruby-....

choro

3/4/2012 9:27:00 PM

0

On 04/03/2012 18:45, Rifat Albayrak wrote:
> On Sun, 04 Mar 2012 17:09:32 +0000, choro<choro@tvco.net> wrote:
>
>> Bir zamanlar, eski zamanlardan bahsediyorum, iki degisik 35mm'lik
>> kameram vardi. Aradan zaman gecti. Birinde uzaga fokus yapmak icin lens
>> saga cevrilirdi, digerinde ise sola!
>
> Herhalde bunlar reflex kameralard?, yani aynas?z. Hala ?retiyorlar bu
> tip kameralar?. Teknolojik olarak ?ahane resim ?ekerler.

Son durumu bilmiyorum Rifat fakat en son bir yerde Leica 35mm camera
lens ve sairelerini indirimli satiyorlardi. Demek ki artik alan yok.
Zaten yakinda 35mm'lik film de kalmiyacak piyasada.

>> Kemeralarin biri, daha dogrusu kamera setlerimden biri Zeiss Contax RTS
>> II medeli idi. Birkac lensim ve iki de kameram vardi bu modelden. Ve bir
>
> Ben de bir aralar RTS III alma?a hevesliydim. ?ok g?zel makinalard?r.
> Bilhassa bunlar?n fok?sleme sistemleri de?i?ikti.

RTS III RTS II'nun motorlu versiyonu idi hemen hemen. Ben de bir
bakmistim fakat koskoca makine yav. Motorize fotograf cekmek istemezsen
oyle makinayi ne yapacaksin. Sonradan Contax'in DSLR'ini da yapmislardi.
Fena degil fakat Ingilterede fiyati o zamanlar bile ?5,000 sterlindi.
Insan o fiyata nerede ise apartman dairesi satin alabilirdi o zamanlar.
RTS III modelinden sonra tek bir Rangefinder tipi model gelistirdiler.
Kucukce ve gayet sirin. Kolleksiyona konulabilecek bir kamera. Kalite
ise harika!
>
>> lensim de Sigma APO 50-200 zoom lens idi. Fakat sen Sigma deyip gecme.
>> Bu harika bir lens idi. Fiyati ise Zeiss lens'in dortte biri!
>
> ?nan?r?m. Bazan (her zaman de?il) bu 3. parti firmalar turnay?
> g?z?nden vuruyor. Mesela Tamron'un 90mm macro lensi var,
> d?nyan?n en iyi macro lenslerinden biri olarak kabul edilir herkes
> taraf?ndan, Nikon'un ayn? lensinden 3 kat daha ucuzdur.
> ?ftiharla ilan ederim; bende var bu lensten. Tabii evde ne kadar
> ila? ?isesi, mezarl?ktan ?al?nma ?i?ek (?aka) varsa hepsinin
> macro/closeup resimleri ?ekilmi?, en fazla 6 ay kadar 'g?zde oyuncak'
> olarak tahtta kald?ktan sonra bir k??eye tozlanmak ?zere at?lm??t?r.
> Dur ?imdi akl?ma gelmi?ken bir iki resim ?ekeyim bununla. Ge?en g?n
> g?zel bir deri k?l?f? vard? onu g?rd?m i?i bo?tu. Nereye koydum derken
> hat?rlad?m nerede oldu?unu, ?antaya atm???m toz kapmas?n diye.
>
>> En iyisi hep ayni model kamera ile calismak. Malum her kamera degisik.
>> Insanin akli karisir!
>
> Tamamen kat?l?yorum. Ak?l kar??mas?ndan ?ok para da tasarruf edersin.
> ?imdi ben Canon a ge?mek istesem mesele de?il kameray? de?i?tirmek.
> Sorun lensleri sat?n almakta. As?l onlar yek?n tutuyor c?zdan i?in. Ve
> benim gibi maymun i?tahl? bir amat?r fotocu i?in a??r bir y?k oluyor.
> Hani resim ?ekip satsam para kazansam bu i?ten anlar?m. Aksi takdirde
> Nikonda dur diyorum kendime.
> ?ok ?nceleri antik kameralar toplard?m. Bilhass Leica II-III serileri
> falan. Sonra bir g?n hepsini satt?m. fakat hala elimde bir iki film
> kameras? falan var yani. Mesela Nikon F3 HP var, tam te?ekk?ll?
> (yani motoru, macro tesisat?, flash tak?m? vesaire) ?ok severim.
> Arada bir ??kar?r halini hat?r?n? sorar sonra tekrar yerine koyar?m.:)
>
>> Kendime bir hamal bulsam Haselblad sistemi alirdim. Parami beraberimde
>> goturecek degilim ya!
>
> Do?ru. Fakat m?barek, ge?en g?n bakt?m bir digital olan?na 38 bin
> dolar diyor. Ben hayatta k?yamam bu kadar paraya bir kamera i?in.
>
>> Diger yonden Panasonic TZ3'mi devamli cebimde tasirim. Kisin paltomun
>> cebinde de bir Nikon P5100 var. Eh, napalim DSLR resolusyonu yok bu
>> kameralarda fakat ne derler? En iyi kamera beraberindeki kameradir. Ne
>> makro ne de telefoto lenslere ihtiyacim var. Ne de flash'a. Bu kucuk cep
>> kameralari az cok her seyi yapar. Eh, napalim, varsin DSLR kalitesi
>> olmasin artik.
>
> Resolution (pixel say?s?) da her?ey de?il zaten. Olsa daha iyi de..
> Bak bu arkada? k?yd?r?t?k Canon A60 ile ?ahane resimler ?eker.
> Vaktin olursa bir g?z at:
>
> http://go...

Bu siteye giremedim. Site adresini dogru mu yazdin?

Merak edip bu Canon A60'ye bir goz attim. 2 Mpxl'lik bir kamera fakat
f2.8 lensi sahane bir lens'e benziyor. Benim de en cok hosuma giden bir
Kyocera M410R dijital kameram var. Harika. Eline aldimin o kamerayi
sanki elinin bir uzantisi oluyor. Maalesef bu modeli cikardiktan hemen
sonra Yashica dijital foto sahasindan el cekti.

Bir de hosuma given 3 MPxl'lik Fuji F610 kameram var. Porsche deseni.
Kalite gayet yuksek. Gayet degisik ve enteresan bir kamera. Fakat fiyati
da ona gore idi, mubaregin!

Fazla yuksek pixelli sensorlarin zaten kendilerine oz kusurlari var.

Benim 24" 1920x1200 Samsung bilgisayar ekranim, bir hesapladim, 2.3
MPxl.Daha fazla detay gosteremez, degil mi?