fixed a bug in qse_httpd_addhnd().
exported qse_httpd_entaskerrorwithmvk()
This commit is contained in:
		| @ -1185,6 +1185,16 @@ QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskerror ( | ||||
| 	qse_htre_t*               req | ||||
| ); | ||||
|  | ||||
| QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskerrorwithmvk ( | ||||
| 	qse_httpd_t*              httpd, | ||||
| 	qse_httpd_client_t*       client, | ||||
| 	qse_httpd_task_t*         pred, | ||||
| 	int                       code, | ||||
| 	qse_http_method_t         method, | ||||
| 	const qse_http_version_t* version, | ||||
| 	int                       keepalive | ||||
| ); | ||||
|  | ||||
| QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskcontinue ( | ||||
| 	qse_httpd_t*              httpd, | ||||
| 	qse_httpd_client_t*       client, | ||||
|  | ||||
| @ -1431,7 +1431,7 @@ printf ("task_main_cgi_2 trigger[0].mask=%d trigger[1].mask=%d cmask=%d\n", | ||||
| 	return 1; | ||||
|  | ||||
| oops: | ||||
| 	return (qse_httpd_entask_error (httpd, client, task, 500, cgi->method, &cgi->version, cgi->keepalive) == QSE_NULL)? -1: 0; | ||||
| 	return (qse_httpd_entaskerrorwithmvk (httpd, client, task, 500, cgi->method, &cgi->version, cgi->keepalive) == QSE_NULL)? -1: 0; | ||||
| } | ||||
|  | ||||
| static int task_main_cgi ( | ||||
| @ -1595,7 +1595,7 @@ oops: | ||||
| 		cgi->script_htrd = QSE_NULL; | ||||
| 	} | ||||
|  | ||||
| 	return (qse_httpd_entask_error ( | ||||
| 	return (qse_httpd_entaskerrorwithmvk ( | ||||
| 		httpd, client, task, http_errnum,  | ||||
| 		cgi->method, &cgi->version, cgi->keepalive) == QSE_NULL)? -1: 0; | ||||
| } | ||||
|  | ||||
| @ -191,7 +191,7 @@ static QSE_INLINE int task_main_getfile ( | ||||
| 		int http_errnum; | ||||
| 		http_errnum = (httpd->errnum == QSE_HTTPD_ENOENT)? 404: | ||||
| 		              (httpd->errnum == QSE_HTTPD_EACCES)? 403: 500; | ||||
| 		x = qse_httpd_entask_error ( | ||||
| 		x = qse_httpd_entaskerrorwithmvk ( | ||||
| 			httpd, client, x, http_errnum,  | ||||
| 			file->method, &file->version, file->keepalive); | ||||
| 		goto no_file_send; | ||||
| @ -203,7 +203,7 @@ static QSE_INLINE int task_main_getfile ( | ||||
| 		int http_errnum; | ||||
| 		http_errnum = (httpd->errnum == QSE_HTTPD_ENOENT)? 404: | ||||
| 		              (httpd->errnum == QSE_HTTPD_EACCES)? 403: 500; | ||||
| 		x = qse_httpd_entask_error ( | ||||
| 		x = qse_httpd_entaskerrorwithmvk ( | ||||
| 			httpd, client, x, http_errnum,  | ||||
| 			file->method, &file->version, file->keepalive); | ||||
| 		goto no_file_send; | ||||
| @ -226,7 +226,7 @@ static QSE_INLINE int task_main_getfile ( | ||||
|  | ||||
| 		if (file->u.get.range.from >= st.size) | ||||
| 		{ | ||||
| 			x = qse_httpd_entask_error ( | ||||
| 			x = qse_httpd_entaskerrorwithmvk ( | ||||
| 				httpd, client, x, 416, file->method, &file->version, file->keepalive); | ||||
| 			goto no_file_send; | ||||
| 		} | ||||
| @ -491,7 +491,7 @@ static int task_main_putfile_2 ( | ||||
|  | ||||
| 	/* snatching is over. writing error may have occurred as well. | ||||
| 	 * file->u.put.status should hold a proper status code */ | ||||
| 	if (qse_httpd_entask_error ( | ||||
| 	if (qse_httpd_entaskerrorwithmvk ( | ||||
| 		httpd, client, task, file->u.put.status, | ||||
| 		file->method, &file->version, file->keepalive) == QSE_NULL) return -1; | ||||
| 	return 0; /* no more data to read. task over */ | ||||
| @ -516,7 +516,7 @@ static int task_main_putfile ( | ||||
| 	 * note: if initialization error occurred and there is contents for the | ||||
| 	 * client to send, this reply may get to the client before it finishes  | ||||
| 	 * sending the contents. */ | ||||
| 	if (qse_httpd_entask_error ( | ||||
| 	if (qse_httpd_entaskerrorwithmvk ( | ||||
| 		httpd, client, task, file->u.put.status, | ||||
| 		file->method, &file->version, file->keepalive) == QSE_NULL) return -1; | ||||
| 	return 0; /* task over */ | ||||
|  | ||||
| @ -1854,7 +1854,7 @@ qse_printf (QSE_T("TRAILING DATA=%d, [%hs]\n"), (int)QSE_MBS_LEN(proxy->res), QS | ||||
|  | ||||
| oops: | ||||
| 	if (proxy->resflags & PROXY_RES_EVER_SENTBACK) return -1; | ||||
| 	return (qse_httpd_entask_error (httpd, client, task, http_errnum, proxy->method, &proxy->version, proxy->keepalive) == QSE_NULL)? -1: 0; | ||||
| 	return (qse_httpd_entaskerrorwithmvk (httpd, client, task, http_errnum, proxy->method, &proxy->version, proxy->keepalive) == QSE_NULL)? -1: 0; | ||||
| } | ||||
|  | ||||
| static int task_main_proxy_1 ( | ||||
| @ -1947,7 +1947,7 @@ static int task_main_proxy_1 ( | ||||
| 	return 1; | ||||
|  | ||||
| oops: | ||||
| 	return (qse_httpd_entask_error (httpd, client, task, http_errnum, proxy->method, &proxy->version, proxy->keepalive) == QSE_NULL)? -1: 0; | ||||
| 	return (qse_httpd_entaskerrorwithmvk (httpd, client, task, http_errnum, proxy->method, &proxy->version, proxy->keepalive) == QSE_NULL)? -1: 0; | ||||
| } | ||||
|  | ||||
| static void on_peer_name_resolved (qse_httpd_t* httpd, const qse_mchar_t* name, const qse_nwad_t* nwad, void* ctx) | ||||
| @ -2406,7 +2406,7 @@ oops: | ||||
| 		proxy->peer_htrd = QSE_NULL; | ||||
| 	} | ||||
|  | ||||
| 	return (qse_httpd_entask_error ( | ||||
| 	return (qse_httpd_entaskerrorwithmvk ( | ||||
| 		httpd, client, task, http_errnum,  | ||||
| 		proxy->method, &proxy->version, proxy->keepalive) == QSE_NULL)? -1: 0; | ||||
| } | ||||
|  | ||||
| @ -228,10 +228,12 @@ qse_httpd_task_t* qse_httpd_entask_status ( | ||||
| } | ||||
| /*------------------------------------------------------------------------*/ | ||||
|  | ||||
| qse_httpd_task_t* qse_httpd_entask_error ( | ||||
| qse_httpd_task_t* qse_httpd_entaskerrorwithmvk ( | ||||
| 	qse_httpd_t* httpd, qse_httpd_client_t* client,  | ||||
| 	qse_httpd_task_t* pred, int code, | ||||
| 	qse_http_method_t method, const qse_http_version_t* version, int keepalive) | ||||
| 	qse_http_method_t method, | ||||
| 	const qse_http_version_t* version, | ||||
| 	int keepalive) | ||||
| { | ||||
| 	return qse_httpd_entask_status (httpd, client, pred, code, QSE_NULL, method, version, keepalive); | ||||
| } | ||||
|  | ||||
| @ -906,7 +906,7 @@ int qse_httpd_addhnd (qse_httpd_t* httpd, qse_httpd_hnd_t handle, int mask, qse_ | ||||
| 	/* qse_httpd_loop() opens the multiplexer. you can call this function from  | ||||
| 	 * preloop/postloop hooks only. but calling it from postloop hooks is | ||||
| 	 * useless. */ | ||||
| 	return httpd->opt.scb.mux.addhnd (httpd, httpd->mux, handle, QSE_HTTPD_MUX_READ, mate); | ||||
| 	return httpd->opt.scb.mux.addhnd (httpd, httpd->mux, handle, mask, mate); | ||||
| } | ||||
|  | ||||
| int qse_httpd_delhnd (qse_httpd_t* httpd, qse_httpd_hnd_t handle) | ||||
|  | ||||
| @ -132,16 +132,6 @@ qse_httpd_task_t* qse_httpd_entask_status ( | ||||
| 	int keepalive | ||||
| ); | ||||
|  | ||||
| qse_httpd_task_t* qse_httpd_entask_error ( | ||||
| 	qse_httpd_t* httpd, | ||||
| 	qse_httpd_client_t* client, | ||||
| 	qse_httpd_task_t* pred, | ||||
| 	int code, | ||||
| 	qse_http_method_t method, | ||||
| 	const qse_http_version_t* version, | ||||
| 	int keepalive | ||||
| ); | ||||
|  | ||||
| qse_httpd_task_t* qse_httpd_entask_nomod ( | ||||
| 	qse_httpd_t* httpd, | ||||
| 	qse_httpd_client_t* client, | ||||
|  | ||||
		Reference in New Issue
	
	Block a user