Changeset 26b6789 in mainline
- Timestamp:
- 2012-05-13T07:45:50Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b4ec1ea
- Parents:
- 84c86819
- Files:
-
- 2 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r84c86819 r26b6789 112 112 $(USPACE_PATH)/srv/net/udp/udp \ 113 113 $(USPACE_PATH)/srv/taskmon/taskmon \ 114 $(USPACE_PATH)/srv/devman/devman 114 $(USPACE_PATH)/srv/devman/devman \ 115 $(USPACE_PATH)/srv/websrv/websrv 115 116 116 117 RD_DRVS = \ … … 184 185 $(USPACE_PATH)/app/usbinfo/usbinfo \ 185 186 $(USPACE_PATH)/app/vuhid/vuh \ 186 $(USPACE_PATH)/app/mkbd/mkbd \ 187 $(USPACE_PATH)/app/websrv/websrv 187 $(USPACE_PATH)/app/mkbd/mkbd 188 188 189 189 ifeq ($(CONFIG_PCC),y) -
uspace/Makefile
r84c86819 r26b6789 69 69 app/nettest3 \ 70 70 app/ping \ 71 app/websrv \72 71 app/sysinfo \ 73 72 app/mkbd \ … … 103 102 srv/hid/remcons \ 104 103 srv/hw/char/s3c24xx_uart \ 104 srv/websrv \ 105 105 drv/infrastructure/root \ 106 106 drv/infrastructure/rootvirt \ -
uspace/srv/websrv/websrv.c
r84c86819 r26b6789 1 1 /* 2 * Copyright (c) 201 1Jiri Svoboda2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 #include <stdlib.h> 42 42 #include <fcntl.h> 43 #include <task.h> 43 44 44 45 #include <net/in.h> … … 71 72 72 73 static char fbuf[BUFFER_SIZE]; 74 75 static bool verbose = false; 73 76 74 77 /** Responses to send to client. */ … … 187 190 size_t response_size = str_size(msg); 188 191 189 fprintf(stderr, "Sending response\n"); 192 if (verbose) 193 fprintf(stderr, "Sending response\n"); 194 190 195 ssize_t rc = send(conn_sd, (void *) msg, response_size, 0); 191 196 if (rc < 0) { … … 251 256 } 252 257 253 fprintf(stderr, "Request: %s", lbuf); 258 if (verbose) 259 fprintf(stderr, "Request: %s", lbuf); 254 260 255 261 if (str_lcmp(lbuf, "GET ", 4) != 0) { … … 266 272 267 273 *end_uri = '\0'; 268 fprintf(stderr, "Requested URI: %s\n", uri); 274 if (verbose) 275 fprintf(stderr, "Requested URI: %s\n", uri); 269 276 270 277 if (!uri_is_valid(uri)) { … … 287 294 "\n" 288 295 "-h | --help\n" 289 "\tShow this application help.\n"); 296 "\tShow this application help.\n" 297 "-v | --verbose\n" 298 "\tVerbose mode\n"); 290 299 } 291 300 … … 306 315 307 316 port = (uint16_t) value; 317 break; 318 case 'v': 319 verbose = true; 308 320 break; 309 321 /* Long options with double dash */ … … 318 330 319 331 port = (uint16_t) value; 332 } else if (str_cmp(argv[*index] +2, "verbose") == 0) { 333 verbose = true; 320 334 } else { 321 335 usage(); … … 358 372 } 359 373 360 fprintf(stderr, "Creating socket\n"); 374 printf("%s: HelenOS web server\n", NAME); 375 376 if (verbose) 377 fprintf(stderr, "Creating socket\n"); 361 378 362 379 int listen_sd = socket(PF_INET, SOCK_STREAM, 0); … … 380 397 } 381 398 382 fprintf(stderr, "Listening for connections at port %" PRIu16 "\n", 383 port); 399 fprintf(stderr, "%s: Listening for connections at port %" PRIu16 "\n", 400 NAME, port); 401 402 task_retval(0); 403 384 404 while (true) { 385 405 struct sockaddr_in raddr; … … 393 413 } 394 414 395 fprintf(stderr, "Connection accepted (sd=%d), " 396 "waiting for request\n", conn_sd); 415 if (verbose) { 416 fprintf(stderr, "Connection accepted (sd=%d), " 417 "waiting for request\n", conn_sd); 418 } 397 419 398 420 rbuf_out = 0; … … 412 434 } 413 435 414 fprintf(stderr, "Connection closed\n"); 436 if (verbose) 437 fprintf(stderr, "Connection closed\n"); 415 438 } 416 439
Note:
See TracChangeset
for help on using the changeset viewer.