fetch: accept longer lines

This commit is contained in:
K. Lange 2023-12-07 16:22:28 +09:00
parent ea99f32e9d
commit 6112ca05cb
1 changed files with 5 additions and 4 deletions

View File

@ -161,10 +161,11 @@ int collect_password(char * password) {
return 0;
}
#define MAX_HTTP_LINE 1024
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');
if (_r) {
*_r = '\0';
@ -187,7 +188,7 @@ int http_fetch(FILE * f) {
/* Parse response */
{
char buf[256];
char buf[MAX_HTTP_LINE];
read_http_line(buf, f);
char * elements[3];
@ -211,7 +212,7 @@ int http_fetch(FILE * f) {
/* Parse headers */
while (1) {
char buf[256];
char buf[MAX_HTTP_LINE];
read_http_line(buf, f);
if (!*buf) {