Gig economy workers are entitled to the same health and safety protection as permanent colleagues, the UK High Court has ruled.