Description
TSFetchURL() has a number of shortcomings:
1. it's not cancellable
2. the event delivery is bizarre
3. it doesn't play nicely with the TSHttpHdr*() API.
I propose the following API changes:
typedef enum
{
...
TS_EVENT_FETCH_SUCCESS,
TS_EVENT_FETCH_FAILURE
} TSEvent;
TSAction TSFetchResource(TSCont, TSMBuffer, TSLoc, const sockaddr *, TSFetchWakeUpOptions);
TSFetchResource() takes a TSMBuffer/TSLoc pair that must contain the HTTP and MIME headers. If the HTTP method in the HTTP header is not GET, and a error will be reported.
The continuation callback will be invoked with either TS_EVENT_FETCH_SUCCESS or TS_EVENT_FETCH_SUCCESS. For TS_EVENT_FETCH_SUCCESS, the edata pointer will be a HttpTxn pointer suitable for call TSFetchRespGet() or TSFetchHdrGet(). For TS_EVENT_FETCH_FAILURE, I'd like to arrange a way to get the HTTP error code. Hopefully there is some existing precedent to follow.
TSFetchResource() should be cancellable via the TSAction return value.
I'm not sure whether TSFetchWakeUpOptions is really necessary, but if we eliminate this, I'd argue for a uint64_t flags parameter.
Attachments
Issue Links
- is related to
-
TS-817 TSFetchUrl/TSFetchPages does not work with HTTP/1.1 requests
- Closed
-
TS-1054 TSFetchUrl takes an address but does the DNS lookup anyway
- Closed
-
TS-1043 PATCH: teach TSFetchUrl to use the content-length to find the after_body event
- Closed
-
TS-1062 Introduce extended FetchSM API
- Closed
- relates to
-
TS-1499 ESI plugin does not work well with 'Connection: keep-alive'
- Patch Available
-
TS-1045 PATCH: add new TSFetchHdrGet API
- Closed
-
TS-1337 Extend TS API to support TSHttpConnect with outbound transparency
- Closed