Caller must free returned response */
| 318 | |
| 319 | /* Caller must free returned response */ |
| 320 | static char * |
| 321 | generate_response(const char *request) |
| 322 | { |
| 323 | // define format for response |
| 324 | // Each response contains a field X-Response-ID that contains the id of the testcase |
| 325 | #define HTTP_REQUEST_TESTCASE_FORMAT \ |
| 326 | "GET %1024s HTTP/1.%d\r\n" \ |
| 327 | "X-Request-ID: %d\r\n" |
| 328 | |
| 329 | #define HTTP_RESPONSE_DEFAULT_FORMAT \ |
| 330 | "HTTP/1.0 200 OK\r\n" \ |
| 331 | "X-Response-ID: %d\r\n" \ |
| 332 | "Cache-Control: max-age=86400\r\n" \ |
| 333 | "Content-Type: text/html\r\n" \ |
| 334 | "\r\n" \ |
| 335 | "Default body" |
| 336 | |
| 337 | #define HTTP_RESPONSE_FORMAT1 \ |
| 338 | "HTTP/1.0 200 OK\r\n" \ |
| 339 | "X-Response-ID: %d\r\n" \ |
| 340 | "Content-Type: text/html\r\n" \ |
| 341 | "Cache-Control: no-cache\r\n" \ |
| 342 | "\r\n" \ |
| 343 | "Body for response 1" |
| 344 | |
| 345 | #define HTTP_RESPONSE_FORMAT2 \ |
| 346 | "HTTP/1.0 200 OK\r\n" \ |
| 347 | "X-Response-ID: %d\r\n" \ |
| 348 | "Cache-Control: max-age=86400\r\n" \ |
| 349 | "Content-Type: text/html\r\n" \ |
| 350 | "\r\n" \ |
| 351 | "Body for response 2" |
| 352 | #define HTTP_RESPONSE_FORMAT4 \ |
| 353 | "HTTP/1.0 200 OK\r\n" \ |
| 354 | "X-Response-ID: %d\r\n" \ |
| 355 | "Cache-Control: max-age=86400\r\n" \ |
| 356 | "Content-Type: text/html\r\n" \ |
| 357 | "\r\n" \ |
| 358 | "Body for response 4" |
| 359 | #define HTTP_RESPONSE_FORMAT5 \ |
| 360 | "HTTP/1.0 200 OK\r\n" \ |
| 361 | "X-Response-ID: %d\r\n" \ |
| 362 | "Content-Type: text/html\r\n" \ |
| 363 | "\r\n" \ |
| 364 | "Body for response 5" |
| 365 | #define HTTP_RESPONSE_FORMAT6 \ |
| 366 | "HTTP/1.0 200 OK\r\n" \ |
| 367 | "X-Response-ID: %d\r\n" \ |
| 368 | "Cache-Control: max-age=86400\r\n" \ |
| 369 | "Content-Language: English\r\n" \ |
| 370 | "\r\n" \ |
| 371 | "Body for response 6" |
| 372 | #define HTTP_RESPONSE_FORMAT7 \ |
| 373 | "HTTP/1.0 200 OK\r\n" \ |
| 374 | "X-Response-ID: %d\r\n" \ |
| 375 | "Cache-Control: max-age=86400\r\n" \ |
| 376 | "Content-Language: French\r\n" \ |
| 377 | "\r\n" \ |
no test coverage detected