rawhttp icon indicating copy to clipboard operation
rawhttp copied to clipboard

ReadAll function failed to read

Open AlessandroZ opened this issue 6 years ago • 1 comments

Hi @tomnomnom,

This issue could be related to https://github.com/tomnomnom/rawhttp/issues/5.

I had some timeout problems using your tool so I tried to investigate a bit to fix it. Fixing the timeout to 5s didn't resolve my problem (with req.Timeout = time.Second * 5). However, I have seen that the timeout wasn't the problem but the hang came from the ReadAll function. When its passed here and it arrives here.

Even reading byte by byte the problem occured:

} else {

	for {
		v, err := r.ReadByte()
		if v == 0 || err != nil {
			break
		}
        resp.body = append(resp.body, v)
    }
}

I try to manage to check the size before reading the buffer but without success. Right now, I have removed the else condition to be sure it does not hang out.

Thanks again for all your tools, your doing an amazing work.

AlessandroZ avatar Oct 02 '19 10:10 AlessandroZ

Same thing when the server does not respond any answer, it hangs out here. Seems difficult to detect if r is legit or not. :(

AlessandroZ avatar Oct 02 '19 10:10 AlessandroZ