Skip to content

Commit 60d1b5b

Browse files
committed
Resync
1 parent 669870c commit 60d1b5b

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

file/nbio/nbio_linux.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <stdlib.h>
3232
#include <stdint.h>
3333
#include <string.h>
34+
#include <time.h>
3435

3536
#include <unistd.h>
3637
#include <fcntl.h>

net/net_http.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,7 @@ bool net_http_connection_done(struct http_connection_t *conn)
327327
{
328328
int has_port = 0;
329329

330-
if (!conn)
331-
return false;
332-
333-
if (!conn->domain || !*conn->domain)
330+
if (!conn || !conn->domain || !*conn->domain)
334331
return false;
335332

336333
if (*conn->scan == ':')
@@ -357,7 +354,7 @@ bool net_http_connection_done(struct http_connection_t *conn)
357354
{
358355
/* domain followed by location - split off the location */
359356
/* site.com/path.html or site.com:80/path.html */
360-
*conn->scan = '\0';
357+
*conn->scan = '\0';
361358
conn->location = conn->scan + 1;
362359
return true;
363360
}
@@ -375,30 +372,28 @@ bool net_http_connection_done(struct http_connection_t *conn)
375372
if (!has_port)
376373
{
377374
/* if there wasn't a port, we have to expand the urlcopy so we can separate the two parts */
378-
size_t domain_len = strlen(conn->domain);
375+
size_t domain_len = strlen(conn->domain);
379376
size_t location_len = strlen(conn->scan);
380-
char* urlcopy = (char*)malloc(domain_len + location_len + 2);
377+
char* urlcopy = (char*)malloc(domain_len + location_len + 2);
381378
memcpy(urlcopy, conn->domain, domain_len);
382379
urlcopy[domain_len] = '\0';
383380
memcpy(urlcopy + domain_len + 1, conn->scan, location_len + 1);
384381

385382
free(conn->urlcopy);
386-
conn->domain = conn->urlcopy = urlcopy;
387-
conn->location = conn->scan = urlcopy + domain_len + 1;
383+
conn->domain = conn->urlcopy = urlcopy;
384+
conn->location = conn->scan = urlcopy + domain_len + 1;
388385
}
389386
else
390387
{
391388
/* there was a port, so overwriting the : will terminate the domain and we can just point at the ? */
392-
conn->location = conn->scan;
389+
conn->location = conn->scan;
393390
}
394391

395392
return true;
396393
}
397-
else
398-
{
399-
/* invalid character after domain/port */
400-
return false;
401-
}
394+
395+
/* invalid character after domain/port */
396+
return false;
402397
}
403398

404399
void net_http_connection_free(struct http_connection_t *conn)
@@ -430,7 +425,8 @@ void net_http_connection_free(struct http_connection_t *conn)
430425
free(conn);
431426
}
432427

433-
void net_http_connection_set_user_agent(struct http_connection_t* conn, const char* user_agent)
428+
void net_http_connection_set_user_agent(
429+
struct http_connection_t* conn, const char* user_agent)
434430
{
435431
if (conn->useragentcopy)
436432
free(conn->useragentcopy);

0 commit comments

Comments
 (0)