Ticket #471: ticket471.2.patch
| File ticket471.2.patch, 1.5 KB (added by gbastien, 2 years ago) |
|---|
-
api.c
489 489 #endif 490 490 if (strncasecmp(buf,"Authorization: ",15) == 0) 491 491 { 492 cp = strchr(buf,':') + 2; 493 if (strncmp(cp,"Basic ", 6) != 0) 494 { 495 /* Unknown auth method */ 496 } 497 else 498 { 499 char authBuf[100]; 492 cp = strchr(buf,':'); 493 if (cp) { 494 cp += 2; 500 495 501 cp = strchr(cp,' ') + 1; 502 _httpd_decode(cp, authBuf, 100); 503 r->request.authLength = 504 strlen(authBuf); 505 cp = strchr(authBuf,':'); 506 if (cp) 496 if (strncmp(cp,"Basic ", 6) != 0) 507 497 { 508 *cp = 0; 509 strncpy( 510 r->request.authPassword, 511 cp+1, HTTP_MAX_AUTH); 512 r->request.authPassword[HTTP_MAX_AUTH-1]=0; 498 /* Unknown auth method */ 513 499 } 514 strncpy(r->request.authUser, 515 authBuf, HTTP_MAX_AUTH); 516 r->request.authUser[HTTP_MAX_AUTH-1]=0; 500 else 501 { 502 char authBuf[100]; 503 504 cp = strchr(cp,' ') + 1; 505 _httpd_decode(cp, authBuf, 100); 506 r->request.authLength = 507 strlen(authBuf); 508 cp = strchr(authBuf,':'); 509 if (cp) 510 { 511 *cp = 0; 512 strncpy( 513 r->request.authPassword, 514 cp+1, HTTP_MAX_AUTH); 515 r->request.authPassword[HTTP_MAX_AUTH-1]=0; 516 } 517 strncpy(r->request.authUser, 518 authBuf, HTTP_MAX_AUTH); 519 r->request.authUser[HTTP_MAX_AUTH-1]=0; 520 } 517 521 } 518 522 } 519 523 #if 0
