The larva, commonly known as the silkworm, secretes a viscous fluid from its salivary glands. This fluid is primarily made of protein (fibroin) and a gummy substance (sericin). As the larva spins this fluid around itself to form a protective cocoon for its pupal stage, the fluid hardens upon exposure to air, forming the silk thread.