fetch: accept longer lines

This commit is contained in:
K. Lange 2023-12-07 16:22:28 +09:00
parent ea99f32e9d
commit 6112ca05cb

View File

@ -161,10 +161,11 @@ int collect_password(char * password) {
return 0; return 0;
} }
#define MAX_HTTP_LINE 1024
void read_http_line(char * buf, FILE * f) { void read_http_line(char * buf, FILE * f) {
memset(buf, 0x00, 256); memset(buf, 0x00, MAX_HTTP_LINE);
fgets(buf, 255, f); fgets(buf, MAX_HTTP_LINE-1, f);
char * _r = strchr(buf, '\r'); char * _r = strchr(buf, '\r');
if (_r) { if (_r) {
*_r = '\0'; *_r = '\0';
@ -187,7 +188,7 @@ int http_fetch(FILE * f) {
/* Parse response */ /* Parse response */
{ {
char buf[256]; char buf[MAX_HTTP_LINE];
read_http_line(buf, f); read_http_line(buf, f);
char * elements[3]; char * elements[3];
@ -211,7 +212,7 @@ int http_fetch(FILE * f) {
/* Parse headers */ /* Parse headers */
while (1) { while (1) {
char buf[256]; char buf[MAX_HTTP_LINE];
read_http_line(buf, f); read_http_line(buf, f);
if (!*buf) { if (!*buf) {