diff options
author | Nils Durner <durner@gnunet.org> | 2007-06-15 22:23:21 +0000 |
---|---|---|
committer | Nils Durner <durner@gnunet.org> | 2007-06-15 22:23:21 +0000 |
commit | 3701d58f5f283cbb5e618a0c988886df55963ded (patch) | |
tree | 6fb203ba79ac09a8ea31a40551bdf89fab401788 /src/daemon/session.c | |
parent | e96a7669c8d2c188db1e0aed50440ddfed70c94f (diff) | |
download | libmicrohttpd-3701d58f5f283cbb5e618a0c988886df55963ded.tar.gz libmicrohttpd-3701d58f5f283cbb5e618a0c988886df55963ded.zip |
plibc'ing
Diffstat (limited to 'src/daemon/session.c')
-rw-r--r-- | src/daemon/session.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/daemon/session.c b/src/daemon/session.c index f2dd3832..fa19f6b8 100644 --- a/src/daemon/session.c +++ b/src/daemon/session.c | |||
@@ -184,7 +184,7 @@ MHD_get_next_header_line(struct MHD_Session * session) { | |||
184 | MHD_DLOG(session->daemon, | 184 | MHD_DLOG(session->daemon, |
185 | "Received excessively long header line (>%u), closing connection.\n", | 185 | "Received excessively long header line (>%u), closing connection.\n", |
186 | 4 * MHD_MAX_BUF_SIZE); | 186 | 4 * MHD_MAX_BUF_SIZE); |
187 | close(session->socket_fd); | 187 | CLOSE(session->socket_fd); |
188 | session->socket_fd = -1; | 188 | session->socket_fd = -1; |
189 | } | 189 | } |
190 | } | 190 | } |
@@ -345,7 +345,7 @@ MHD_parse_session_headers(struct MHD_Session * session) { | |||
345 | /* FIXME: here: find cookie header and parse that! */ | 345 | /* FIXME: here: find cookie header and parse that! */ |
346 | return; | 346 | return; |
347 | DIE: | 347 | DIE: |
348 | close(session->socket_fd); | 348 | CLOSE(session->socket_fd); |
349 | session->socket_fd = -1; | 349 | session->socket_fd = -1; |
350 | } | 350 | } |
351 | 351 | ||
@@ -389,7 +389,7 @@ MHD_call_session_handler(struct MHD_Session * session) { | |||
389 | /* serios internal error, close connection */ | 389 | /* serios internal error, close connection */ |
390 | MHD_DLOG(session->daemon, | 390 | MHD_DLOG(session->daemon, |
391 | "Internal application error, closing connection."); | 391 | "Internal application error, closing connection."); |
392 | close(session->socket_fd); | 392 | CLOSE(session->socket_fd); |
393 | session->socket_fd = -1; | 393 | session->socket_fd = -1; |
394 | return; | 394 | return; |
395 | } | 395 | } |
@@ -439,7 +439,7 @@ MHD_session_handle_read(struct MHD_Session * session) { | |||
439 | __FUNCTION__); | 439 | __FUNCTION__); |
440 | return MHD_NO; | 440 | return MHD_NO; |
441 | } | 441 | } |
442 | bytes_read = recv(session->socket_fd, | 442 | bytes_read = RECV(session->socket_fd, |
443 | &session->read_buffer[session->readLoc], | 443 | &session->read_buffer[session->readLoc], |
444 | session->read_buffer_size - session->readLoc, | 444 | session->read_buffer_size - session->readLoc, |
445 | 0); | 445 | 0); |
@@ -448,8 +448,8 @@ MHD_session_handle_read(struct MHD_Session * session) { | |||
448 | return MHD_NO; | 448 | return MHD_NO; |
449 | MHD_DLOG(session->daemon, | 449 | MHD_DLOG(session->daemon, |
450 | "Failed to receive data: %s\n", | 450 | "Failed to receive data: %s\n", |
451 | strerror(errno)); | 451 | STRERROR(errno)); |
452 | close(session->socket_fd); | 452 | CLOSE(session->socket_fd); |
453 | session->socket_fd = -1; | 453 | session->socket_fd = -1; |
454 | return MHD_YES; | 454 | return MHD_YES; |
455 | } | 455 | } |
@@ -458,7 +458,7 @@ MHD_session_handle_read(struct MHD_Session * session) { | |||
458 | /* FIXME: proper handling of end of upload! | 458 | /* FIXME: proper handling of end of upload! |
459 | If we were receiving an unbounded upload, | 459 | If we were receiving an unbounded upload, |
460 | we should finish up nicely now! */ | 460 | we should finish up nicely now! */ |
461 | close(session->socket_fd); | 461 | CLOSE(session->socket_fd); |
462 | session->socket_fd = -1; | 462 | session->socket_fd = -1; |
463 | return MHD_YES; | 463 | return MHD_YES; |
464 | } | 464 | } |
@@ -488,7 +488,7 @@ MHD_add_extra_headers(struct MHD_Session * session) { | |||
488 | "close"); | 488 | "close"); |
489 | } else if (NULL == MHD_get_response_header(session->response, | 489 | } else if (NULL == MHD_get_response_header(session->response, |
490 | "Content-length")) { | 490 | "Content-length")) { |
491 | snprintf(buf, | 491 | SNPRINTF(buf, |
492 | 128, | 492 | 128, |
493 | "%llu", | 493 | "%llu", |
494 | (unsigned long long) session->response->total_size); | 494 | (unsigned long long) session->response->total_size); |
@@ -512,7 +512,7 @@ MHD_build_header_response(struct MHD_Session * session) { | |||
512 | char * data; | 512 | char * data; |
513 | 513 | ||
514 | MHD_add_extra_headers(session); | 514 | MHD_add_extra_headers(session); |
515 | sprintf(code, | 515 | SPRINTF(code, |
516 | "HTTP/1.1 %u\r\n", | 516 | "HTTP/1.1 %u\r\n", |
517 | session->responseCode); | 517 | session->responseCode); |
518 | off = strlen(code); | 518 | off = strlen(code); |
@@ -530,7 +530,7 @@ MHD_build_header_response(struct MHD_Session * session) { | |||
530 | off); | 530 | off); |
531 | pos = session->response->first_header; | 531 | pos = session->response->first_header; |
532 | while (pos != NULL) { | 532 | while (pos != NULL) { |
533 | sprintf(&data[off], | 533 | SPRINTF(&data[off], |
534 | "%s: %s\r\n", | 534 | "%s: %s\r\n", |
535 | pos->header, | 535 | pos->header, |
536 | pos->value); | 536 | pos->value); |
@@ -567,7 +567,7 @@ MHD_session_handle_write(struct MHD_Session * session) { | |||
567 | if (! session->headersSent) { | 567 | if (! session->headersSent) { |
568 | if (session->write_buffer == NULL) | 568 | if (session->write_buffer == NULL) |
569 | MHD_build_header_response(session); | 569 | MHD_build_header_response(session); |
570 | ret = send(session->socket_fd, | 570 | ret = SEND(session->socket_fd, |
571 | &session->write_buffer[session->writeLoc], | 571 | &session->write_buffer[session->writeLoc], |
572 | session->write_buffer_size - session->writeLoc, | 572 | session->write_buffer_size - session->writeLoc, |
573 | 0); | 573 | 0); |
@@ -576,8 +576,8 @@ MHD_session_handle_write(struct MHD_Session * session) { | |||
576 | return MHD_YES; | 576 | return MHD_YES; |
577 | MHD_DLOG(session->daemon, | 577 | MHD_DLOG(session->daemon, |
578 | "Failed to send data: %s\n", | 578 | "Failed to send data: %s\n", |
579 | strerror(errno)); | 579 | STRERROR(errno)); |
580 | close(session->socket_fd); | 580 | CLOSE(session->socket_fd); |
581 | session->socket_fd = -1; | 581 | session->socket_fd = -1; |
582 | return MHD_YES; | 582 | return MHD_YES; |
583 | } | 583 | } |
@@ -614,7 +614,7 @@ MHD_session_handle_write(struct MHD_Session * session) { | |||
614 | if (ret == -1) { | 614 | if (ret == -1) { |
615 | /* end of message, signal other side by closing! */ | 615 | /* end of message, signal other side by closing! */ |
616 | response->data_size = session->messagePos; | 616 | response->data_size = session->messagePos; |
617 | close(session->socket_fd); | 617 | CLOSE(session->socket_fd); |
618 | session->socket_fd = -1; | 618 | session->socket_fd = -1; |
619 | return MHD_YES; | 619 | return MHD_YES; |
620 | } | 620 | } |
@@ -625,7 +625,7 @@ MHD_session_handle_write(struct MHD_Session * session) { | |||
625 | } | 625 | } |
626 | 626 | ||
627 | /* transmit */ | 627 | /* transmit */ |
628 | ret = send(session->socket_fd, | 628 | ret = SEND(session->socket_fd, |
629 | &response->data[session->messagePos - response->data_start], | 629 | &response->data[session->messagePos - response->data_start], |
630 | response->data_size - (session->messagePos - response->data_start), | 630 | response->data_size - (session->messagePos - response->data_start), |
631 | 0); | 631 | 0); |
@@ -636,8 +636,8 @@ MHD_session_handle_write(struct MHD_Session * session) { | |||
636 | return MHD_YES; | 636 | return MHD_YES; |
637 | MHD_DLOG(session->daemon, | 637 | MHD_DLOG(session->daemon, |
638 | "Failed to send data: %s\n", | 638 | "Failed to send data: %s\n", |
639 | strerror(errno)); | 639 | STRERROR(errno)); |
640 | close(session->socket_fd); | 640 | CLOSE(session->socket_fd); |
641 | session->socket_fd = -1; | 641 | session->socket_fd = -1; |
642 | return MHD_YES; | 642 | return MHD_YES; |
643 | } | 643 | } |