| 335 pb_key_uri, |
335 pb_key_uri, |
| 336 absPath.ptr, |
336 absPath.ptr, |
| 337 absPath.length, |
337 absPath.length, |
| 338 rq->rq.reqpb); |
338 rq->rq.reqpb); |
| 339 } else { |
339 } else { |
| |
340 // util_uri_unescape_strict can modify absPath.ptr, but |
| |
341 // we want to log the original uri. However we also don't want to |
| |
342 // create an unnecessary copy. Therefore we restore the original |
| |
343 // uri here by calling util_canonicalize_uri again |
| |
344 absPath.ptr = util_canonicalize_uri( |
| |
345 pool, |
| |
346 absPath.ptr, |
| |
347 absPath.length, |
| |
348 (int*)&absPath.length); |
| |
349 |
| 340 log_ereport( |
350 log_ereport( |
| 341 LOG_FAILURE, |
351 LOG_FAILURE, |
| 342 "uri unescape failed: {%.*s}", |
352 "uri unescape failed: {%.*s}", |
| 343 (int)absPath.length, |
353 (int)absPath.length, |
| 344 absPath.ptr); |
354 absPath.ptr); |
| 345 request->status = 400; |
355 request->status = 400; |
| 346 //pblock_kvinsert(pb_key_uri, "/", 1, rq->rq.reqpb); |
356 //pblock_kvinsert(pb_key_uri, "/", 1, rq->rq.reqpb); |
| 347 |
|
| 348 // TODO: remove this debug code |
|
| 349 char tmp_file_path[128]; |
|
| 350 snprintf(tmp_file_path, 128, "logs/req_uri_fail_%lld", (long long int)time(NULL)); |
|
| 351 log_ereport(LOG_FAILURE, "uri unescape req file: %s\n", tmp_file_path); |
|
| 352 FILE *f = fopen(tmp_file_path, "w"); |
|
| 353 if(f) { |
|
| 354 fwrite(request->netbuf->inbuf, 1, request->netbuf->pos, f); |
|
| 355 fclose(f); |
|
| 356 } else { |
|
| 357 log_ereport(LOG_FAILURE, "Cannot write req uri fail file\n"); |
|
| 358 } |
|
| 359 |
|
| 360 |
357 |
| 361 return 1; |
358 return 1; |
| 362 } |
359 } |
| 363 |
360 |
| 364 // pass http header to the NSAPI request structure |
361 // pass http header to the NSAPI request structure |