danwrong / restler

REST client library for node.js
MIT License
1.99k stars 391 forks source link

delete date body on GET #183

Open jvverde opened 9 years ago

jvverde commented 9 years ago

I think I found the source of my problems with ECONNRESET. The problem occurs with get because the Content-Length header could assume very large values as I discovery wit wireshark

GET /dbc3a1 HTTP/1.1
Accept: */*
User-Agent: Restler for node.js
Host: look2seeme.iriscouch.com
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Authorization: Basic YWRtaWaki3JkaXNp
Content-Length: 23035
Connection: keep-alive

0=123&1=34&2=95&3=105&4=100&5=34&6=58&7=34&8=111&9=114&10=103&11=46&12=99&13=111&14=117&15=99&16=104&17=100&18=98&19=46&20=117&21=115&22=101&23=114&24=58&25=99&26=51&27=97&28=49&29=34&30=44&31=34&32=110&33=97&34=109&35=101&36=34&37=58&38=34&39=99&40=51&41=97&42=49&43=34&44=44&45=34&46=116&47=121&48=112&49=101&50=34&51=58&52=34&53=117&54=115&55=101&56=114&57=34&58=44&59=34&60=114&61=111&62=108&63=101&64=115&65=34&66=58&67=91&68=93&69=44&70=34&71=112&72=97&73=115&74=115&75=119&76=111&77=114&78=100&79=34&80=58&81=34&82=86&83=82&84=89&85=53&86=122&87=113&88=104&89=97&90=49&91=99&92=55&93=47&94=49&95=102&96=77&97=109&98=99&99=49&100=112&101=115&102=106&103=119&104=61&105=61&106=34&107=125&length=108&parent=%2F**%0A%20*%20%60InternalOAuthError%60%20error.%0A%20*%0A%20*%20InternalOAuthError%20wraps%20errors%20generated%20by%20node-oauth.%20%20By%20wrapping%20these%0A%20*%20objects%2C%20error%20messages%20can%20be%20formatted%20in%20a%20manner%20that%20aids%20in%20debugging%0A%20*%20OAuth%20issues.%0A%20*%0A%20*%20%40constructor%0A%20*%20%40param%20%7BString%7D%20%5Bmessage%5D%0....

The problem is related with how you decide the Content-Lengh value based on the value of options.data, so it seems to me the best approach should be to delete this buffer when the method is a GET.