| 5882 | */ |
| 5883 | |
| 5884 | int /* O - 1 on success, 0 on failure */ |
| 5885 | process_http(ippeve_client_t *client) /* I - Client connection */ |
| 5886 | { |
| 5887 | char uri[1024]; /* URI */ |
| 5888 | http_state_t http_state; /* HTTP state */ |
| 5889 | http_status_t http_status; /* HTTP status */ |
| 5890 | ipp_state_t ipp_state; /* State of IPP transfer */ |
| 5891 | char scheme[32], /* Method/scheme */ |
| 5892 | userpass[128], /* Username:password */ |
| 5893 | hostname[HTTP_MAX_HOST], |
| 5894 | /* Hostname */ |
| 5895 | *ptr; /* Pointer into value */ |
| 5896 | int port; /* Port number */ |
| 5897 | static const char * const http_states[] = |
| 5898 | { /* Strings for logging HTTP method */ |
| 5899 | "WAITING", |
| 5900 | "OPTIONS", |
| 5901 | "GET", |
| 5902 | "GET_SEND", |
| 5903 | "HEAD", |
| 5904 | "POST", |
| 5905 | "POST_RECV", |
| 5906 | "POST_SEND", |
| 5907 | "PUT", |
| 5908 | "PUT_RECV", |
| 5909 | "DELETE", |
| 5910 | "TRACE", |
| 5911 | "CONNECT", |
| 5912 | "STATUS", |
| 5913 | "UNKNOWN_METHOD", |
| 5914 | "UNKNOWN_VERSION" |
| 5915 | }; |
| 5916 | |
| 5917 | |
| 5918 | /* |
| 5919 | * Clear state variables... |
| 5920 | */ |
| 5921 | |
| 5922 | client->username[0] = '\0'; |
| 5923 | |
| 5924 | ippDelete(client->request); |
| 5925 | ippDelete(client->response); |
| 5926 | |
| 5927 | client->request = NULL; |
| 5928 | client->response = NULL; |
| 5929 | client->operation = HTTP_STATE_WAITING; |
| 5930 | |
| 5931 | /* |
| 5932 | * Read a request from the connection... |
| 5933 | */ |
| 5934 | |
| 5935 | while ((http_state = httpReadRequest(client->http, uri, |
| 5936 | sizeof(uri))) == HTTP_STATE_WAITING) |
| 5937 | usleep(1); |
| 5938 | |
| 5939 | /* |
| 5940 | * Parse the request line... |
| 5941 | */ |
no test coverage detected