# Net::HTTP transfer limit

**URL:** <https://www.ruby-forum.com/t/net-http-transfer-limit/48820>\
**Category:** Ruby\
**Created:** [November 19, 2005, 11:19pm UTC](https://www.ruby-forum.com/t/net-http-transfer-limit/48820 "2005-11-19T23:19:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![smorabito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@smorabito](https://www.ruby-forum.com/u/smorabito)\
**Post date:** [November 19, 2005, 11:19pm UTC](https://www.ruby-forum.com/t/net-http-transfer-limit/48820/1 "2005-11-19T23:19:39Z")

</div>

I’ve done some searching through the archives, but so far I haven’t  
found an  
answer to this question.

I have an application that allows users to request arbitrary URLs. The  
underlying mechanism uses Net::HTTP.get() to fetch the object at the URL  
and  
attempts to parse it as an XML document.

That all works fine, but it leaves open a fairly trivial DoS attack – a  
user can create a CGI that spews back content continuously, for example.  
To  
lessen this potential, I would really like to specify a byte limit for  
the  
GET, i.e., “Stop reading and close the socket if you have read more than  
1MB”. HTTP ‘Range’ doesn’t seem like an option, because there’s no  
reason to  
expect a malicious server to respect it in the request.

Does anyone have any ideas, or pointers?

Thanks,

-Seth
