working as unpaid intern in H1B cap-gap period

I am on my F1 OPT which will expire on Feb 6th. My company has agreed to file for H1B. I have read that I can stay legally in U.S. after my OPT grace period, but not “authorized to work” until my H1B is approved. My question is can I do an unpaid internship in the same or another company between Feb and Oct? if not can i volunteer at a non-profit?

Any help will be appreciated.

I think you can but you should check w/ your school DSO as well. Also, you have to make sure that no labor laws are broken. A company cannot hire you for free for a job for which they would had to pay someone else.