136 |
136 |
137 /* If-unmodified-since */ |
137 /* If-unmodified-since */ |
138 header = pblock_findkeyval(pb_key_if_unmodified_since, rq->headers); |
138 header = pblock_findkeyval(pb_key_if_unmodified_since, rq->headers); |
139 if (header) { |
139 if (header) { |
140 if (mtm && !util_later_than(mtm, header)) { |
140 if (mtm && !util_later_than(mtm, header)) { |
141 //PRTime temptime; |
141 if(util_isdate(header)) { |
142 //PRStatus status = PR_ParseTimeString(header, PR_TRUE, &temptime); |
142 protocol_status(sn, rq, PROTOCOL_PRECONDITION_FAIL, NULL); |
143 //if (status == PR_SUCCESS) { |
143 return REQ_ABORTED; |
144 // http_status(sn, rq, PROTOCOL_PRECONDITION_FAIL, NULL); |
144 } |
145 // return REQ_ABORTED; |
|
146 //} |
|
147 } |
145 } |
148 } |
146 } |
149 |
147 |
150 /* If-none-match */ |
148 /* If-none-match */ |
151 header = pblock_findkeyval(pb_key_if_none_match, rq->headers); |
149 header = pblock_findkeyval(pb_key_if_none_match, rq->headers); |
169 if (header) { |
167 if (header) { |
170 /* If the If-match header matches the current Etag... */ |
168 /* If the If-match header matches the current Etag... */ |
171 if (!http_match_etag(header, etag, PR_TRUE)) { |
169 if (!http_match_etag(header, etag, PR_TRUE)) { |
172 protocol_status(sn, rq, PROTOCOL_PRECONDITION_FAIL, NULL); |
170 protocol_status(sn, rq, PROTOCOL_PRECONDITION_FAIL, NULL); |
173 return REQ_ABORTED; |
171 return REQ_ABORTED; |
|
172 } |
|
173 } |
|
174 |
|
175 /* If-range */ |
|
176 header = pblock_findkeyval(pb_key_if_range, rq->headers); |
|
177 char *range = pblock_findkeyval(pb_key_range, rq->headers); |
|
178 if (range && header) { |
|
179 int rmir = PR_FALSE; |
|
180 if (util_isdate(header)) { |
|
181 if (mtm && !util_later_than(mtm, header)) { |
|
182 rmir = PR_TRUE; |
|
183 } |
|
184 } else { |
|
185 if (!http_match_etag(header, etag, PR_TRUE)) { |
|
186 rmir = PR_TRUE; |
|
187 } |
|
188 } |
|
189 |
|
190 if(rmir) { |
|
191 pblock_removekey(pb_key_range, rq->headers); |
174 } |
192 } |
175 } |
193 } |
176 |
194 |
177 return REQ_PROCEED; |
195 return REQ_PROCEED; |
178 } |
196 } |