ne_get_status.3 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. '\" t
  2. .\" Title: ne_get_status
  3. .\" Author:
  4. .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
  5. .\" Date: 23 November 2025
  6. .\" Manual: neon API reference
  7. .\" Source: neon 0.36.0
  8. .\" Language: English
  9. .\"
  10. .TH "NE_GET_STATUS" "3" "23 November 2025" "neon 0.36.0" "neon API reference"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. ne_get_status, ne_get_response_location, ne_get_response_retry_after \- retrieve HTTP response properties
  32. .SH "SYNOPSIS"
  33. .sp
  34. .ft B
  35. .nf
  36. #include <ne_request\&.h>
  37. .fi
  38. .ft
  39. .HP \w'const\ ne_status\ *ne_get_status('u
  40. .BI "const ne_status *ne_get_status(const\ ne_request\ *" "request" ");"
  41. .HP \w'ne_uri\ *ne_get_response_location('u
  42. .BI "ne_uri *ne_get_response_location(ne_request\ *" "request" ");"
  43. .HP \w'time_t\ ne_get_response_retry_after('u
  44. .BI "time_t ne_get_response_retry_after(ne_request\ *" "request" ");"
  45. .SH "DESCRIPTION"
  46. .PP
  47. The
  48. \fBne_get_status\fR
  49. function returns a pointer to the HTTP status object giving the result of a request\&. The object returned only becomes valid once the request has been
  50. \fIsuccessfully\fR
  51. dispatched (the return value of
  52. \fBne_request_dispatch\fR
  53. or
  54. \fBne_begin_request\fR
  55. was zero)\&.
  56. .PP
  57. If the response includes a
  58. Location
  59. header, the
  60. \fBne_get_response_location\fR
  61. function parses and resolves the URI\-reference relative to the request target\&. If a fragment ("#fragment") is applicable to the request target, it can be passed as an argument to allow appropriate relative resolution\&.
  62. .PP
  63. The
  64. \fBne_get_response_retry_after\fR
  65. function parses any
  66. Retry\-After
  67. header included in the response\&. If the header value uses a relative time, it is interpreted relative to the time the function was invoked, rather than the time the response was received, so the function should be used directly after dispatching the request\&.
  68. .SH "RETURN VALUE"
  69. .PP
  70. \fBne_get_status\fR
  71. returns a pointer to the HTTP status object giving the result of a request\&. This pointer is valid until the associated request object is destroyed\&.
  72. .PP
  73. \fBne_get_response_location\fR
  74. returns a malloc\-allocated ne_uri object, or NULL if either the URI in the Location header could not be parsed or the Location header was not present\&.
  75. .PP
  76. \fBne_get_response_retry_after\fR
  77. returns a time_t value, or zero if either no Retry\-After header was included or the header value could not be parsed\&.
  78. .SH "EXAMPLES"
  79. .PP
  80. Display the response status code of applying the
  81. HEAD
  82. method to some resource\&.
  83. .sp
  84. .if n \{\
  85. .RS 4
  86. .\}
  87. .nf
  88. ne_request *req = ne_request_create(sess, "HEAD", "/foo/bar");
  89. if (ne_request_dispatch(req))
  90. /* handle errors\&.\&.\&. */
  91. else
  92. printf("Response status code was %d\en", ne_get_status(req)\->code);
  93. ne_request_destroy(req);
  94. .fi
  95. .if n \{\
  96. .RE
  97. .\}
  98. .SH "HISTORY"
  99. .PP
  100. \fBne_get_response_location\fR
  101. is available in neon 0\&.34\&.0 and later\&.
  102. .SH "SEE ALSO"
  103. .PP
  104. ne_status,
  105. ne_request_create
  106. .SH "COPYRIGHT"
  107. .br
  108. Copyright \(co 2001-2025 Joe Orton
  109. .br