The correct answer is: B. Did you have

The sentence "It started to rain while I was walking home" is in the past tense. This means that the action of the sentence (the rain starting) happened before the speaker is talking. The question "Did you have an umbrella?" is also in the past tense. This means that the person asking the question is asking about something that happened before the speaker is talking.

The other options are not correct because they are not in the past tense. Option A, "Have you had an umbrella?", is in the present perfect tense. This tense is used to talk about something that happened in the past but has an effect on the present. Option C, "Will you have an umbrella?", is in the future tense. This tense is used to talk about something that will happen in the future. Option D, "Were you having an umbrella?", is in the past progressive tense. This tense is used to talk about something that was happening at a specific time in the past.

In this case, the speaker is asking about something that happened before the speaker is talking. Therefore, the correct answer is "Did you have an umbrella?".