Changeset 97c7682 in mainline for uspace/app/websrv/websrv.c


Ignore:
Timestamp:
2012-07-14T11:18:40Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
804d9b6
Parents:
0747468 (diff), f0348c8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Text conflict in boot/arch/arm32/Makefile.inc:

Trivial conflict around ifeq condition.

Text conflict in kernel/arch/arm32/include/mm/page.h:

Added defines and set_pt_levelx_present function.
COnflict looked horrible because of the armv4/v7 split.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/websrv/websrv.c

    r0747468 r97c7682  
    11/*
    2  * Copyright (c) 2011 Jiri Svoboda
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3636#include <bool.h>
    3737#include <errno.h>
     38#include <assert.h>
    3839#include <stdio.h>
    3940#include <sys/types.h>
     
    4142#include <stdlib.h>
    4243#include <fcntl.h>
     44#include <task.h>
    4345
    4446#include <net/in.h>
     
    7173
    7274static char fbuf[BUFFER_SIZE];
     75
     76static bool verbose = false;
    7377
    7478/** Responses to send to client. */
     
    187191        size_t response_size = str_size(msg);
    188192       
    189         fprintf(stderr, "Sending response\n");
     193        if (verbose)
     194            fprintf(stderr, "Sending response\n");
     195       
    190196        ssize_t rc = send(conn_sd, (void *) msg, response_size, 0);
    191197        if (rc < 0) {
     
    251257        }
    252258       
    253         fprintf(stderr, "Request: %s", lbuf);
     259        if (verbose)
     260                fprintf(stderr, "Request: %s", lbuf);
    254261       
    255262        if (str_lcmp(lbuf, "GET ", 4) != 0) {
     
    266273       
    267274        *end_uri = '\0';
    268         fprintf(stderr, "Requested URI: %s\n", uri);
     275        if (verbose)
     276                fprintf(stderr, "Requested URI: %s\n", uri);
    269277       
    270278        if (!uri_is_valid(uri)) {
     
    287295            "\n"
    288296            "-h | --help\n"
    289             "\tShow this application help.\n");
     297            "\tShow this application help.\n"
     298            "-v | --verbose\n"
     299            "\tVerbose mode\n");
    290300}
    291301
     
    306316               
    307317                port = (uint16_t) value;
     318                break;
     319        case 'v':
     320                verbose = true;
    308321                break;
    309322        /* Long options with double dash */
     
    318331                       
    319332                        port = (uint16_t) value;
     333                } else if (str_cmp(argv[*index] +2, "verbose") == 0) {
     334                        verbose = true;
    320335                } else {
    321336                        usage();
     
    358373        }
    359374       
    360         fprintf(stderr, "Creating socket\n");
     375        printf("%s: HelenOS web server\n", NAME);
     376
     377        if (verbose)
     378                fprintf(stderr, "Creating socket\n");
    361379       
    362380        int listen_sd = socket(PF_INET, SOCK_STREAM, 0);
     
    380398        }
    381399       
    382         fprintf(stderr, "Listening for connections at port %" PRIu16 "\n",
    383             port);
     400        fprintf(stderr, "%s: Listening for connections at port %" PRIu16 "\n",
     401            NAME, port);
     402
     403        task_retval(0);
     404
    384405        while (true) {
    385406                struct sockaddr_in raddr;
     
    393414                }
    394415               
    395                 fprintf(stderr, "Connection accepted (sd=%d), "
    396                     "waiting for request\n", conn_sd);
     416                if (verbose) {
     417                        fprintf(stderr, "Connection accepted (sd=%d), "
     418                            "waiting for request\n", conn_sd);
     419                }
    397420               
    398421                rbuf_out = 0;
     
    412435                }
    413436               
    414                 fprintf(stderr, "Connection closed\n");
     437                if (verbose)
     438                        fprintf(stderr, "Connection closed\n");
    415439        }
    416440       
Note: See TracChangeset for help on using the changeset viewer.